-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(e2e): twenty-e2e-testing with playwright (#6539)
## ISSUE (e2e) - Introduces e2e for twenty - Closes #6360 ## Description - [x] Create Package. - [x] Setup environments such as baseUrl. - [x] ignore CI configuration for now. - [x] write a simple test to check if table is visible in companies tab. ### Running test with UI ``` yarn run test:e2e:ui ``` https://github.com/user-attachments/assets/a7b7ae35-8898-461e-8c7c-d3e4e9515aeb ### Running all test and seeing report ``` yarn run test:e2e yarn run test:e2e:report ``` https://github.com/user-attachments/assets/2558a1f9-97cc-4f06-86f0-806f207eac5a --------- Co-authored-by: Lucas Bordeau <[email protected]>
- Loading branch information
1 parent
59e14fa
commit 197bca5
Showing
8 changed files
with
138 additions
and
3 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
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,37 @@ | ||
# Twenty e2e Testing | ||
|
||
## Install | ||
|
||
Don't forget to install the browsers before launching the tests : | ||
|
||
``` | ||
yarn playwright install | ||
``` | ||
|
||
### Run end-to-end tests | ||
|
||
``` | ||
yarn run test:e2e | ||
``` | ||
|
||
### Start the interactive UI mode | ||
|
||
``` | ||
yarn run test:e2e:ui | ||
``` | ||
|
||
### Run test only on Desktop Chrome | ||
|
||
``` | ||
yarn run test:e2e:chrome | ||
``` | ||
|
||
### Run test in specific file | ||
``` | ||
yarn run test:e2e <filename> | ||
``` | ||
|
||
### Runs the tests in debug mode. | ||
``` | ||
yarn run test:e2e:debug | ||
``` |
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.46.0" | ||
}, | ||
"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,43 @@ | ||
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'] }, | ||
}, | ||
|
||
{ | ||
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