Skip to content

Commit 1b4eea5

Browse files
committed
fix: update cypress.yml github action
1 parent e6980e5 commit 1b4eea5

File tree

8 files changed

+28
-50
lines changed

8 files changed

+28
-50
lines changed

.github/workflows/cypress.yml

+21-43
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,54 @@
1-
name: Cypress
1+
name: Cypress UI tests
22

33
on:
4-
merge_group:
54
push:
6-
branches-ignore:
7-
- 'release-please-**'
85

96
jobs:
107
cypress-run:
11-
concurrency:
12-
group: cypress-${{ github.head_ref || github.ref }}
8+
concurrency: cypress-${{ github.head_ref || github.ref }}
139
runs-on: ubuntu-latest
1410
steps:
15-
- name: checkout
16-
uses: actions/checkout@v3
17-
18-
- name: set up node
19-
uses: actions/setup-node@v3
20-
with:
21-
node-version: '18'
11+
- name: Checkout
12+
uses: actions/checkout@v4
2213

2314
- name: Yarn Install and Cache
2415
uses: graasp/graasp-deploy/.github/actions/yarn-install-and-cache@v1
2516
with:
2617
cypress: true
2718

28-
- name: cypress run
29-
uses: cypress-io/github-action@v4
19+
- name: Build App
20+
run: yarn build:test
21+
shell: bash
3022
env:
3123
VITE_PORT: 3000
32-
VITE_GRAASP_API_HOST: http://localhost:3636
24+
VITE_API_HOST: http://localhost:3636
3325
VITE_GRAASP_APP_KEY: id-1234567890
3426
VITE_ENABLE_MOCK_API: true
27+
VITE_VERSION: cypress-tests
28+
29+
- name: Cypress Run
30+
uses: cypress-io/github-action@v5
31+
env:
32+
VITE_PORT: 3000
33+
VITE_API_HOST: http://localhost:3636
34+
VITE_GRAASP_APP_KEY: id-1234567890
35+
VITE_ENABLE_MOCK_API: true
36+
VITE_VERSION: cypress-tests
3537
with:
36-
wait-on: http://localhost:3000
37-
wait-on-timeout: 180
3838
install: false
39-
build: yarn build
4039
config: baseUrl=http://localhost:3000
41-
start: yarn dev
40+
start: yarn preview:test
4241
browser: chrome
4342
quiet: true
4443
# point to new cypress@10 config file
4544
config-file: cypress.config.ts
4645

47-
# component tests are not running ok in the CI
48-
# - name: Run Component tests 🧪
49-
# uses: cypress-io/github-action@v4
50-
# with:
51-
# # we have already installed everything
52-
# install: false
53-
# # to run component tests we need to use "component: true"
54-
# component: true
55-
56-
# after the test run completes
57-
# store videos and any screenshots
58-
# NOTE: screenshots will be generated only if E2E test failed
59-
# thus we store screenshots only on failures
60-
# Alternative: create and commit an empty cypress/screenshots folder
61-
# to always have something to upload
62-
- uses: actions/upload-artifact@v3
46+
- uses: actions/upload-artifact@v4
6347
if: failure()
6448
with:
6549
name: cypress-screenshots
6650
path: cypress/screenshots
6751

68-
- uses: actions/upload-artifact@v3
69-
if: failure()
70-
with:
71-
name: cypress-videos
72-
path: cypress/videos
73-
7452
- name: coverage report
7553
run: npx nyc report --reporter=text-summary
7654

@@ -88,4 +66,4 @@ jobs:
8866
GITHUB_TOKEN: ${{ github.token }}
8967
REPO_PATH: ${{ github.repository }}
9068
COMMIT_SHA: ${{ github.sha }}
91-
RUN_ID: ${{ github.run_id }}
69+
RUN_ID: ${{ github.run_id }}

.github/workflows/deploy-dev.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- name: Yarn build
2626
# Set environment variables required to perform the build. These are only available to this step
2727
env:
28-
VITE_GRAASP_API_HOST: ${{ secrets.REACT_APP_API_HOST_DEV }}
28+
VITE_API_HOST: ${{ secrets.REACT_APP_API_HOST_DEV }}
2929
VITE_GRAASP_APP_KEY: ${{ secrets.APP_KEY }}
3030
VITE_SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
3131
run: yarn build

.github/workflows/deploy-prod.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Yarn build
2525
# Set environment variables required to perform the build. These are only available to this step
2626
env:
27-
VITE_GRAASP_API_HOST: ${{ secrets.REACT_APP_API_HOST_PROD }}
27+
VITE_API_HOST: ${{ secrets.REACT_APP_API_HOST_PROD }}
2828
VITE_GRAASP_APP_KEY: ${{ secrets.APP_KEY }}
2929
VITE_SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
3030
run: yarn build

.github/workflows/deploy-stage.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Yarn build
2525
# Set environment variables required to perform the build. These are only available to this step
2626
env:
27-
VITE_GRAASP_API_HOST: ${{ secrets.REACT_APP_API_HOST_STAGE }}
27+
VITE_API_HOST: ${{ secrets.REACT_APP_API_HOST_STAGE }}
2828
VITE_GRAASP_APP_KEY: ${{ secrets.APP_KEY }}
2929
VITE_SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
3030
run: yarn build

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
VITE_GRAASP_APP_KEY=<app KEY>
88
VITE_ENABLE_MOCK_API=true
99
VITE_GRAASP_DOMAIN=localhost
10-
VITE_GRAASP_API_HOST=<request address for the backend>
10+
VITE_API_HOST=<request address for the backend>
1111
```
1212

1313
![GitHub package.json version](https://img.shields.io/github/package-json/v/graasp/graasp-app-text-analysis?color=green&style=flat-square)

cypress/support/commands.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Cypress.Commands.add(
5050
win.appContext = {
5151
memberId: currentMember.id,
5252
itemId: MOCK_SERVER_ITEM.id,
53-
apiHost: Cypress.env('VITE_GRAASP_API_HOST') || MOCK_SERVER_API_HOST,
53+
apiHost: Cypress.env('VITE_API_HOST') || MOCK_SERVER_API_HOST,
5454
context: 'standalone',
5555
permission: PermissionLevel.Read,
5656
...appContext,

docs/Setup_Intructions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ jobs:
359359
- name: cypress run
360360
uses: cypress-io/github-action@v2
361361
env:
362-
VITE_GRAASP_API_HOST: http://localhost:3636
362+
VITE_API_HOST: http://localhost:3636
363363
VITE_GRAASP_DOMAIN: localhost
364364
VITE_GRAASP_APP_KEY: id-1234567890
365365
VITE_ENABLE_MOCK_API: true

src/config/env.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ export const GOOGLE_ANALYTICS_ID = import.meta.env.VITE_GOOGLE_ANALYTICS_ID;
44
export const ENABLE_MOCK_API =
55
import.meta.env.VITE_ENABLE_MOCK_API === 'true' || false;
66
export const GRAASP_API_HOST =
7-
import.meta.env.VITE_GRAASP_API_HOST || 'http://localhost:3000';
7+
import.meta.env.VITE_API_HOST || 'http://localhost:3000';

0 commit comments

Comments
 (0)