Refactor: Improve wait times and selectors in sticky-notes.spec.ts (#5100)

* refactor: Improve wait times and selectors in sticky-notes.spec.ts
This commit is contained in:
anovazzi1 2024-12-09 13:01:12 -03:00 committed by GitHub
commit f673630fd4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -57,7 +57,9 @@ The future of AI is both exciting and uncertain. As the technology continues to
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 3000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
@ -67,9 +69,7 @@ The future of AI is both exciting and uncertain. As the technology continues to
await page.getByTestId("blank-flow").click();
await page.getByTestId("add_note").click();
await page.waitForTimeout(1000);
const targetElement = await page.locator('//*[@id="react-flow-id"]');
const targetElement = page.locator('//*[@id="react-flow-id"]');
await targetElement.click();
await page.mouse.up();
@ -116,6 +116,7 @@ The future of AI is both exciting and uncertain. As the technology continues to
await page.getByTestId("color_picker").click();
await page.getByTestId("color_picker_button_rose").click();
//await for the animation to complete
await page.waitForTimeout(1000);
await page.getByTestId("note_node").click();
@ -145,31 +146,22 @@ The future of AI is both exciting and uncertain. As the technology continues to
await page.getByText("Copy").click();
await page.waitForTimeout(1000);
await page.getByTestId("fit_view").click();
await page.getByTestId("zoom_out").click();
await page.getByTestId("zoom_out").click();
targetElement.focus();
targetElement.click();
await page.waitForTimeout(1000);
targetElement.click();
await page.waitForTimeout(1000);
targetElement.click();
//double click
await targetElement.click();
await targetElement.click();
await page.keyboard.press(`ControlOrMeta+v`);
await page.waitForTimeout(1000);
titleNumber = await page.getByText(randomTitle).count();
expect(titleNumber).toBe(3);
await page.getByTestId("note_node").nth(0).focus();
await page.getByTestId("note_node").last().click();
await page.getByTestId("more-options-modal").click();
await page.getByText("Delete").first().click();
await page.waitForTimeout(1000);
titleNumber = await page.getByText(randomTitle).count();
expect(titleNumber).toBe(2);