Skip to content

Commit b2e730b

Browse files
committed
Upgrade cypress to v15.10.0
And make the adjustments to replace `Cypress.env` by `cy.env`.
1 parent 49ffc3a commit b2e730b

22 files changed

Lines changed: 492 additions & 442 deletions

.github/workflows/ci.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 'Cypress Tests Workflow'
1+
name: "Cypress Tests Workflow"
22

33
on:
44
push:
@@ -14,14 +14,14 @@ jobs:
1414
static-analysis:
1515
runs-on: ubuntu-22.04
1616
steps:
17-
- name: Checkout
18-
uses: actions/checkout@v4
17+
- name: Checkout
18+
uses: actions/checkout@v4
1919

20-
- name: Install dependencies
21-
run: npm install
20+
- name: Install dependencies
21+
run: npm install
2222

23-
- name: Run Standard JS
24-
run: npm run lint
23+
- name: Run Standard JS
24+
run: npm run lint
2525

2626
api-cypress-tests:
2727
needs: static-analysis
@@ -38,8 +38,8 @@ jobs:
3838
- name: Cypress run
3939
uses: cypress-io/github-action@v6
4040
env:
41-
CYPRESS_user_name: ${{ secrets.CYPRESS_user_name }}
42-
CYPRESS_user_password: ${{ secrets.CYPRESS_user_password }}
41+
CYPRESS_USERNAME: ${{ secrets.CYPRESS_USERNAME }}
42+
CYPRESS_USERPASSWORD: ${{ secrets.CYPRESS_USERPASSWORD }}
4343
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
4444
with:
4545
command: npm run test:api:cloud
@@ -59,8 +59,8 @@ jobs:
5959
- name: Cypress run
6060
uses: cypress-io/github-action@v6
6161
env:
62-
CYPRESS_user_name: ${{ secrets.CYPRESS_user_name }}
63-
CYPRESS_user_password: ${{ secrets.CYPRESS_user_password }}
62+
CYPRESS_USERNAME: ${{ secrets.CYPRESS_USERNAME }}
63+
CYPRESS_USERPASSWORD: ${{ secrets.CYPRESS_USERPASSWORD }}
6464
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
6565
with:
6666
command: npm run test:gui:project:issue:cloud
@@ -80,8 +80,8 @@ jobs:
8080
- name: Cypress run
8181
uses: cypress-io/github-action@v6
8282
env:
83-
CYPRESS_user_name: ${{ secrets.CYPRESS_user_name }}
84-
CYPRESS_user_password: ${{ secrets.CYPRESS_user_password }}
83+
CYPRESS_USERNAME: ${{ secrets.CYPRESS_USERNAME }}
84+
CYPRESS_USERPASSWORD: ${{ secrets.CYPRESS_USERPASSWORD }}
8585
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
8686
with:
8787
command: npm run test:gui:project:but:issue:cloud
@@ -101,8 +101,8 @@ jobs:
101101
- name: Cypress run
102102
uses: cypress-io/github-action@v6
103103
env:
104-
CYPRESS_user_name: ${{ secrets.CYPRESS_user_name }}
105-
CYPRESS_user_password: ${{ secrets.CYPRESS_user_password }}
104+
CYPRESS_USERNAME: ${{ secrets.CYPRESS_USERNAME }}
105+
CYPRESS_USERPASSWORD: ${{ secrets.CYPRESS_USERPASSWORD }}
106106
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
107107
with:
108108
command: npm run test:gui:all:but:project:cloud

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Run `npm i` to install the dev dependencies.
3939

4040
## Tests
4141

42-
> Before running the tests, create a file called `cypress.env.json` in the project root directory, based on the [`cypress.env.example.json`](./cypress.env.example.json) file, and update the value of the `user_password` property with one of your choice.
42+
> Before running the tests, create a file called `cypress.env.json` in the project root directory, based on the [`cypress.env.example.json`](./cypress.env.example.json) file, and update the value of the `USERPASSWORD` property with one of your choice.
4343
>
4444
> By default, the tests will run against `http://localhost/`, but if you need to run them in a different URL (e.g.: `http://localhost:3000/`), change the `baseUrl` property in the [`cypress.config.js`](./cypress.config.js) file.
4545
@@ -88,6 +88,6 @@ If you want to contribute to this project, follow the below steps.
8888

