forked from calcom/cal.com
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add playwright for e2e testing (calcom#873)
- Loading branch information
Showing
10 changed files
with
777 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import type { Config } from "@jest/types"; | ||
|
||
const config: Config.InitialOptions = { | ||
verbose: true, | ||
roots: ["<rootDir>"], | ||
testMatch: ["**/tests/**/*.+(ts|tsx|js)", "**/?(*.)+(spec|test).+(ts|tsx|js)"], | ||
testPathIgnorePatterns: ["<rootDir>/.next", "<rootDir>/playwright/", "<rootDir>/cypress/"], | ||
transform: { | ||
"^.+\\.(js|jsx|ts|tsx)$": ["babel-jest", { presets: ["next/babel"] }], | ||
}, | ||
transformIgnorePatterns: ["/node_modules/", "^.+\\.module\\.(css|sass|scss)$"], | ||
testEnvironment: "jsdom", | ||
moduleNameMapper: { | ||
"^@components(.*)$": "<rootDir>/components$1", | ||
"^@lib(.*)$": "<rootDir>/lib$1", | ||
}, | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module.exports = { | ||
verbose: true, | ||
preset: "jest-playwright-preset", | ||
transform: { | ||
"^.+\\.ts$": "ts-jest", | ||
}, | ||
testMatch: ["<rootDir>/playwright/**/?(*.)+(spec|test).[jt]s?(x)"], | ||
testEnvironmentOptions: { | ||
"jest-playwright": { | ||
browsers: ["chromium" /*, 'firefox', 'webkit'*/], | ||
exitOnPageError: false, | ||
launchOptions: { | ||
// launch headless on CI, in browser locally | ||
headless: !!process.env.CI, | ||
executablePath: process.env.PLAYWRIGHT_CHROME_EXECUTABLE_PATH, | ||
}, | ||
contextOptions: { | ||
recordVideo: { | ||
dir: "playwright/videos/", | ||
}, | ||
}, | ||
collectCoverage: true, | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
jest.setTimeout(35e3); | ||
|
||
test("go to /pro", async () => { | ||
// Go to http://localhost:3000/auth/login | ||
await page.goto("http://localhost:3000/auth/login"); | ||
// Click input[name="email"] | ||
await page.click('input[name="email"]'); | ||
// Fill input[name="email"] | ||
await page.fill('input[name="email"]', "[email protected]"); | ||
// Press Tab | ||
await page.press('input[name="email"]', "Tab"); | ||
// Fill input[name="password"] | ||
await page.fill('input[name="password"]', "pro"); | ||
// Press Enter | ||
await page.press('input[name="password"]', "Enter"); | ||
|
||
await page.waitForSelector("[data-testid=event-types]"); | ||
|
||
const $eventTypes = await page.$$("[data-testid=event-types] > *"); | ||
expect($eventTypes.length).toBeGreaterThanOrEqual(2); | ||
}); | ||
|
||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.