Skip to content
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

test(ui): add cypress tests to github actions #2285

Closed
wants to merge 73 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
be35e1f
test: first commit to add cypress tests to github actions
TheoPascoli Jan 8, 2025
b8ca923
test: first commit to add cypress tests to github actions
TheoPascoli Jan 8, 2025
5a3d727
test: first commit to add cypress tests to github actions
TheoPascoli Jan 8, 2025
619f532
test: first commit to add cypress tests to github actions
TheoPascoli Jan 8, 2025
7173b74
test: first commit to add cypress tests to github actions
TheoPascoli Jan 9, 2025
4ad2c94
test: first commit to add cypress tests to github actions
TheoPascoli Jan 8, 2025
3066c2d
test: first commit to add cypress tests to github actions
TheoPascoli Jan 8, 2025
0d01a7e
test: first commit to add cypress tests to github actions
TheoPascoli Jan 8, 2025
22327e6
test: first commit to add cypress tests to github actions
TheoPascoli Jan 8, 2025
7438c87
test: first commit to add cypress tests to github actions
TheoPascoli Jan 9, 2025
a711dbb
Merge branch 'test/setup-cypress' of https://github.com/AntaresSimula…
TheoPascoli Jan 9, 2025
b0bfeee
test: first commit to add cypress tests to github actions
TheoPascoli Jan 9, 2025
5e02359
test: first commit to add cypress tests to github actions
TheoPascoli Jan 8, 2025
e015945
test: first commit to add cypress tests to github actions
TheoPascoli Jan 8, 2025
ee07ed4
test: first commit to add cypress tests to github actions
TheoPascoli Jan 8, 2025
06503d7
test: first commit to add cypress tests to github actions
TheoPascoli Jan 8, 2025
a9fa20a
test: first commit to add cypress tests to github actions
TheoPascoli Jan 9, 2025
ace09c0
test: first commit to add cypress tests to github actions
TheoPascoli Jan 8, 2025
30dfa81
test: first commit to add cypress tests to github actions
TheoPascoli Jan 8, 2025
ad93e6f
test: first commit to add cypress tests to github actions
TheoPascoli Jan 8, 2025
6af45b8
test: first commit to add cypress tests to github actions
TheoPascoli Jan 8, 2025
600f7a1
test: first commit to add cypress tests to github actions
TheoPascoli Jan 9, 2025
748ab69
test: first commit to add cypress tests to github actions
TheoPascoli Jan 9, 2025
d4badfb
test: first commit to add cypress tests to github actions
TheoPascoli Jan 13, 2025
d29f907
Merge branch 'test/setup-cypress' of https://github.com/AntaresSimula…
TheoPascoli Jan 13, 2025
8e8eeba
test: first commit to add cypress tests to github actions
TheoPascoli Jan 13, 2025
e2ec24a
test: first commit to add cypress tests to github actions
TheoPascoli Jan 13, 2025
934fca8
Merge remote-tracking branch 'origin/test/setup-cypress' into test/se…
TheoPascoli Jan 13, 2025
763320e
Merge branch 'dev' into test/setup-cypress
TheoPascoli Jan 14, 2025
1688e66
Merge branch 'dev' into test/setup-cypress
TheoPascoli Jan 14, 2025
57a8606
test: first commit to add cypress tests to github actions
TheoPascoli Jan 15, 2025
9876c9d
Merge branch 'dev' into test/setup-cypress
TheoPascoli Jan 15, 2025
f382a0e
Merge branch 'dev' into test/setup-cypress
TheoPascoli Jan 16, 2025
444a568
Merge branch 'dev' into test/setup-cypress
TheoPascoli Jan 20, 2025
17e184b
Merge branch 'dev' into test/setup-cypress
TheoPascoli Jan 21, 2025
e724f86
Merge branch 'dev' into test/setup-cypress
TheoPascoli Jan 22, 2025
3cfb912
feat: move cypress inside webapp folder
TheoPascoli Jan 23, 2025
14f5cd0
Merge remote-tracking branch 'origin/dev' into test/setup-cypress
TheoPascoli Jan 23, 2025
dbc94f5
feat: move cypress inside webapp folder
TheoPascoli Jan 23, 2025
1595193
feat: move cypress inside webapp folder
TheoPascoli Jan 23, 2025
77ac271
feat: move cypress inside webapp folder
TheoPascoli Jan 23, 2025
9e0427f
feat: lint fix
TheoPascoli Jan 23, 2025
fa4bdf2
feat: lint fix
TheoPascoli Jan 23, 2025
c020055
feat: lint fix
TheoPascoli Jan 23, 2025
59c564c
feat: lint fix
TheoPascoli Jan 23, 2025
a571a12
feat: lint fix
TheoPascoli Jan 23, 2025
a5a1c60
feat: lint fix
TheoPascoli Jan 23, 2025
157e008
feat: lint fix
TheoPascoli Jan 23, 2025
512e04c
feat: lint fix
TheoPascoli Jan 23, 2025
00839b0
feat: lint fix
TheoPascoli Jan 23, 2025
377bae5
feat: lint fix
TheoPascoli Jan 23, 2025
7d75010
feat: lint fix
TheoPascoli Jan 23, 2025
145241c
feat: lint fix
TheoPascoli Jan 23, 2025
69694e8
feat: lint fix
TheoPascoli Jan 23, 2025
31ffaf4
feat: lint fix
TheoPascoli Jan 23, 2025
fe7fb33
Merge branch 'dev' into test/setup-cypress
TheoPascoli Jan 24, 2025
9c91a2a
feat: lint fix
TheoPascoli Jan 24, 2025
7994dd0
feat: lint fix
TheoPascoli Jan 24, 2025
3e54dfe
feat: lint fix
TheoPascoli Jan 24, 2025
12de919
feat: lint fix
TheoPascoli Jan 24, 2025
f1e1e8f
feat: lint fix
TheoPascoli Jan 24, 2025
61891d3
feat: lint fix
TheoPascoli Jan 24, 2025
46183dd
feat: lint fix
TheoPascoli Jan 24, 2025
07c2bb9
feat: lint fix
TheoPascoli Jan 24, 2025
db7a9f2
feat: lint fix
TheoPascoli Jan 24, 2025
10712d7
feat: lint fix
TheoPascoli Jan 24, 2025
63036b8
feat: lint fix
TheoPascoli Jan 24, 2025
46ffe93
feat: lint fix
TheoPascoli Jan 24, 2025
b501079
feat: lint fix
TheoPascoli Jan 24, 2025
5ff77f1
feat: lint fix
TheoPascoli Jan 24, 2025
fb66707
feat: lint fix
TheoPascoli Jan 24, 2025
7a60117
feat: lint fix
TheoPascoli Jan 24, 2025
e196794
feat: lint fix
TheoPascoli Jan 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,23 @@ jobs:
uses: sonarsource/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