8989
> [This](https://cbea.ms/git-commit/) is the commit messaging guidelines you should follow.
9090
91-
___
91+
---
9292

9393
Developed with 💚 by [Walmyr](https://walmyr.dev).

cypress.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const esbuildPreprocessor = require('./cypress/support/esbuild-preprocessor')
33
const tasks = require('./cypress/support/tasks')
44

55
module.exports = defineConfig({
6+
allowCypressEnv: false,
67
projectId: 'vxwq6z',
78
e2e: {
89
baseUrl: 'http://localhost/',

cypress.env.example.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"user_name": "root",
3-
"user_password": "53cR37-p@s5W0rd"
2+
"USERNAME": "root",
3+
"USERPASSWORD": "53cR37-p@s5W0rd"
44
}

cypress/e2e/gui/admin/impersonateUser.cy.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@ describe('User impersonation', () => {
5050
cy.get('.qa-user-avatar').click()
5151

5252
// Assert
53-
cy.get('.dropdown-menu-right ul li.current-user')
54-
.should('contain', 'Administrator')
55-
.and('contain', `@${Cypress.env('user_name')}`)
53+
cy.env(['USERNAME']).then(({ USERNAME }) => {
54+
cy.get('.dropdown-menu-right ul li.current-user')
55+
.should('contain', 'Administrator')
56+
.and('contain', `@${USERNAME}`)
57+
})
5658
})
5759
})

cypress/e2e/gui/project/assignIssue.cy.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ describe('Issue', () => {
1212
const { name: projectName } = this.projectsBody[0]
1313
const { iid: issueIid } = this.issue.body
1414

15-
cy.visit(`${Cypress.env('user_name')}/${projectName}/issues/${issueIid}`)
15+
cy.env(['USERNAME']).then(({ USERNAME }) => {
16+
cy.visit(`${USERNAME}/${projectName}/issues/${issueIid}`)
1617

17-
cy.contains('assign yourself').click()
18+
cy.contains('assign yourself').click()
1819

19-
cy.contains('.qa-assignee-block', `@${Cypress.env('user_name')}`)
20-
.should('be.visible')
20+
cy.contains('.qa-assignee-block', `@${USERNAME}`)
21+
.should('be.visible')
22+
})
2123
})
2224
})

cypress/e2e/gui/project/closeIssue.cy.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ describe('Issue', () => {
1212
const { name: projectName } = this.projectsBody[0]
1313
const { iid: issueIid } = this.issue.body
1414

15-
cy.visit(`${Cypress.env('user_name')}/${projectName}/issues/${issueIid}`)
15+
cy.env(['USERNAME']).then(({ USERNAME }) => {
16+
cy.visit(`${USERNAME}/${projectName}/issues/${issueIid}`)
1617

17-
cy.get('.d-none.btn-close').click()
18+
cy.get('.d-none.btn-close').click()
1819

19-
cy.contains('.status-box-issue-closed', 'Closed')
20-
.should('be.visible')
20+
cy.contains('.status-box-issue-closed', 'Closed')
21+
.should('be.visible')
22+
})
2123
})
2224
})

cypress/e2e/gui/project/closeIssueQuickAction.cy.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,18 @@ describe('Issue - Quick action', () => {
1212
const { name: projectName } = this.projectsBody[0]
1313
const { iid: issueIid } = this.issue.body
1414

15-
cy.visit(`${Cypress.env('user_name')}/${projectName}/issues/${issueIid}`)
15+
cy.env(['USERNAME']).then(({ USERNAME }) => {
16+
cy.visit(`${USERNAME}/${projectName}/issues/${issueIid}`)
1617

17-
cy.gui_commentOnIssue('/close ')
18+
cy.gui_commentOnIssue('/close ')
1819

19-
cy.contains('Closed this issue')
20-
.should('be.visible')
20+
cy.contains('Closed this issue')
21+
.should('be.visible')
2122

22-
cy.reload()
23+
cy.reload()
2324

24-
cy.contains('.status-box-issue-closed', 'Closed')
25-
.should('be.visible')
25+
cy.contains('.status-box-issue-closed', 'Closed')
26+
.should('be.visible')
27+
})
2628
})
2729
})

cypress/e2e/gui/project/commentOnIssue.cy.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ describe('Issue', () => {
1515
const { name: projectName } = this.projectsBody[0]
1616
const { iid: issueIid } = this.issue.body
1717

18-
cy.visit(`${Cypress.env('user_name')}/${projectName}/issues/${issueIid}`)
18+
cy.env(['USERNAME']).then(({ USERNAME }) => {
19+
cy.visit(`${USERNAME}/${projectName}/issues/${issueIid}`)
1920

20-
cy.gui_commentOnIssue(comment)
21+
cy.gui_commentOnIssue(comment)
2122

22-
cy.contains('.qa-noteable-note-item', comment)
23-
.should('be.visible')
23+
cy.contains('.qa-noteable-note-item', comment)
24+
.should('be.visible')
25+
})
2426
})
2527
})

cypress/e2e/gui/project/createNewFile.cy.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ describe('File', () => {
1616
})
1717

1818
it.skip('creates a new file', () => {
19-
cy.visit(`${Cypress.env('user_name')}/${project.name}/new/master`)
19+
cy.env(['USERNAME']).then(({ USERNAME }) => {
20+
cy.visit(`${USERNAME}/${project.name}/new/master`)
2021

21-
cy.gui_createFile(project.file)
22+
cy.gui_createFile(project.file)
2223

23-
cy.contains('The file has been successfully created.').should('be.visible')
24-
cy.contains(project.file.name).should('be.visible')
25-
cy.contains(project.file.content).should('be.visible')
24+
cy.contains('The file has been successfully created.').should('be.visible')
25+
cy.contains(project.file.name).should('be.visible')
26+
cy.contains(project.file.content).should('be.visible')
27+
})
2628
})
2729
})

0 commit comments

Comments
 (0)