Skip to content

Commit

Permalink
pkp/pkp-lib#9890 Update target selector for nav items in cypress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
blesildaramirez committed Sep 13, 2024
1 parent 296f8d4 commit bf33a48
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 28 deletions.
17 changes: 10 additions & 7 deletions cypress/tests/data/10-ApplicationSetup/20-CreateContext.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('Data suite tests', function() {
cy.login('admin', 'admin');
cy.get('a').contains('admin').click();
cy.get('a').contains('Dashboard').click();
cy.get('nav div[data-pc-section="header"] a span').contains('Administration').click();
cy.get('nav').contains('Administration').click();
cy.get('a').contains('Hosted Presses').click();
cy.get('a[class=show_extras]').click();
cy.contains('Settings wizard').click();
Expand Down Expand Up @@ -93,8 +93,9 @@ describe('Data suite tests', function() {
cy.login('admin', 'admin');
cy.get('a').contains('admin').click();
cy.get('a').contains('Dashboard').click();
cy.get('nav div[data-pc-section="header"] a span').contains('Settings').click();
cy.get('nav div[data-pc-section="itemcontent"] a span').contains('Press').click({ force: true });
cy.get('nav').contains('Settings').click();
// Ensure submenu item click despite animation
cy.get('nav').contains('Press').click({ force: true });

cy.get('div[id=masthead]').find('button').contains('Save').click();
cy.get('#masthead [role="status"]').contains('Saved');
Expand All @@ -104,8 +105,9 @@ describe('Data suite tests', function() {
cy.login('admin', 'admin');
cy.get('a').contains('admin').click();
cy.get('a').contains('Dashboard').click();
cy.get('nav div[data-pc-section="header"] a span').contains('Settings').click();
cy.get('nav div[data-pc-section="itemcontent"] a span').contains('Press').click({ force: true });
cy.get('nav').contains('Settings').click();
// Ensure submenu item click despite animation
cy.get('nav').contains('Press').click({ force: true });
cy.get('button[id="contact-button"]').click();

// Submit the form with required fields missing.
Expand All @@ -128,8 +130,9 @@ describe('Data suite tests', function() {

it('Tests role settings', function() {
cy.login('admin', 'admin', 'publicknowledge');
cy.get('nav div[data-pc-section="header"] a span').contains('Settings').click();
cy.get('nav div[data-pc-section="itemcontent"] a span').contains('Users & Roles').click({ force: true });
cy.get('nav').contains('Settings').click();
// Ensure submenu item click despite animation
cy.get('nav').contains('Users & Roles').click({ force: true });
cy.get('button').contains('Roles').click();

// "Edit" link below "Volume editor" role
Expand Down
5 changes: 3 additions & 2 deletions cypress/tests/data/10-ApplicationSetup/40-CreateUsers.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ describe('Data suite tests', function() {
cy.login('admin', 'admin');
cy.get('a:contains("admin"):visible').click();
cy.get('a:contains("Dashboard")').click();
cy.get('nav div[data-pc-section="header"] a span').contains('Settings').click();
cy.get('nav div[data-pc-section="itemcontent"] a span').contains('Users & Roles').click({ force: true });
cy.get('nav').contains('Settings').click();
// Ensure submenu item click despite animation
cy.get('nav').contains('Users & Roles').click({ force: true });

var users = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ describe('Data suite tests', function() {
cy.login('admin', 'admin');
cy.get('a').contains('admin').click();
cy.get('a').contains('Dashboard').click();
cy.get('nav div[data-pc-section="header"] a span').contains('Settings').click();
cy.get('nav div[data-pc-section="itemcontent"] a span').contains('Press').click({ force: true });
cy.get('nav').contains('Settings').click();
// Ensure submenu item click despite animation
cy.get('nav').contains('Press').click({ force: true });
cy.get('button[id="categories-button"]').click();

// Create an Applied Science category
Expand Down
5 changes: 3 additions & 2 deletions cypress/tests/data/10-ApplicationSetup/50-CreateSeries.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ describe('Data suite tests', function() {
cy.login('admin', 'admin');
cy.get('a').contains('admin').click();
cy.get('a').contains('Dashboard').click();
cy.get('nav div[data-pc-section="header"] a span').contains('Settings').click();
cy.get('nav div[data-pc-section="itemcontent"] a span').contains('Press').click({ force: true });
cy.get('nav').contains('Settings').click();
// Ensure submenu item click despite animation
cy.get('nav').contains('Press').click({ force: true });
cy.get('button[id="sections-button"]').click();

// Create a new "Library & Information Studies" series
Expand Down
10 changes: 6 additions & 4 deletions cypress/tests/integration/CompetingInterests.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ describe('Data suite tests', function() {
it('Tests with Competing Interests enabled', function() {
// Set the CI requirement setting
cy.login('dbarnes', null, 'publicknowledge');
cy.get('nav div[data-pc-section="header"] a span').contains('Settings').click();
cy.get('nav div[data-pc-section="itemcontent"] a span').contains('Workflow').click({ force: true });
cy.get('nav').contains('Settings').click();
// Ensure submenu item click despite animation
cy.get('nav').contains('Workflow').click({ force: true });
cy.get('button[id="review-button"]').click();
cy.get('button[id="reviewerGuidance-button"]').click();
cy.setTinyMceContent('reviewerGuidance-competingInterests-control-en', 'Reviewer competing interests disclosure');
Expand Down Expand Up @@ -105,8 +106,9 @@ describe('Data suite tests', function() {

// Disable the CI requirement again
cy.login('dbarnes', null, 'publicknowledge');
cy.get('nav div[data-pc-section="header"] a span').contains('Settings').click();
cy.get('nav div[data-pc-section="itemcontent"] a span').contains('Workflow').click({ force: true });
cy.get('nav').contains('Settings').click();
// Ensure submenu item click despite animation
cy.get('nav').contains('Workflow').click({ force: true });
cy.get('button[id="review-button"]').click();
cy.get('button[id="reviewerGuidance-button"]').click();
cy.setTinyMceContent('reviewerGuidance-competingInterests-control-en', '');
Expand Down
2 changes: 1 addition & 1 deletion cypress/tests/integration/Doi.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('DOI tests', function() {
};

const goToDoiPage = () => {
cy.get('nav div[data-pc-section="header"] a span').contains('DOIs').click();
cy.get('nav').contains('DOIs').click();
cy.get('button#submission-doi-management-button').click();
};

Expand Down
7 changes: 4 additions & 3 deletions cypress/tests/integration/Payments.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
describe('Payments', function() {
it('Enable Payment', function() {
cy.login('dbarnes', null, 'publicknowledge');
cy.get('nav div[data-pc-section="header"] a span').contains('Settings').click();
cy.get('nav div[data-pc-section="itemcontent"] a span').contains('Distribution').click({ force: true });
cy.get('nav').contains('Settings').click();
// Ensure submenu item click despite animation
cy.get('nav').contains('Distribution').click({ force: true });
cy.get('button[id="payments-button"]').click();
cy.get('input[type="checkbox"][name="paymentsEnabled"]:first').click();
cy.get('select[id="paymentSettings-currency-control"]').select('US Dollar');
Expand All @@ -25,7 +26,7 @@ describe('Payments', function() {

it('Add a direct sales on Submission chapter', function () {
cy.login('dbarnes', null, 'publicknowledge');
cy.get('nav div[data-pc-section="header"] a span').contains('Submissions').click();
cy.get('nav').contains('Submissions').click();
cy.get('button[id="archive-button"]').click();

var submissionElement = cy.get('#archive .listPanel__item').contains('Bomb Canada and Other Unkind Remarks in the American Media').parents('.listPanel__item');
Expand Down
5 changes: 3 additions & 2 deletions cypress/tests/integration/Statistics.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ describe('Statistics Tests', function() {

it('Check statistics', function() {
cy.login('dbarnes', null, 'publicknowledge');
cy.get('nav div[data-pc-section="header"] a span').contains('Statistics').click();
cy.get('nav div[data-pc-section="itemcontent"] a span').contains('Monographs').click({ force: true });
cy.get('nav').contains('Statistics').click();
// Ensure submenu item click despite animation
cy.get('nav').contains('Monographs').click({ force: true });
cy.checkGraph(
'Total catalog views by date',
'Abstract Views',
Expand Down
12 changes: 7 additions & 5 deletions cypress/tests/integration/Z_MonographViewDCMetadata.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,9 @@ describe('Monograph View Metadata - DC Plugin', function() {
cy.get('a').contains('Dashboard').click();

// Enable metadata settings
cy.get('nav div[data-pc-section="header"] a span').contains('Settings').click();
cy.get('nav div[data-pc-section="itemcontent"] a span').contains('Press').click({ force: true });
cy.get('nav').contains('Settings').click();
// Ensure submenu item click despite animation
cy.get('nav').contains('Press').click({ force: true });
cy.get('button#sections-button').click();
cy.get('tr[id^="component-grid-settings-series-seriesgrid-row-"]:contains("Political Economy") > .first_column > .show_extras').click();
cy.get('tr[id^="component-grid-settings-series-seriesgrid-row-"]:contains("Political Economy") + tr a:contains("Edit")').click();
Expand All @@ -385,8 +386,9 @@ describe('Monograph View Metadata - DC Plugin', function() {
cy.get('div:contains("Your changes have been saved.")');

// Enable metadata settings
cy.get('nav div[data-pc-section="header"] a span').contains('Settings').click();
cy.get('nav div[data-pc-section="itemcontent"] a span').contains('Workflow').click({ force: true });
cy.get('nav').contains('Settings').click();
// Ensure submenu item click despite animation
cy.get('nav').contains('Workflow').click({ force: true });
cy.get('button').contains('Metadata').click();
cy.get('span').contains('Enable coverage metadata').prev('input[type="checkbox"]').check();
cy.get('span').contains('Enable type metadata').prev('input[type="checkbox"]').check();
Expand All @@ -400,7 +402,7 @@ describe('Monograph View Metadata - DC Plugin', function() {
cy.checkDoiConfig(['publication', 'chapter', 'representation', 'file']);

// After configuration, go to submissions
cy.get('nav div[data-pc-section="header"] a span').contains('Submissions').click();
cy.get('nav').contains('Submissions').click();

// Create a new submission
cy.getCsrfToken();
Expand Down

0 comments on commit bf33a48

Please sign in to comment.