Skip to content

Commit 5c93210

Browse files
committedFeb 2, 2025·
test(auth): add basic E2E test for OIDC
1 parent ddcacee commit 5c93210

File tree

2 files changed

+36
-21
lines changed

2 files changed

+36
-21
lines changed
 

‎cypress.config.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
const { defineConfig } = require('cypress')
1+
const { defineConfig } = require('cypress');
22

33
module.exports = defineConfig({
44
e2e: {
5-
baseUrl: process.env.CYPRESS_BASE_URL ||'http://localhost:3000',
5+
baseUrl: process.env.CYPRESS_BASE_URL || 'http://localhost:3000',
6+
chromeWebSecurity: false, // Required for OIDC testing
67
},
7-
})
8+
});

‎cypress/e2e/login.cy.js

+32-18
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,33 @@
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-
})
1+
describe('Login page', () => {
2+
beforeEach(() => {
3+
cy.visit('/login');
4+
});
125

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-
})
6+
it('should have git proxy logo', () => {
7+
cy.get('[data-test="git-proxy-logo"]').should('exist');
8+
});
9+
10+
it('should have username input', () => {
11+
cy.get('[data-test="username"]').should('exist');
12+
});
13+
14+
it('should have passsword input', () => {
15+
cy.get('[data-test="password"]').should('exist');
16+
});
17+
18+
it('should have login button', () => {
19+
cy.get('[data-test="login"]').should('exist');
20+
});
21+
22+
describe('OIDC login button', () => {
23+
it('should exist', () => {
24+
cy.get('[data-test="oidc-login"]').should('exist');
25+
});
26+
27+
// Validates that OIDC is configured correctly
28+
it('should redirect to /oidc', () => {
29+
cy.get('[data-test="oidc-login"]').click();
30+
cy.url().should('include', '/oidc');
31+
});
32+
});
33+
});

0 commit comments

Comments
 (0)
Please sign in to comment.