-
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.
test: ✅ Add package playwright for test e2e
- Loading branch information
1 parent
ae91371
commit cc453e9
Showing
7 changed files
with
187 additions
and
70 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,64 @@ | ||
name: Playwright Tests | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 60 | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "lts/*" | ||
|
||
- name: Install pnpm | ||
run: npm install -g pnpm | ||
|
||
- name: Install dependencies | ||
run: pnpm install | ||
working-directory: client | ||
|
||
- name: Install dependencies | ||
run: pnpm install | ||
working-directory: server | ||
|
||
- name: Start server for E2E tests | ||
run: | | ||
cd server | ||
pnpm run start:dev & | ||
sleep 10 # Attendre que le serveur démarre | ||
- name: Start client for E2E tests | ||
run: | | ||
cd client | ||
pnpm run dev & | ||
sleep 10 # Attendre que le client démarre | ||
- name: Verify Playwright Installation | ||
run: pnpm exec playwright --version | ||
working-directory: client | ||
|
||
- name: Install Playwright Browsers | ||
run: pnpm exec playwright install --with-deps | ||
working-directory: client | ||
|
||
- name: Run Playwright tests | ||
run: pnpm exec playwright test | ||
working-directory: client | ||
|
||
- name: Upload Playwright Report | ||
uses: actions/upload-artifact@v4 | ||
if: ${{ always() }} | ||
with: | ||
name: playwright-report | ||
path: client/playwright-report/ | ||
retention-days: 30 |
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 @@ | ||
clientnode_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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,22 @@ | ||
// tests/homePage.spec.js | ||
import { test, expect } from "@playwright/test"; | ||
|
||
test.describe("Home Page", () => { | ||
test.beforeEach(async ({ page }) => { | ||
await page.goto("http://localhost:5173"); // URL de votre application | ||
}); | ||
|
||
test("should display the header elements", async ({ page }) => { | ||
const headerLogo = page.locator('[data-testid="header-logo"]'); | ||
await expect(headerLogo).toBeVisible(); | ||
await expect(headerLogo).toContainText("Ministère"); | ||
|
||
const serviceTitle = page.locator(".fr-header__service-title"); | ||
await expect(serviceTitle).toBeVisible(); | ||
await expect(serviceTitle).toContainText("Référentiel des Applications"); | ||
|
||
const serviceTagline = page.locator(".fr-header__service-tagline"); | ||
await expect(serviceTagline).toBeVisible(); | ||
await expect(serviceTagline).toContainText("Une application pour les réunir toutes"); | ||
}); | ||
}); |