Skip to content

Commit fecd3db

Browse files
authored
feat: playwright, vitest (#2)
* feat: playwright * tests * fix * docker * ci * fix: vitest * lint * lint * vitest * chore * chore
1 parent d108fad commit fecd3db

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1104
-1717
lines changed

.github/workflows/build.yml

-26
This file was deleted.

.github/workflows/codeql-analysis.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@
99
# the `language` matrix defined below to confirm you have the correct set of
1010
# supported CodeQL languages.
1111
#
12-
name: "CodeQL"
12+
name: 🔎 CodeQL
1313

1414
on:
1515
push:
1616
branches: ["main"]
1717
pull_request:
18-
# The branches below must be a subset of the branches above
1918
branches: ["main"]
2019
schedule:
2120
- cron: "16 1 * * 5"

.github/workflows/deploy.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
name: Deploy demo
1+
name: 🌍 Deploy demo
22

33
on:
44
push:
5-
branches: [main, next]
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
68

79
concurrency:
810
cancel-in-progress: true

.github/workflows/e2e.yml

-22
This file was deleted.

.github/workflows/lint.yml

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
name: Lint
1+
name: ⛑️ Lint
22

3-
on: [pull_request, push]
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
48

59
concurrency:
610
cancel-in-progress: true
@@ -32,6 +36,7 @@ jobs:
3236
- name: Checkout repository
3337
uses: actions/checkout@v4
3438
- name: Lint Dockerfile
35-
uses: hadolint/hadolint-action@v2.1.0
39+
uses: hadolint/hadolint-action@v3.1.0
3640
with:
37-
recursive: true
41+
dockerfile: Dockerfile
42+
verbose: true

.github/workflows/playwright.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: 🤖 Playwright Tests
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
8+
9+
jobs:
10+
test:
11+
timeout-minutes: 20
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-node@v4
16+
with:
17+
node-version: 18
18+
- name: Install dependencies
19+
run: npm install -g yarn && yarn
20+
- name: Install Playwright Browsers
21+
run: yarn playwright install --with-deps
22+
- name: Build app
23+
run: yarn build
24+
env:
25+
NEXT_PUBLIC_BASE_PATH: ""
26+
NODE_ENV: production
27+
- name: Run Playwright tests
28+
run: yarn playwright test
29+
- uses: actions/upload-artifact@v4
30+
if: always()
31+
with:
32+
name: playwright-report
33+
path: playwright-report/
34+
retention-days: 30

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Release
1+
name: 📦 Release
22

33
on:
44
workflow_dispatch:

.github/workflows/testing.yml

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
name: Testing
1+
name: 💪 Testing
22

3-
on: [pull_request, push]
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
48

59
concurrency:
610
cancel-in-progress: true
@@ -16,11 +20,14 @@ jobs:
1620
- name: Setup Node.js
1721
uses: actions/setup-node@v4
1822
with:
19-
node-version: "20"
23+
node-version: "18"
2024
cache: "yarn"
2125
- name: Install dependencies
2226
run: |
2327
yarn --immutable
28+
- name: Build code
29+
run: |
30+
yarn build
2431
- name: Test code
2532
run: |
2633
yarn test

.gitignore

+5-1
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,8 @@ robots.txt
5656
!.yarn/versions
5757

5858
# storybook
59-
/.out
59+
/.out
60+
/test-results/
61+
/playwright-report/
62+
/blob-report/
63+
/playwright/.cache/

.node-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20
1+
18

.talismanrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fileignoreconfig:
2020
- filename: .yarn/**
2121
checksum: any
2222
- filename: Dockerfile
23-
checksum: 9605a14ae835a4263de3badf041bfbde2823f2d9f2342e09c369ec9c7ae8615f
23+
checksum: 31aa8689fb079f89949f8c4e5a917b040176f8a5b8492ba0a5252ad5e1bba049
2424
- filename: README.md
2525
checksum: 7c55475ff28dbfa46c9c5715918add6a0202eafddca3cf9d35ebcdd443d76ffd
2626
- filename: pages/mui.tsx

Dockerfile

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
ARG NODE_VERSION=20-alpine3.18@sha256:5ff63217ec2757b29a4414e0f787bfc13c1f9cb6f053e46ff05c1a51bbd2e8e6
1+
ARG NODE_VERSION=20-alpine3.19@sha256:ef3f47741e161900ddd07addcaca7e76534a9205e4cd73b2ed091ba339004a75
22

33
# Install dependencies only when needed
44
FROM node:$NODE_VERSION AS builder
5-
RUN apk add --no-cache libc6-compat=1.2.4-r2
5+
# hadolint ignore=DL3018
6+
RUN apk add --no-cache libc6-compat
67
WORKDIR /app
78

89
COPY yarn.lock package.json ./
@@ -17,14 +18,16 @@ ARG NEXT_PUBLIC_SITE_URL
1718
ENV NEXT_PUBLIC_SITE_URL $NEXT_PUBLIC_SITE_URL
1819

1920
ENV NODE_ENV production
21+
ENV NEXT_PUBLIC_BASE_PATH ""
22+
2023
WORKDIR /app
2124

2225
RUN yarn postinstall # if you have postinstall script in your package.json
2326
RUN if [ -z "$PRODUCTION" ]; then \
2427
echo "Overriding .env for staging"; \
2528
cp .env.staging .env.production; \
2629
fi && \
27-
yarn build:export
30+
yarn build
2831

2932
# Production image, copy all the files and run nginx
3033
FROM ghcr.io/socialgouv/docker/nginx:sha-1d70757 AS runner

README.md

+19
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,21 @@ yarn # to install dependencies
2020
yarn dev # to run in dev mode
2121
```
2222

23+
Point your browser to [http://127.0.0.1:3000/template](http://127.0.0.1:3000/template) and start playing.
24+
25+
### Tests
26+
27+
```
28+
# run unit tests with vitest
29+
yarn test
30+
31+
# build, serve and launch playwright interactive end-to-end tests
32+
yarn e2e --ui
33+
34+
# run storybook
35+
yarn storybook
36+
```
37+
2338
### Gestion des environnements
2439

2540
Les variables issues des docker build-args, sont à utiliser dans `next.config.js`, pour les autres, il faut les définir dans les différents [`.env.*`](https://nextjs.org/docs/basic-features/environment-variables#environment-variable-load-order).
@@ -41,3 +56,7 @@ Le fichier `.env.development` est utilisé pour l'environnement de développemen
4156
| [codegouvfr/docsify-dsfr-template](https://github.com/codegouvfr/docsify-dsfr-template) | Template DSFR pour [docsify](https://docsify.js.org/#/) |
4257
| [sneko/dsfr-connect](https://github.com/sneko/dsfr-connect) | Themes DSFR pour bootstrap, vuetify, mui, infima, emails... |
4358
| [socialgouv/template](https://github.com/socialgouv/template) | Version initiale de ce template |
59+
60+
```
61+
62+
```

cypress.json

-5
This file was deleted.

cypress/fixtures/example.json

-5
This file was deleted.

cypress/integration/accessibilite.spec.ts

-7
This file was deleted.

cypress/integration/cgu.spec.ts

-7
This file was deleted.

cypress/integration/healthz.spec.ts

-6
This file was deleted.

cypress/integration/home.spec.ts

-7
This file was deleted.

cypress/integration/mentions-legales.spec.ts

-7
This file was deleted.

cypress/integration/politique-confidentialite.spec.ts

-11
This file was deleted.

cypress/integration/stats.spec.ts

-6
This file was deleted.

cypress/plugins/index.ts

-22
This file was deleted.

cypress/support/commands.ts

-25
This file was deleted.

cypress/support/index.ts

-20
This file was deleted.

0 commit comments

Comments
 (0)