diff options
author | Julius Härtl <jus@bitgrid.net> | 2022-04-21 09:28:06 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-21 09:28:06 +0300 |
commit | bc020a0bbc6dadd096c5f1fef3760481f534b775 (patch) | |
tree | 75da822049758f8243f97232285f790fa0ecdb0f | |
parent | fddfacb23c81bbbaad922048560f72e4c0f6f363 (diff) | |
parent | e6f099ae434ee9c877a4c8576f6752a51dc2fc9a (diff) |
Merge pull request #2318 from nextcloud/bugfix/2097/add-support-to-auto-link
Small test adjusts
-rw-r--r-- | cypress/integration/links.spec.js | 8 | ||||
-rw-r--r-- | cypress/support/commands.js | 6 |
2 files changed, 7 insertions, 7 deletions
diff --git a/cypress/integration/links.spec.js b/cypress/integration/links.spec.js index 98df8fbe0..cff108668 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) }) @@ -51,7 +49,7 @@ describe('test link marks', function() { cy.get('@winOpen') .should('have.been.calledOnce') - .should('have.been.calledWith', `/index.php/f/${id}`) + .should('have.been.calledWithMatch', new RegExp(`/f/${id}$`)) }) }) 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 = '/') => { |