Skip to content

Commit 0ba98b2

Browse files
authored
Merge pull request #581 from bill-n/UI-Test
test: introduce UI tests with Cypress
2 parents 9f0711a + d6cbada commit 0ba98b2

File tree

8 files changed

+1527
-44
lines changed

8 files changed

+1527
-44
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,29 @@ jobs:
5454
# - name: Exit if coverage condition not met
5555
# if: ${{ steps.test.outputs.exit_code }} != 0
5656
# run: exit ${{ steps.test.outputs.exit_code }}
57+
58+
- name: Build application
59+
run: npm run build
60+
61+
- name: Save build folder
62+
uses: actions/upload-artifact@v4
63+
with:
64+
name: build
65+
if-no-files-found: error
66+
path: build
67+
68+
- name: Download the build folders
69+
uses: actions/download-artifact@v4
70+
with:
71+
name: build
72+
path: build
73+
74+
- name: Run cypress test
75+
uses: cypress-io/github-action@v6
76+
with:
77+
start: npm start &
78+
wait-on: "http://localhost:3000"
79+
wait-on-timeout: 120
80+
run: npm run cypress:run
81+
82+

cypress.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const { defineConfig } = require('cypress')
2+
3+
module.exports = defineConfig({
4+
e2e: {
5+
baseUrl: process.env.CYPRESS_BASE_URL ||'http://localhost:3000',
6+
},
7+
})

cypress/e2e/login.cy.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
describe("Display finos UI",()=>{
2+
3+
beforeEach(() =>{
4+
cy.visit('/login')
5+
})
6+
it('shoud find git proxy logo',() =>{
7+
cy.get('[data-test="git-proxy-logo"]').should('exist')
8+
})
9+
it('shoud find username',() =>{
10+
cy.get('[data-test="username"]').should('exist')
11+
})
12+
13+
it('shoud find passsword',() =>{
14+
cy.get('[data-test="password"]').should('exist')
15+
})
16+
it('shoud find login button',() =>{
17+
cy.get('[data-test="login"]').should('exist')
18+
})
19+
})

cypress/support/commands.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// ***********************************************
2+
// This example commands.js shows you how to
3+
// create various custom commands and overwrite
4+
// existing commands.
5+
//
6+
// For more comprehensive examples of custom
7+
// commands please read more here:
8+
// https://on.cypress.io/custom-commands
9+
// ***********************************************
10+
//
11+
//
12+
// -- This is a parent command --
13+
// Cypress.Commands.add('login', (email, password) => { ... })
14+
//
15+
//
16+
// -- This is a child command --
17+
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
18+
//
19+
//
20+
// -- This is a dual command --
21+
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
22+
//
23+
//
24+
// -- This will overwrite an existing command --
25+
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })

cypress/support/e2e.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// ***********************************************************
2+
// This example support/e2e.js is processed and
3+
// loaded automatically before your test files.
4+
//
5+
// This is a great place to put global configuration and
6+
// behavior that modifies Cypress.
7+
//
8+
// You can change the location of this file or turn off
9+
// automatically serving support files with the
10+
// 'supportFile' configuration option.
11+
//
12+
// You can read more here:
13+
// https://on.cypress.io/configuration
14+
// ***********************************************************
15+
16+
// Import commands.js using ES2015 syntax:
17+
import './commands'
18+
19+
// Alternatively you can use CommonJS syntax:
20+
// require('./commands')

0 commit comments

Comments
 (0)