-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(e2e): twenty-e2e-testing with playwright #6539
Merged
lucasbordeau
merged 11 commits into
twentyhq:main
from
Nabhag8848:feat/e2e-with-playwright
Aug 14, 2024
Merged
Changes from 5 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
d28b232
feat(e2e): twenty-e2e-testing with playwright
Nabhag8848 843fb0c
fix: to have config for baseUrl and remove configs for ci
Nabhag8848 9671068
feat: visible table e2e for /objects/companies
Nabhag8848 e21cf2a
feat: have scripts for e2e
Nabhag8848 11b7ac1
fix: remove running dev server
Nabhag8848 5b689ac
fix: example env to have line at the end
Nabhag8848 4ed1f1e
fix: to have only currently suggested browsers only
Nabhag8848 2b77cbc
Merge branch 'main' into feat/e2e-with-playwright
Nabhag8848 cd63dea
fix: playwright versioning and non duplicate versioning in lock file
Nabhag8848 652b05e
Fix README
lucasbordeau 8f95015
Merge branch 'main' into feat/e2e-with-playwright
lucasbordeau File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Note that provide always without trailing forward slash to have expected behaviour | ||
FRONTEND_BASE_URL="http://localhost:3001" | ||
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,5 @@ | ||
node_modules/ | ||
/test-results/ | ||
/playwright-report/ | ||
/blob-report/ | ||
/playwright/.cache/ |
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,34 @@ | ||
# Twenty e2e Testing | ||
|
||
### Run end-to-end tests | ||
|
||
``` | ||
yarn playwright test | ||
``` | ||
|
||
### Start the interactive UI mode | ||
|
||
``` | ||
yarn playwright test --ui | ||
``` | ||
|
||
### Run test only on Desktop Chrome | ||
|
||
``` | ||
yarn playwright test --project=chromium | ||
``` | ||
|
||
### Run test in specific file | ||
``` | ||
yarn playwright test example | ||
``` | ||
|
||
### Runs the tests in debug mode. | ||
``` | ||
yarn playwright test --debug | ||
``` | ||
|
||
### Auto generate tests with Codegen | ||
``` | ||
yarn playwright codegen | ||
``` |
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,14 @@ | ||
import { expect, test } from '@playwright/test'; | ||
|
||
test.describe('visible table', () => { | ||
test('table should be visible on navigation to /objects/companies', async ({ | ||
page, | ||
}) => { | ||
// Navigate to the page | ||
await page.goto('/objects/companies'); | ||
|
||
// Check if the table is visible | ||
const table = page.locator('table'); | ||
await expect(table).toBeVisible(); | ||
}); | ||
}); |
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,14 @@ | ||
{ | ||
"name": "twenty-e2e-testing", | ||
"devDependencies": { | ||
"@playwright/test": "^1.45.3" | ||
}, | ||
"scripts": { | ||
"test:e2e:setup": "yarn playwright install", | ||
"test:e2e": "yarn playwright test", | ||
"test:e2e:ui": "yarn playwright test --ui", | ||
"test:e2e:chrome": "yarn playwright test --project=chromium", | ||
"test:e2e:debug": "yarn playwright test --debug", | ||
"test:e2e:report": "yarn playwright show-report" | ||
} | ||
} |
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,58 @@ | ||
import { defineConfig, devices } from '@playwright/test'; | ||
|
||
import { config } from 'dotenv'; | ||
config(); | ||
|
||
/** | ||
* See https://playwright.dev/docs/test-configuration. | ||
* See https://playwright.dev/docs/trace-viewer to Collect trace when retrying the failed test | ||
*/ | ||
export default defineConfig({ | ||
testDir: 'e2e', | ||
/* Run tests in files in parallel */ | ||
fullyParallel: true, | ||
reporter: 'html', | ||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ | ||
use: { | ||
/* Base URL to use in actions like `await page.goto('/')`. */ | ||
baseURL: process.env.FRONTEND_BASE_URL ?? 'http://localhost:3001', | ||
}, | ||
|
||
/* Configure projects for major browsers */ | ||
projects: [ | ||
{ | ||
name: 'chromium', | ||
use: { ...devices['Desktop Chrome'] }, | ||
}, | ||
|
||
{ | ||
name: 'firefox', | ||
use: { ...devices['Desktop Firefox'] }, | ||
}, | ||
|
||
{ | ||
name: 'webkit', | ||
use: { ...devices['Desktop Safari'] }, | ||
}, | ||
|
||
/* Test against mobile viewports. */ | ||
// { | ||
// name: 'Mobile Chrome', | ||
// use: { ...devices['Pixel 5'] }, | ||
// }, | ||
// { | ||
// name: 'Mobile Safari', | ||
// use: { ...devices['iPhone 12'] }, | ||
// }, | ||
|
||
/* Test against branded browsers. */ | ||
// { | ||
// name: 'Microsoft Edge', | ||
// use: { ...devices['Desktop Edge'], channel: 'msedge' }, | ||
// }, | ||
// { | ||
// name: 'Google Chrome', | ||
// use: { ...devices['Desktop Chrome'], channel: 'chrome' }, | ||
// }, | ||
], | ||
}); |
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Add a newline at the end of the file to follow best practices for text files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks doing lesss goo