♻️ (GeneralPage): refactor API calls into custom hooks for better modularity

✨ (GeneralPage): add custom hooks for patching gradient, password, and saving API key
💡 (GeneralPage): add useScrollToElement hook to handle smooth scrolling to elements

✨ (hooks): add useSaveKey and useScrollToElement custom hooks

✅ (tests): update end-to-end tests for improved stability and accuracy
This commit is contained in:
cristhianzl 2024-06-04 20:48:39 -03:00
commit 898e9f101a
8 changed files with 179 additions and 102 deletions

View file

@ -11,6 +11,7 @@ test("shoud delete a flow", async ({ page }) => {
.fill(process.env.STORE_API_KEY ?? "");
await page.getByText("Save").last().click();
await page.waitForTimeout(8000);
await page.getByText("Store").nth(0).click();
await page.getByTestId("install-Website Content QA").click();
await page.waitForTimeout(5000);

View file

@ -45,7 +45,8 @@ test("flowSettings", async ({ page }) => {
);
await page.getByTestId("save-flow-settings").click();
await page.getByTestId("save-flow-settings").click();
await page.getByText("Close").last().click();
await page.waitForTimeout(1000);

View file

@ -96,27 +96,29 @@ test("should filter by type", async ({ page }) => {
await page.getByText("Website Content QA").isVisible();
await page.getByTestId("flows-button-store").click();
await page.waitForTimeout(3000);
await page.waitForTimeout(8000);
let iconGroup = await page.getByTestId("icon-Group")?.count();
expect(iconGroup).not.toBe(0);
await page.getByText("icon-ToyBrick").isHidden();
await page.getByText("icon-ToyBrick").last().isHidden();
await page.getByTestId("components-button-store").click();
await page.waitForTimeout(3000);
await page.waitForTimeout(8000);
await page.getByTestId("icon-Group").isHidden();
await page.getByTestId("icon-Group").last().isHidden();
let toyBrick = await page.getByTestId("icon-ToyBrick")?.count();
expect(toyBrick).not.toBe(0);
await page.getByTestId("all-button-store").click();
await page.waitForTimeout(3000);
await page.waitForTimeout(8000);
iconGroup = await page.getByTestId("icon-Group")?.count();
toyBrick = await page.getByTestId("icon-ToyBrick")?.count();
let iconGroupAllCount = await page.getByTestId("icon-Group")?.count();
await page.waitForTimeout(2000);
let toyBrickAllCount = await page.getByTestId("icon-ToyBrick")?.count();
await page.waitForTimeout(2000);
if (iconGroup === 0 || toyBrick === 0) {
if (iconGroupAllCount === 0 || toyBrickAllCount === 0) {
expect(false).toBe(true);
}
});
@ -252,6 +254,7 @@ test("should share component with share button", async ({ page }) => {
.getByPlaceholder("Flow description")
.inputValue();
await page.getByText("Save").last().click();
await page.getByText("Close").last().click();
await page.getByTestId("icon-Share3").first().click();
await page.getByText("Name:").isVisible();