diff options
author | Vinicius Reis <vinicius.reis@nextcloud.com> | 2022-04-21 01:08:00 +0300 |
---|---|---|
committer | Vinicius Reis <vinicius.reis@nextcloud.com> | 2022-04-21 01:08:00 +0300 |
commit | fdf2829e84768411f1761c379258079cd776ae14 (patch) | |
tree | 59a494c1f43642b8bd32720c51b971429b40c81e /cypress | |
parent | 2cfde2fa50fa1dd6ba0b857a7702504c538f6b5d (diff) |
✅ (#2097): improve login action
Signed-off-by: Vinicius Reis <vinicius.reis@nextcloud.com>
Diffstat (limited to 'cypress')
-rw-r--r-- | cypress/integration/links.spec.js | 6 | ||||
-rw-r--r-- | cypress/support/commands.js | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/cypress/integration/links.spec.js b/cypress/integration/links.spec.js index 98df8fbe0..775f38fe0 100644 --- a/cypress/integration/links.spec.js +++ b/cypress/integration/links.spec.js @@ -21,15 +21,13 @@ describe('test link marks', function() { }) beforeEach(function() { - cy.login(randUser, 'password') - - cy.visit('/apps/files', { + cy.login(randUser, 'password', { onBeforeLoad(win) { cy.stub(win, 'open') .as('winOpen') }, - }).as('page') + }) cy.openFile(fileName) }) diff --git a/cypress/support/commands.js b/cypress/support/commands.js index f9289a486..ec09259bd 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -26,7 +26,9 @@ import regeneratorRuntime from "regenerator-runtime"; const url = Cypress.config('baseUrl').replace(/\/index.php\/?$/g, '') Cypress.env('baseUrl', url) -Cypress.Commands.add('login', (user, password, route = '/apps/files') => { +Cypress.Commands.add('login', (user, password, { route, onBeforeLoad } = {}) => { + route = route || '/apps/files' + cy.session(user, function () { cy.visit(route) cy.get('input[name=user]').type(user) @@ -35,7 +37,7 @@ Cypress.Commands.add('login', (user, password, route = '/apps/files') => { cy.url().should('include', route) }) // in case the session already existed but we are on a different route... - cy.visit(route) + cy.visit(route, { onBeforeLoad }) }) Cypress.Commands.add('logout', (route = '/') => { |