From c088704e63506d6bca5d9ea526e04fe59f12c5f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Raddaoui=20Mar=C3=ADn?= Date: Wed, 26 Jul 2023 19:08:08 +0200 Subject: [PATCH] Target arDominionB5Plugin theme in Cypress tests --- cypress/e2e/login.cy.js | 16 ++++++++-------- cypress/e2e/search.cy.js | 2 +- cypress/support/commands.js | 2 +- .../settings/templates/findingAidSuccess.php | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cypress/e2e/login.cy.js b/cypress/e2e/login.cy.js index aa4d7b61d1..7b4b2aaab8 100644 --- a/cypress/e2e/login.cy.js +++ b/cypress/e2e/login.cy.js @@ -5,7 +5,7 @@ describe('Login', () => { cy.get('#csrf_token').should('exist') cy.get('input#email').type(Cypress.env('adminEmail')) cy.get('input#password').type(Cypress.env('adminPassword')) - cy.get('#user-menu form').submit() + cy.get('#user-menu + .dropdown-menu form').submit() cy.get('#user-menu').click() cy.contains('Log out') @@ -14,9 +14,9 @@ describe('Login', () => { it('Logs in through the login page', () => { cy.visit('/user/login') cy.get('#csrf_token').should('exist') - cy.get('#content input#email').type(Cypress.env('adminEmail')) - cy.get('#content input#password').type(Cypress.env('adminPassword')) - cy.get('#content form').submit() + cy.get('#main-column input#email').type(Cypress.env('adminEmail')) + cy.get('#main-column input#password').type(Cypress.env('adminPassword')) + cy.get('#main-column form').submit() cy.get('#user-menu').click() cy.contains('Log out') @@ -28,14 +28,14 @@ describe('Login', () => { cy.get('#csrf_token').should('exist') cy.get('input#email').type('unknown@user.com') cy.get('input#password').type(Cypress.env('adminPassword')) - cy.get('#user-menu form').submit() + cy.get('#user-menu + .dropdown-menu form').submit() cy.contains('Sorry, unrecognized email or password') cy.visit('/user/login') - cy.get('#content input#email').type(Cypress.env('adminEmail')) - cy.get('#content input#password').type('unknown_password') - cy.get('#content form').submit() + cy.get('#main-column input#email').type(Cypress.env('adminEmail')) + cy.get('#main-column input#password').type('unknown_password') + cy.get('#main-column form').submit() cy.contains('Sorry, unrecognized email or password') }) diff --git a/cypress/e2e/search.cy.js b/cypress/e2e/search.cy.js index 5661adfed9..07052363eb 100644 --- a/cypress/e2e/search.cy.js +++ b/cypress/e2e/search.cy.js @@ -8,7 +8,7 @@ describe('Search', () => { cy.request('/informationobject/browse').its('body') .then(body => { let deletions = [] - Cypress.$(body).find('article.search-result .title a') + Cypress.$(body).find('article.search-result a') .each((_, link) => deletions.push(cy.deleteDescription( Cypress.$(link).attr('href').split('/').pop() diff --git a/cypress/support/commands.js b/cypress/support/commands.js index c154e6c311..96541f2f99 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -47,7 +47,7 @@ Cypress.Commands.add('getCsrfToken', (url, form) => ) Cypress.Commands.add('login', () => - cy.getCsrfToken('/user/login', '#content form').then(token => + cy.getCsrfToken('/user/login', '#main-column form').then(token => cy.request({ method: 'POST', url: '/user/login', diff --git a/plugins/arDominionB5Plugin/modules/settings/templates/findingAidSuccess.php b/plugins/arDominionB5Plugin/modules/settings/templates/findingAidSuccess.php index d529c6e8b0..6fc51234c3 100644 --- a/plugins/arDominionB5Plugin/modules/settings/templates/findingAidSuccess.php +++ b/plugins/arDominionB5Plugin/modules/settings/templates/findingAidSuccess.php @@ -16,7 +16,7 @@ renderGlobalErrors(); ?> - renderFormTag(url_for(['module' => 'settings', 'action' => 'findingAid'])); ?> + renderFormTag(url_for(['module' => 'settings', 'action' => 'findingAid']), ['data-cy' => 'settings-finding-aid-form']); ?> renderHiddenFields(); ?>