cypress-run:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22.13.0
- name: Verify Node.js version
run: node --version
- name: Install Node.js dependencies
run: npm install
working-directory: webapp
- name: Cypress run
uses: cypress-io/github-action@v6
with:
working-directory: webapp
23 changes: 23 additions & 0 deletions webapp/cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* Copyright (c) 2025, RTE (https://www.rte-france.com)
*
* See AUTHORS.txt
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* SPDX-License-Identifier: MPL-2.0
*
* This file is part of the Antares project.
*/

import { defineConfig } from "cypress";

export default defineConfig({
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
},
},
});
21 changes: 21 additions & 0 deletions webapp/cypress/e2e/spec.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Copyright (c) 2025, RTE (https://www.rte-france.com)
*
* See AUTHORS.txt
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* SPDX-License-Identifier: MPL-2.0
*
* This file is part of the Antares project.
*/

import { describe, it } from "mocha";

describe("template spec", () => {
it("passes", () => {
cy.visit("https://example.cypress.io");
});
});
5 changes: 5 additions & 0 deletions webapp/cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "[email protected]",
"body": "Fixtures are a great way to mock data for responses to routes"
}
15 changes: 15 additions & 0 deletions webapp/cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
Copy link
Member

@skamril skamril Jan 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use .ts for all test files instead to support TypeScript

* Copyright (c) 2025, RTE (https://www.rte-france.com)
*
* See AUTHORS.txt
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* SPDX-License-Identifier: MPL-2.0
*
* This file is part of the Antares project.
*/

console.log("setup commands here");

Check warning on line 15 in webapp/cypress/support/commands.js

View workflow job for this annotation

GitHub Actions / npm-lint

Unexpected console statement
31 changes: 31 additions & 0 deletions webapp/cypress/support/e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* Copyright (c) 2025, RTE (https://www.rte-france.com)
*
* See AUTHORS.txt
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* SPDX-License-Identifier: MPL-2.0
*
* This file is part of the Antares project.
*/

// ***********************************************************
// This example support/e2e.ts is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import "./commands";
8 changes: 8 additions & 0 deletions webapp/cypress/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["es5", "dom"],
"types": ["cypress", "node"]
},
"include": ["**/*.ts"]
}
3 changes: 3 additions & 0 deletions webapp/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import jsdocPlugin from "eslint-plugin-jsdoc";
import prettierPluginRecommended from "eslint-plugin-prettier/recommended";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only add this line:

cypressPlugin.configs.recommended,

before

prettierPluginRecommended, // Must be the last one

It includes all.

import licenseHeaderPlugin from "eslint-plugin-license-header";
import reactRefreshPlugin from "eslint-plugin-react-refresh";
import cypressPlugin from "eslint-plugin-cypress";

export default [
// Must be defined here to be applied to all configurations.
Expand Down Expand Up @@ -49,12 +50,14 @@ export default [
globals: {
...globals.browser,
...globals.es2022,
cy: true,
},
},
plugins: {
"license-header": licenseHeaderPlugin,
"react-hooks": reactHookPlugin,
"react-refresh": reactRefreshPlugin,
cypress: cypressPlugin,
},
rules: {
...reactHookPlugin.configs.recommended.rules,
Expand Down
Loading
Loading