diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 875aa42ec..bfdb3ad8d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 diff --git a/frontend/cypress/docker-compose.yml b/frontend/cypress/docker-compose.yml index 2e56a63c4..aadbdb851 100644 --- a/frontend/cypress/docker-compose.yml +++ b/frontend/cypress/docker-compose.yml @@ -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: diff --git a/frontend/cypress/e2e/user/openid-login.spec.ts b/frontend/cypress/e2e/user/openid-login.spec.ts new file mode 100644 index 000000000..a52d6b51f --- /dev/null +++ b/frontend/cypress/e2e/user/openid-login.spec.ts @@ -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') + }) +})