feat(test): add e2e tests for openid (#1178)

This commit is contained in:
kolaente 2025-07-29 13:00:41 +02:00 committed by GitHub
parent c09be9c4b0
commit 0a688b41b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 32 additions and 11 deletions

View File

@ -298,6 +298,11 @@ jobs:
needs:
- api-build
- frontend-build
services:
dex:
image: ghcr.io/go-vikunja/dex-testing:main
ports:
- 5556:5556
strategy:
# when one test fails, DO NOT cancel the other
# containers, because this will kill Cypress processes
@ -339,6 +344,11 @@ jobs:
VIKUNJA_DATABASE_PATH: memory
VIKUNJA_DATABASE_TYPE: sqlite
VIKUNJA_RATELIMIT_NOAUTHLIMIT: 1000
VIKUNJA_AUTH_OPENID_ENABLED: 1
VIKUNJA_AUTH_OPENID_PROVIDERS_DEX_NAME: Dex
VIKUNJA_AUTH_OPENID_PROVIDERS_DEX_AUTHURL: http://dex:5556
VIKUNJA_AUTH_OPENID_PROVIDERS_DEX_CLIENTID: vikunja
VIKUNJA_AUTH_OPENID_PROVIDERS_DEX_CLIENTSECRET: secret
with:
install: false
working-directory: frontend

View File

@ -1,18 +1,13 @@
version: '3'
services:
api:
image: vikunja/api:unstable@sha256:61b77af0f0ed5b0e4c3ee693a79926d8633712ddb245f8212ba5e5321485d330
environment:
VIKUNJA_LOG_LEVEL: DEBUG
VIKUNJA_SERVICE_TESTINGTOKEN: averyLongSecretToSe33dtheDB
dex:
image: ghcr.io/go-vikunja/dex-testing:main
ports:
- 3456:3456
- 5556:5556
cypress:
image: cypress/browsers:node18.12.0-chrome107@sha256:bfdbf9b64fdaad364f6e76e3c2a75fbce7c8018644d71e41ef43bba0ae8f4e38
image: cypress/browsers:latest@sha256:30192f4e24469c4c68dfeb51598db93c1491cfb9dc465f5d397331e22bc3acea
volumes:
- ..:/project
- $HOME/.cache:/home/node/.cache/
- ..:/project
- $HOME/.cache:/home/node/.cache/
user: node
working_dir: /project
environment:

View File

@ -0,0 +1,16 @@
context('OpenID Login', () => {
it('logs in via Dex provider', () => {
cy.visit('/login')
cy.contains('Dex').click()
cy.origin('http://dex:5556', () => {
cy.get('#login').type('test@example.com')
cy.get('#password').type('12345678')
cy.get('#submit-login').click()
})
cy.url().should('include', '/')
cy.get('main.app-content .content h2')
.should('contain', 'test!')
cy.get('.show-tasks h3')
.should('contain', 'Current Tasks')
})
})