From f4bd65dd2cb299e17e3fc58d3ed992cfe6801979 Mon Sep 17 00:00:00 2001 From: jc21 Date: Wed, 13 Nov 2024 13:38:33 +1000 Subject: [PATCH] Fix oauth cypress test --- test/cypress/e2e/api/OAuth.cy.js | 42 +++++++++++++++++++++++++------- test/package.json | 2 +- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/test/cypress/e2e/api/OAuth.cy.js b/test/cypress/e2e/api/OAuth.cy.js index 09faea7b..06ebd924 100644 --- a/test/cypress/e2e/api/OAuth.cy.js +++ b/test/cypress/e2e/api/OAuth.cy.js @@ -50,18 +50,42 @@ describe('OAuth with Authentik', () => { it('Should log in with OAuth', function() { cy.task('backendApiGet', { - token: token, - path: '/oauth/login?redirect_base=' + encodeURI('http://fullstack:81'), + path: '/oauth/login?redirect_base=' + encodeURI(Cypress.config('baseUrl')), }).then((data) => { expect(data).to.have.property('result'); cy.visit(data.result); - cy.get('input[name="uidField"]').type('cypress'); - cy.get('button[type="submit"]').click(); - cy.get('input[name="password"]').type('fqXBfUYqHvYqiwBHWW7f'); - cy.get('button[type="submit"]').click(); - // confirmation page - cy.get('button[type="submit"]').click(); - cy.url().should('match', /fullstack/) + + cy.get('ak-flow-executor') + .shadow() + .find('ak-stage-identification') + .shadow() + .find('input[name="uidField"]', { visible: true }) + .type('cypress'); + + cy.get('ak-flow-executor') + .shadow() + .find('ak-stage-identification') + .shadow() + .find('button[type="submit"]', { visible: true }) + .click(); + + cy.get('ak-flow-executor') + .shadow() + .find('ak-stage-password') + .shadow() + .find('input[name="password"]', { visible: true }) + .type('fqXBfUYqHvYqiwBHWW7f'); + + cy.get('ak-flow-executor') + .shadow() + .find('ak-stage-password') + .shadow() + .find('button[type="submit"]', { visible: true }) + .click(); + + cy.get('#root p.chakra-text') + .first() + .should('have.text', 'Nginx Proxy Manager'); }); }); } diff --git a/test/package.json b/test/package.json index e739aa2d..ef9bc267 100644 --- a/test/package.json +++ b/test/package.json @@ -1,5 +1,5 @@ { - "name": "test", + "name": "npmtestsuite", "version": "1.0.0", "description": "", "main": "index.js",