Multiple E2E improvements
This commit is contained in:
@@ -44,11 +44,7 @@ test.describe("free user", () => {
|
|||||||
await bookTimeSlot(page);
|
await bookTimeSlot(page);
|
||||||
|
|
||||||
// Make sure we're navigated to the success page
|
// Make sure we're navigated to the success page
|
||||||
await page.waitForNavigation({
|
await expect(page.locator("[data-testid=success-page]")).toBeVisible();
|
||||||
url(url) {
|
|
||||||
return url.pathname.endsWith("/success");
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
// return to same time spot booking page
|
// return to same time spot booking page
|
||||||
await page.goto(bookingUrl);
|
await page.goto(bookingUrl);
|
||||||
@@ -98,11 +94,7 @@ test.describe("pro user", () => {
|
|||||||
await bookTimeSlot(page);
|
await bookTimeSlot(page);
|
||||||
|
|
||||||
// Make sure we're navigated to the success page
|
// Make sure we're navigated to the success page
|
||||||
await page.waitForNavigation({
|
await expect(page.locator("[data-testid=success-page]")).toBeVisible();
|
||||||
url(url) {
|
|
||||||
return url.pathname.endsWith("/success");
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
test("can reschedule a booking", async ({ page }) => {
|
test("can reschedule a booking", async ({ page }) => {
|
||||||
await bookFirstEvent(page);
|
await bookFirstEvent(page);
|
||||||
|
|||||||
@@ -46,11 +46,7 @@ test.describe("hash my url", () => {
|
|||||||
await bookTimeSlot(page);
|
await bookTimeSlot(page);
|
||||||
|
|
||||||
// Make sure we're navigated to the success page
|
// Make sure we're navigated to the success page
|
||||||
await page.waitForNavigation({
|
await expect(page.locator("[data-testid=success-page]")).toBeVisible();
|
||||||
url(url) {
|
|
||||||
return url.pathname.endsWith("/success");
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("hash regenerates after successful booking", async ({ page }) => {
|
test("hash regenerates after successful booking", async ({ page }) => {
|
||||||
|
|||||||
@@ -71,11 +71,7 @@ test.describe.serial("Stripe integration", () => {
|
|||||||
await page.click('button:has-text("Pay now")');
|
await page.click('button:has-text("Pay now")');
|
||||||
|
|
||||||
// Make sure we're navigated to the success page
|
// Make sure we're navigated to the success page
|
||||||
await page.waitForNavigation({
|
await expect(page.locator("[data-testid=success-page]")).toBeVisible();
|
||||||
url(url) {
|
|
||||||
return url.pathname.endsWith("/success");
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
todo("Pending payment booking should not be confirmed by default");
|
todo("Pending payment booking should not be confirmed by default");
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Page, test } from "@playwright/test";
|
import { expect, Page, test } from "@playwright/test";
|
||||||
import { createServer, IncomingMessage, ServerResponse } from "http";
|
import { createServer, IncomingMessage, ServerResponse } from "http";
|
||||||
|
|
||||||
export function todo(title: string) {
|
export function todo(title: string) {
|
||||||
@@ -99,11 +99,7 @@ export async function bookFirstEvent(page: Page) {
|
|||||||
await page.press('[name="email"]', "Enter");
|
await page.press('[name="email"]', "Enter");
|
||||||
|
|
||||||
// Make sure we're navigated to the success page
|
// Make sure we're navigated to the success page
|
||||||
await page.waitForNavigation({
|
await expect(page.locator("[data-testid=success-page]")).toBeVisible();
|
||||||
url(url) {
|
|
||||||
return url.pathname.endsWith("/success");
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const bookTimeSlot = async (page: Page) => {
|
export const bookTimeSlot = async (page: Page) => {
|
||||||
|
|||||||
@@ -153,11 +153,7 @@ test.describe("Reschedule Tests", async () => {
|
|||||||
|
|
||||||
await page.locator('[data-testid="confirm-reschedule-button"]').click();
|
await page.locator('[data-testid="confirm-reschedule-button"]').click();
|
||||||
|
|
||||||
await page.waitForNavigation({
|
await expect(page.locator("[data-testid=success-page]")).toBeVisible();
|
||||||
url(url) {
|
|
||||||
return url.pathname.endsWith("/success");
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
await expect(page).toHaveURL(/.*success/);
|
await expect(page).toHaveURL(/.*success/);
|
||||||
|
|
||||||
|
|||||||
@@ -83,11 +83,7 @@ export async function bookFirstEvent(username: string, frame: Frame, page: Page)
|
|||||||
const responseObj = await response.json();
|
const responseObj = await response.json();
|
||||||
const bookingId = responseObj.uid;
|
const bookingId = responseObj.uid;
|
||||||
// Make sure we're navigated to the success page
|
// Make sure we're navigated to the success page
|
||||||
await frame.waitForNavigation({
|
await expect(page.locator("[data-testid=success-page]")).toBeVisible();
|
||||||
url(url) {
|
|
||||||
return url.pathname.endsWith("/success");
|
|
||||||
},
|
|
||||||
});
|
|
||||||
expect(await page.screenshot()).toMatchSnapshot("success-page.png");
|
expect(await page.screenshot()).toMatchSnapshot("success-page.png");
|
||||||
return bookingId;
|
return bookingId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { devices, PlaywrightTestConfig } from "@playwright/test";
|
import { devices, PlaywrightTestConfig } from "@playwright/test";
|
||||||
import { addAliases } from "module-alias";
|
import { addAliases } from "module-alias";
|
||||||
|
import * as os from "os";
|
||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
|
|
||||||
// Add aliases for the paths specified in the tsconfig.json file.
|
// Add aliases for the paths specified in the tsconfig.json file.
|
||||||
@@ -19,11 +20,14 @@ const testDir = path.join(__dirname, "..", "..", "apps/web/playwright");
|
|||||||
|
|
||||||
const DEFAULT_NAVIGATION_TIMEOUT = 5000;
|
const DEFAULT_NAVIGATION_TIMEOUT = 5000;
|
||||||
|
|
||||||
|
const headless = !!process.env.CI || !!process.env.PLAYWRIGHT_HEADLESS;
|
||||||
|
|
||||||
const config: PlaywrightTestConfig = {
|
const config: PlaywrightTestConfig = {
|
||||||
forbidOnly: !!process.env.CI,
|
forbidOnly: !!process.env.CI,
|
||||||
retries: 1,
|
retries: 1,
|
||||||
workers: 1,
|
workers: os.cpus().length,
|
||||||
timeout: 60_000,
|
timeout: 60_000,
|
||||||
|
maxFailures: headless ? 3 : undefined,
|
||||||
reporter: [
|
reporter: [
|
||||||
[process.env.CI ? "github" : "list"],
|
[process.env.CI ? "github" : "list"],
|
||||||
["html", { outputFolder: "./playwright/reports/playwright-html-report", open: "never" }],
|
["html", { outputFolder: "./playwright/reports/playwright-html-report", open: "never" }],
|
||||||
@@ -38,10 +42,10 @@ const config: PlaywrightTestConfig = {
|
|||||||
reuseExistingServer: !process.env.CI,
|
reuseExistingServer: !process.env.CI,
|
||||||
},
|
},
|
||||||
use: {
|
use: {
|
||||||
baseURL: "http://localhost:3000",
|
baseURL: "http://localhost:3000/",
|
||||||
locale: "en-US",
|
locale: "en-US",
|
||||||
trace: "retain-on-failure",
|
trace: "retain-on-failure",
|
||||||
headless: !!process.env.CI || !!process.env.PLAYWRIGHT_HEADLESS,
|
headless,
|
||||||
},
|
},
|
||||||
projects: [
|
projects: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -132,7 +132,7 @@
|
|||||||
},
|
},
|
||||||
"test-e2e": {
|
"test-e2e": {
|
||||||
"cache": false,
|
"cache": false,
|
||||||
"dependsOn": ["@calcom/web#test", "@calcom/web#build", "@calcom/prisma#db-reset"]
|
"dependsOn": ["@calcom/prisma#db-reset", "@calcom/web#test", "@calcom/web#build"]
|
||||||
},
|
},
|
||||||
"type-check": {
|
"type-check": {
|
||||||
"outputs": []
|
"outputs": []
|
||||||
|
|||||||
Reference in New Issue
Block a user