Skip to content

Commit

Permalink
Target arDominionB5Plugin theme in Cypress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jraddaoui committed Jul 26, 2023
1 parent 124dcc7 commit 9454ef7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions cypress/e2e/login.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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')
Expand All @@ -28,14 +28,14 @@ describe('Login', () => {
cy.get('#csrf_token').should('exist')
cy.get('input#email').type('[email protected]')
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')
})
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/search.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<?php echo $findingAidForm->renderGlobalErrors(); ?>

<?php echo $findingAidForm->renderFormTag(url_for(['module' => 'settings', 'action' => 'findingAid'])); ?>
<?php echo $findingAidForm->renderFormTag(url_for(['module' => 'settings', 'action' => 'findingAid']), ['data-cy' => 'settings-finding-aid-form']); ?>

<?php echo $findingAidForm->renderHiddenFields(); ?>

Expand Down

0 comments on commit 9454ef7

Please sign in to comment.