mirror of
https://github.com/formbricks/formbricks.git
synced 2026-01-06 13:49:54 -06:00
hotfix: e2e tests (#2164)
This commit is contained in:
@@ -111,7 +111,7 @@ export default function MemberActions({ team, member, invite, showDeleteButton }
|
||||
onClick={() => {
|
||||
handleShareInvite();
|
||||
}}
|
||||
id="shareInviteButton">
|
||||
className="shareInviteButton">
|
||||
<ShareIcon className="h-5 w-5 text-slate-700 hover:text-slate-500" />
|
||||
</button>
|
||||
</TooltipTrigger>
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
"use client";
|
||||
|
||||
import jsPackageJson from "@/../../packages/js/package.json";
|
||||
import { finishOnboardingAction } from "@/app/(app)/onboarding/actions";
|
||||
import { ConnectWithFormbricks } from "@/app/(app)/onboarding/components/inapp/ConnectWithFormbricks";
|
||||
import { InviteTeamMate } from "@/app/(app)/onboarding/components/inapp/InviteTeamMate";
|
||||
import { Objective } from "@/app/(app)/onboarding/components/inapp/SurveyObjective";
|
||||
import { Role } from "@/app/(app)/onboarding/components/inapp/SurveyRole";
|
||||
import { CreateFirstSurvey } from "@/app/(app)/onboarding/components/link/CreateFirstSurvey";
|
||||
import { Session } from "next-auth";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import { TEnvironment } from "@formbricks/types/environment";
|
||||
@@ -33,6 +35,7 @@ export function Onboarding({
|
||||
team,
|
||||
webAppUrl,
|
||||
}: OnboardingProps) {
|
||||
const router = useRouter();
|
||||
const [selectedPathway, setSelectedPathway] = useState<string | null>(null);
|
||||
const [progress, setProgress] = useState<number>(16);
|
||||
const [formbricksResponseId, setFormbricksResponseId] = useState<string | undefined>();
|
||||
@@ -142,6 +145,17 @@ export function Onboarding({
|
||||
|
||||
return (
|
||||
<div className="flex h-full w-full flex-col items-center bg-slate-50">
|
||||
<div className="hidden">
|
||||
<button
|
||||
id="FB__INTERNAL__SKIP_ONBOARDING"
|
||||
onClick={async () => {
|
||||
await finishOnboardingAction();
|
||||
router.push(`/environments/${environment.id}/surveys`);
|
||||
}}>
|
||||
Skip onboarding
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<OnboardingHeader progress={progress} />
|
||||
<div className="mt-20 flex w-full justify-center bg-slate-50">
|
||||
{renderOnboardingStep()}
|
||||
|
||||
@@ -64,7 +64,8 @@ test.describe("JS Package Test", async () => {
|
||||
// Formbricks Modal is visible
|
||||
await expect(page.getByRole("link", { name: "Powered by Formbricks" })).toBeVisible();
|
||||
|
||||
await page.waitForTimeout(1000);
|
||||
await page.waitForLoadState("networkidle");
|
||||
await page.waitForTimeout(1500);
|
||||
});
|
||||
|
||||
test("Admin checks Display", async ({ page }) => {
|
||||
@@ -74,9 +75,11 @@ test.describe("JS Package Test", async () => {
|
||||
(await page.waitForSelector("text=Responses")).isVisible();
|
||||
|
||||
// Survey should have 1 Display
|
||||
await page.waitForTimeout(1000);
|
||||
await expect(page.getByText("Displays1")).toBeVisible();
|
||||
|
||||
// Survey should have 0 Responses
|
||||
await page.waitForTimeout(1000);
|
||||
await expect(page.getByRole("button", { name: "Responses0% -" })).toBeVisible();
|
||||
});
|
||||
|
||||
@@ -115,7 +118,7 @@ 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);
|
||||
await page.waitForTimeout(1500);
|
||||
});
|
||||
|
||||
test("Admin validates Response", async ({ page }) => {
|
||||
@@ -125,8 +128,11 @@ test.describe("JS Package Test", async () => {
|
||||
(await page.waitForSelector("text=Responses")).isVisible();
|
||||
|
||||
// Survey should have 2 Displays
|
||||
await page.waitForTimeout(1000);
|
||||
await expect(page.getByText("Displays2")).toBeVisible();
|
||||
|
||||
// Survey should have 1 Response
|
||||
await page.waitForTimeout(1000);
|
||||
await expect(page.getByRole("button", { name: "Responses50%" })).toBeVisible();
|
||||
await expect(page.getByText("1 responses", { exact: true }).first()).toBeVisible();
|
||||
await expect(page.getByText("Clickthrough Rate (CTR)100%")).toBeVisible();
|
||||
|
||||
@@ -14,8 +14,10 @@ test.describe("Onboarding Flow Test", async () => {
|
||||
|
||||
await page.getByRole("button", { name: "Link Surveys Create a new" }).click();
|
||||
await page.getByRole("button", { name: "Collect Feedback Collect" }).click();
|
||||
await page.getByRole("button", { name: "Back", exact: true }).click();
|
||||
await page.getByRole("button", { name: "Save" }).click();
|
||||
|
||||
await page.waitForURL(/\/environments\/[^/]+\/surveys/);
|
||||
await expect(page.getByText(productName)).toBeVisible();
|
||||
});
|
||||
|
||||
test("In app survey", async ({ page }) => {
|
||||
@@ -24,6 +26,10 @@ test.describe("Onboarding Flow Test", async () => {
|
||||
await page.waitForURL("/onboarding");
|
||||
await expect(page).toHaveURL("/onboarding");
|
||||
await page.getByRole("button", { name: "In-app Surveys Run a survey" }).click();
|
||||
|
||||
await page.getByRole("button", { name: "Skip" }).click();
|
||||
await page.getByRole("button", { name: "Skip" }).click();
|
||||
|
||||
await page.getByRole("button", { name: "I am not sure how to do this" }).click();
|
||||
await page.locator("input").click();
|
||||
await page.locator("input").fill("test@gmail.com");
|
||||
|
||||
@@ -58,7 +58,7 @@ test.describe("Invite, accept and remove team member", async () => {
|
||||
const pendingSpan = lastMemberInfo.locator("span").filter({ hasText: "Pending" });
|
||||
await expect(pendingSpan).toBeVisible();
|
||||
|
||||
const shareInviteButton = page.locator("#shareInviteButton");
|
||||
const shareInviteButton = page.locator(".shareInviteButton").last();
|
||||
await expect(shareInviteButton).toBeVisible();
|
||||
|
||||
await shareInviteButton.click();
|
||||
|
||||
@@ -12,11 +12,19 @@ export const signUpAndLogin = async (
|
||||
await page.goto("/auth/login");
|
||||
await page.getByRole("link", { name: "Create an account" }).click();
|
||||
await page.getByRole("button", { name: "Continue with Email" }).click();
|
||||
|
||||
await expect(page.getByPlaceholder("Full Name")).toBeVisible();
|
||||
await page.getByPlaceholder("Full Name").fill(name);
|
||||
await page.getByPlaceholder("Full Name").press("Tab");
|
||||
|
||||
await expect(page.getByPlaceholder("work@email.com")).toBeVisible();
|
||||
|
||||
await page.getByPlaceholder("work@email.com").click();
|
||||
await page.getByPlaceholder("work@email.com").fill(email);
|
||||
await page.getByPlaceholder("work@email.com").press("Tab");
|
||||
|
||||
await expect(page.getByPlaceholder("*******")).toBeVisible();
|
||||
|
||||
await page.getByPlaceholder("*******").click();
|
||||
await page.getByPlaceholder("*******").fill(password);
|
||||
await page.getByRole("button", { name: "Continue with Email" }).click();
|
||||
@@ -30,8 +38,17 @@ export const signUpAndLogin = async (
|
||||
|
||||
export const login = async (page: Page, email: string, password: string): Promise<void> => {
|
||||
await page.goto("/auth/login");
|
||||
|
||||
await expect(page.getByRole("button", { name: "Login with Email" })).toBeVisible();
|
||||
|
||||
await page.getByRole("button", { name: "Login with Email" }).click();
|
||||
|
||||
await expect(page.getByPlaceholder("work@email.com")).toBeVisible();
|
||||
|
||||
await page.getByPlaceholder("work@email.com").fill(email);
|
||||
|
||||
await expect(page.getByPlaceholder("*******")).toBeVisible();
|
||||
|
||||
await page.getByPlaceholder("*******").click();
|
||||
await page.getByPlaceholder("*******").fill(password);
|
||||
await page.getByRole("button", { name: "Login with Email" }).click();
|
||||
@@ -40,11 +57,19 @@ export const login = async (page: Page, email: string, password: string): Promis
|
||||
export const finishOnboarding = async (page: Page): Promise<void> => {
|
||||
await page.waitForURL("/onboarding");
|
||||
await expect(page).toHaveURL("/onboarding");
|
||||
await page.getByRole("button", { name: "In-app Surveys Run a survey" }).click();
|
||||
await page.getByRole("button", { name: "I am not sure how to do this" }).click();
|
||||
await page.locator("input").click();
|
||||
await page.locator("input").fill("test@gmail.com");
|
||||
await page.getByRole("button", { name: "Invite" }).click();
|
||||
|
||||
const hiddenSkipButton = page.locator("#FB__INTERNAL__SKIP_ONBOARDING");
|
||||
hiddenSkipButton.evaluate((el: HTMLElement) => el.click());
|
||||
|
||||
// await page.getByRole("button", { name: "In-app Surveys Run a survey" }).click();
|
||||
|
||||
// await page.getByRole("button", { name: "Skip" }).click();
|
||||
// await page.getByRole("button", { name: "Skip" }).click();
|
||||
|
||||
// await page.getByRole("button", { name: "I am not sure how to do this" }).click();
|
||||
// await page.locator("input").click();
|
||||
// await page.locator("input").fill("test@gmail.com");
|
||||
// await page.getByRole("button", { name: "Invite" }).click();
|
||||
await page.waitForURL(/\/environments\/[^/]+\/surveys/);
|
||||
await expect(page.getByText("My Product")).toBeVisible();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user