mirror of
https://github.com/formbricks/formbricks.git
synced 2025-12-30 10:19:51 -06:00
fix: e2e flakyness (#1961)
This commit is contained in:
@@ -16,6 +16,7 @@ const createNoCodeActionByCSSSelector = async (
|
||||
await skipOnboarding(page);
|
||||
|
||||
await page.getByRole("link", { name: "Actions & Attributes" }).click();
|
||||
await page.waitForURL(/\/environments\/[^/]+\/actions/);
|
||||
|
||||
// Add Action button
|
||||
await page.getByRole("button", { name: "Add Action" }).click();
|
||||
@@ -36,6 +37,8 @@ const createNoCodeActionByCSSSelector = async (
|
||||
await expect(page.locator("[name='noCodeConfig.cssSelector.value']")).toBeVisible();
|
||||
await page.locator("[name='noCodeConfig.cssSelector.value']").fill(selector);
|
||||
await page.getByRole("button", { name: "Track Action", exact: true }).click();
|
||||
await page.waitForLoadState("networkidle");
|
||||
await page.waitForTimeout(500);
|
||||
};
|
||||
|
||||
const createNoCodeActionByPageURL = async (
|
||||
@@ -55,6 +58,7 @@ const createNoCodeActionByPageURL = async (
|
||||
await skipOnboarding(page);
|
||||
|
||||
await page.getByRole("link", { name: "Actions & Attributes" }).click();
|
||||
await page.waitForURL(/\/environments\/[^/]+\/actions/);
|
||||
|
||||
// Add Action button
|
||||
await page.getByRole("button", { name: "Add Action" }).click();
|
||||
@@ -86,6 +90,8 @@ const createNoCodeActionByPageURL = async (
|
||||
|
||||
// User clicks the Track Action button
|
||||
await page.getByRole("button", { name: "Track Action", exact: true }).click();
|
||||
await page.waitForLoadState("networkidle");
|
||||
await page.waitForTimeout(500);
|
||||
};
|
||||
|
||||
const createNoCodeActionByInnerText = async (
|
||||
@@ -101,6 +107,7 @@ const createNoCodeActionByInnerText = async (
|
||||
await skipOnboarding(page);
|
||||
|
||||
await page.getByRole("link", { name: "Actions & Attributes" }).click();
|
||||
await page.waitForURL(/\/environments\/[^/]+\/actions/);
|
||||
|
||||
// Add Action button
|
||||
await page.getByRole("button", { name: "Add Action" }).click();
|
||||
@@ -121,6 +128,8 @@ const createNoCodeActionByInnerText = async (
|
||||
await expect(page.locator("[name='noCodeConfig.innerHtml.value']")).toBeVisible();
|
||||
await page.locator("[name='noCodeConfig.innerHtml.value']").fill(innerText);
|
||||
await page.getByRole("button", { name: "Track Action", exact: true }).click();
|
||||
await page.waitForLoadState("networkidle");
|
||||
await page.waitForTimeout(500);
|
||||
};
|
||||
|
||||
const getActionButtonLocator = (page: Page, actionName: string) => {
|
||||
@@ -147,6 +156,7 @@ test.describe("Create and Edit No Code Action by CSS Selector", async () => {
|
||||
const { email, password } = users.action[0];
|
||||
await login(page, email, password);
|
||||
await page.getByRole("link", { name: "Actions & Attributes" }).click();
|
||||
await page.waitForURL(/\/environments\/[^/]+\/actions/);
|
||||
|
||||
const actionButton = getActionButtonLocator(page, actions.create.noCode.cssSelector.name);
|
||||
await expect(actionButton).toBeVisible();
|
||||
@@ -191,6 +201,7 @@ test.describe("Create and Edit No Code Action by Page URL", async () => {
|
||||
await login(page, email, password);
|
||||
|
||||
await page.getByRole("link", { name: "Actions & Attributes" }).click();
|
||||
await page.waitForURL(/\/environments\/[^/]+\/actions/);
|
||||
|
||||
const actionButton = getActionButtonLocator(page, actions.create.noCode.pageURL.name);
|
||||
await expect(actionButton).toBeVisible();
|
||||
@@ -238,6 +249,7 @@ test.describe("Create and Edit No Code Action by Inner Text", async () => {
|
||||
|
||||
await login(page, email, password);
|
||||
await page.getByRole("link", { name: "Actions & Attributes" }).click();
|
||||
await page.waitForURL(/\/environments\/[^/]+\/actions/);
|
||||
|
||||
const actionButton = getActionButtonLocator(page, actions.create.noCode.innerText.name);
|
||||
await expect(actionButton).toBeVisible();
|
||||
@@ -267,6 +279,7 @@ test.describe("Create and Edit Code Action", async () => {
|
||||
await skipOnboarding(page);
|
||||
|
||||
await page.getByRole("link", { name: "Actions & Attributes" }).click();
|
||||
await page.waitForURL(/\/environments\/[^/]+\/actions/);
|
||||
|
||||
// Add Action button
|
||||
await page.getByRole("button", { name: "Add Action" }).click();
|
||||
@@ -281,11 +294,14 @@ test.describe("Create and Edit Code Action", async () => {
|
||||
await page.getByLabel("Description").fill(actions.create.code.description);
|
||||
|
||||
await page.getByRole("button", { name: "Track Action", exact: true }).click();
|
||||
await page.waitForLoadState("networkidle");
|
||||
await page.waitForTimeout(500);
|
||||
});
|
||||
|
||||
test("Edit Code Action", async ({ page }) => {
|
||||
await login(page, email, password);
|
||||
await page.getByRole("link", { name: "Actions & Attributes" }).click();
|
||||
await page.waitForURL(/\/environments\/[^/]+\/actions/);
|
||||
|
||||
const actionButton = getActionButtonLocator(page, actions.create.code.name);
|
||||
await expect(actionButton).toBeVisible();
|
||||
@@ -321,6 +337,7 @@ test.describe("Create and Delete Action", async () => {
|
||||
await login(page, email, password);
|
||||
|
||||
await page.getByRole("link", { name: "Actions & Attributes" }).click();
|
||||
await page.waitForURL(/\/environments\/[^/]+\/actions/);
|
||||
|
||||
const actionButton = getActionButtonLocator(page, actions.delete.noCode.name);
|
||||
await expect(actionButton).toBeVisible();
|
||||
|
||||
@@ -113,6 +113,8 @@ test.describe("JS Package Test", async () => {
|
||||
|
||||
// Formbricks Modal is not visible
|
||||
await expect(page.getByText("Powered by Formbricks")).not.toBeVisible({ timeout: 10000 });
|
||||
await page.waitForLoadState("networkidle");
|
||||
await page.waitForTimeout(500);
|
||||
});
|
||||
|
||||
test("Admin validates Response", async ({ page }) => {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { surveys, users } from "@/playwright/utils/mock";
|
||||
import { expect, test } from "@playwright/test";
|
||||
import path from "path";
|
||||
|
||||
import { signUpAndLogin, skipOnboarding } from "./utils/helper";
|
||||
|
||||
@@ -246,7 +245,11 @@ test.describe("Survey Create & Submit Response", async () => {
|
||||
await expect(
|
||||
page.locator("label").filter({ hasText: "Click or drag to upload files." }).locator("div").nth(0)
|
||||
).toBeVisible();
|
||||
await page.locator("input[type=file]").setInputFiles(path.join(__dirname, "survey.spec.ts"));
|
||||
await page.locator("input[type=file]").setInputFiles({
|
||||
name: "file.txt",
|
||||
mimeType: "text/plain",
|
||||
buffer: Buffer.from("this is test"),
|
||||
});
|
||||
await page.getByText("Uploading...").waitFor({ state: "hidden" });
|
||||
|
||||
await page.getByRole("button", { name: "Finish" }).click();
|
||||
|
||||
@@ -34,9 +34,11 @@ test.describe("Invite, accept and remove team member", async () => {
|
||||
await page.getByLabel("Email Address").fill(invites.addMember.email);
|
||||
|
||||
await page.getByRole("button", { name: "Send Invitation", exact: true }).click();
|
||||
await page.waitForLoadState("networkidle");
|
||||
await page.waitForTimeout(500);
|
||||
});
|
||||
|
||||
test("Copy Invite Link", async ({ page }) => {
|
||||
test("Copy invite Link", async ({ page }) => {
|
||||
await login(page, email, password);
|
||||
|
||||
const dropdownTrigger = page.locator("#userDropdownTrigger");
|
||||
@@ -71,7 +73,7 @@ test.describe("Invite, accept and remove team member", async () => {
|
||||
}
|
||||
});
|
||||
|
||||
test("Accept Invite", async ({ page }) => {
|
||||
test("Accept invite", async ({ page }) => {
|
||||
const { email, name, password } = users.team[1];
|
||||
page.goto(inviteLink);
|
||||
|
||||
@@ -85,7 +87,7 @@ test.describe("Invite, accept and remove team member", async () => {
|
||||
await skipOnboarding(page);
|
||||
});
|
||||
|
||||
test("Remove Member", async ({ page }) => {
|
||||
test("Remove member", async ({ page }) => {
|
||||
await login(page, email, password);
|
||||
|
||||
const dropdownTrigger = page.locator("#userDropdownTrigger");
|
||||
|
||||
Reference in New Issue
Block a user