fix(components): add data-testid to edit flow button for better testability and identification

fix(dragAndDrop.spec): update locator for edit flow button to use data-testid for better stability
fix(group.spec): update locator for edit flow button to use data-testid for better stability
fix(saveComponents.spec): update locator for edit flow button to use data-testid for better stability
This commit is contained in:
cristhianzl 2024-01-15 22:31:46 -03:00
commit 4ebbafe493
4 changed files with 10 additions and 12 deletions

View file

@ -159,6 +159,9 @@ export default function ComponentsComponent({
variant="outline"
size="sm"
className="whitespace-nowrap "
data-testid={
"edit-flow-button-" + item.id + "-" + idx
}
>
<IconComponent
name="ExternalLink"

View file

@ -43,9 +43,7 @@ test.describe("drag and drop test", () => {
);
await page
.locator(
'//*[@id="root"]/div/div[1]/div[2]/div[3]/div/div/div/div/div/div/div/div[2]/span[2]'
)
.getByTestId("edit-flow-button-e9ac1bdc-429b-475d-ac03-d26f9a2a3210-0")
.click();
await page.waitForTimeout(2000);

View file

@ -33,7 +33,8 @@ test.describe("group node test", () => {
return dt;
}, jsonContent);
// Now dispatch
page.waitForTimeout(2000);
await page.dispatchEvent(
'//*[@id="root"]/div/div[1]/div[2]/div[3]/div/div',
"drop",
@ -43,9 +44,7 @@ test.describe("group node test", () => {
);
await page
.locator(
'//*[@id="root"]/div/div[1]/div[2]/div[3]/div/div/div/div/div/div/div/div[2]/span[2]'
)
.getByTestId("edit-flow-button-e9ac1bdc-429b-475d-ac03-d26f9a2a3210-0")
.click();
await page.waitForTimeout(2000);
@ -67,7 +66,6 @@ test.describe("group node test", () => {
});
await page.getByRole("button", { name: "Group" }).click();
await page.locator("div").filter({ hasText: "Star13756" }).nth(3).click();
const textArea = page.getByTestId("div-textarea-2");
const elementCountText = await textArea.count();
@ -80,5 +78,7 @@ test.describe("group node test", () => {
if (elementGroup > 0) {
expect(true).toBeTruthy();
}
// Now dispatch
});
});

View file

@ -51,9 +51,7 @@ test.describe("save component tests", () => {
);
await page
.locator(
'//*[@id="root"]/div/div[1]/div[2]/div[3]/div/div/div/div/div/div/div/div[2]/span[2]'
)
.getByTestId("edit-flow-button-e9ac1bdc-429b-475d-ac03-d26f9a2a3210-0")
.click();
await page.waitForTimeout(2000);
@ -75,7 +73,6 @@ test.describe("save component tests", () => {
});
await page.getByRole("button", { name: "Group" }).click();
await page.locator("div").filter({ hasText: "Star13756" }).nth(3).click();
let textArea = page.getByTestId("div-textarea-2");
let elementCountText = await textArea.count();