Skip to content

Commit 054a8c8

Browse files
Merge pull request #4724 from linuxfoundation/unicron-cypress-readme
Updates to cypress tests
2 parents 595050b + 3c29882 commit 054a8c8

File tree

9 files changed

+1898
-318
lines changed

9 files changed

+1898
-318
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,3 +246,11 @@ cla-backend/run-python-test-example-*.py
246246
out
247247
*.secret
248248
*log*.json
249+
250+
# Cypress test outputs
251+
**/cypress/screenshots/
252+
**/cypress/videos/
253+
**/cypress/reports/
254+
255+
# Local env vars
256+
.env

tests/functional/README.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# Cypress Framework
2+
3+
This repository contains a Cypress framework setup for automated testing. The framework is structured as follows:
4+
5+
## Project Folder Structure
6+
7+
Project Folder<br>
8+
├── node_modules <br>
9+
└── cypress<br>
10+
&nbsp; &nbsp; &nbsp; &nbsp;├── appConfig<br>
11+
&nbsp; &nbsp; &nbsp; &nbsp;├── downloads<br>
12+
&nbsp; &nbsp; &nbsp; &nbsp;├── e2e<br>
13+
&nbsp; &nbsp; &nbsp; &nbsp;├── fixtures<br>
14+
&nbsp; &nbsp; &nbsp; &nbsp;├── reports<br>
15+
&nbsp; &nbsp; &nbsp; &nbsp;├── screenshot<br>
16+
&nbsp; &nbsp; &nbsp; &nbsp;├── support<br>
17+
&nbsp; &nbsp; &nbsp; &nbsp;├── video<br>
18+
19+
├─ cypress.config.ts<br>
20+
│ .eslintrc.json<br>
21+
│ readme.md<br>
22+
│ .gitignore<br>
23+
│ package-lock.json<br>
24+
│ package.json<br>
25+
│ tsconfig.json<br>
26+
├─ .github<br>
27+
&nbsp; &nbsp; &nbsp; &nbsp;└── workflows<br>
28+
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; └── main.yml<br>
29+
30+
## Description
31+
32+
- `.gitignore`: Specifies intentionally untracked files to ignore in Git.
33+
- `package-lock.json` and `package.json`: Node.js package files specifying project dependencies.
34+
- `cypress.config.ts`: Configuration file for Playwright settings.
35+
- `tsconfig.json`: TypeScript compiler options file.
36+
37+
### `.GitHub`
38+
39+
- `.GitHub/workflows/main.yml`: GitLub Actions workflow file for continuous integration.
40+
41+
### `node_modules`
42+
43+
- Directory containing Node.js modules installed by npm.
44+
45+
### `Cypress-report`
46+
47+
- Directory for storing Cypress test reports.
48+
49+
### `src`
50+
51+
- Source code directory containing project files.
52+
53+
#### `api`
54+
55+
- Directory for API-related scripts.
56+
57+
#### `config`
58+
59+
- Directory containing environment configuration files and authentication data.
60+
61+
#### `fixtures`
62+
63+
- Directory for test fixtures, such as reusable functions for mock.
64+
65+
### `test-results`
66+
67+
- Directory for storing test execution results, including screenshots, trace files, and videos.
68+
69+
## Usage
70+
71+
Make sure that you have `node` and `npm` installed.
72+
73+
Clone the repository and install dependencies using `npm install`.
74+
75+
Create `.env` file under `tests/functional` (it is git-ignored), with contents like this:
76+
77+
```
78+
APP_URL=https://api-gw.dev.platform.linuxfoundation.org/
79+
AUTH0_TOKEN_API=https://linuxfoundation-dev.auth0.com/oauth/token
80+
AUTH0_USER_NAME=[your-username]
81+
AUTH0_PASSWORD=[your-password]
82+
LFX_API_TOKEN=[token]
83+
AUTH0_CLIENT_SECRET=[client-secret]
84+
AUTH0_CLIENT_ID=[client-id]
85+
CYPRESS_ENV=dev
86+
```
87+
88+
You can ask for example `.env` file over slack.
89+
90+
- Run `npx cypress install`
91+
- Run tests using cmd `npx cypress run`.
92+
- Run tests using UI `npx cypress open`. Choose **E2E testing**, select **Chrome** browser.
93+
- View test reports in the `cypress-report` directory.
94+
- Explore source code files for detailed implementation.
95+
96+
## Contributing
97+
98+
Contributions are welcome! Please follow the established coding style and guidelines. If you find any issues or have suggestions for improvements, feel free to open an issue or submit a pull request.
99+
100+
## License
101+
102+
This project is licensed under the [](LICENSE).

tests/functional/cypress.config.ts

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
1-
import { defineConfig } from 'cypress'
1+
import { defineConfig } from 'cypress';
2+
import * as dotenv from 'dotenv';
3+
dotenv.config();
24

35
export default defineConfig({
4-
defaultCommandTimeout: 20000,
5-
requestTimeout: 200000,
6-
"reporter": "cypress-mochawesome-reporter",
6+
defaultCommandTimeout: 30000,
7+
requestTimeout: 300000,
8+
reporter: 'cypress-mochawesome-reporter',
79
e2e: {
810
// baseUrl: 'http://localhost:1234',
911
specPattern: 'cypress/e2e/**/**/*.{js,jsx,ts,tsx}',
10-
} ,
11-
"env": {
12-
"file": "cypress.env.json"
12+
},
13+
env: {
14+
APP_URL: process.env.APP_URL,
15+
AUTH0_TOKEN_API: process.env.AUTH0_TOKEN_API,
16+
AUTH0_USER_NAME: process.env.AUTH0_USER_NAME,
17+
AUTH0_PASSWORD: process.env.AUTH0_PASSWORD,
18+
LFX_API_TOKEN: process.env.LFX_API_TOKEN,
19+
AUTH0_CLIENT_SECRET: process.env.AUTH0_CLIENT_SECRET,
20+
AUTH0_CLIENT_ID: process.env.AUTH0_CLIENT_ID,
21+
CYPRESS_ENV: process.env.CYPRESS_ENV,
1322
}
14-
})
23+
});
24+

tests/functional/cypress.env.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)