diff --git a/.github/workflows/quality_control_cypress.yml b/.github/workflows/quality_control_cypress.yml index 2f6697f..c6ea6b2 100644 --- a/.github/workflows/quality_control_cypress.yml +++ b/.github/workflows/quality_control_cypress.yml @@ -17,6 +17,11 @@ on: default: "54, 76, 117, 226, 385" env: + PAGE_LIMIT: "randompick" + TAXON_MODELS: "randompick" + THREE_SYNC_VIEW: "randompick" + SEARCH_IN_MAP: "randompick" + SCAFFOLD_DATASET_IDS: "randompick" GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }} CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} diff --git a/tests/cypress/e2e/databrowser.cy.js b/tests/cypress/e2e/databrowser.cy.js index 0ab8370..908c2fa 100644 --- a/tests/cypress/e2e/databrowser.cy.js +++ b/tests/cypress/e2e/databrowser.cy.js @@ -172,7 +172,7 @@ browseCategories.forEach((category, bcIndex) => { cy.get('.search-text').click() // Check for keyword in URL cy.url().should((url) => { - expect(url, 'URL should contain search keyword parameter').to.contain(`search=${keyword}`) + expect(url, 'URL should contain search keyword parameter').to.contain(`search=${keyword.replace(' ', '+')}`) }) cy.wait(5000) cy.wait('@query', { timeout: 20000 }).then((intercept) => { @@ -196,7 +196,7 @@ browseCategories.forEach((category, bcIndex) => { cy.get('.table-wrap').then(($table) => { const keywordExistInTable = $table.text().toLowerCase().includes(keyword.toLowerCase()) if (keywordExistInTable) { - cy.get('b').contains(new RegExp(keyword, 'i')).should(($keyword) => { + cy.get('b').contains(new RegExp('\(' + keyword.replace(' ', '|') + '\)', 'i')).should(($keyword) => { expect($keyword, 'Highlighted keyword should exist in table').to.exist }) } else { diff --git a/tests/cypress/e2e/datasets/datasetInfo.cy.js b/tests/cypress/e2e/datasets/datasetInfo.cy.js index 7d0b575..41c9aa5 100644 --- a/tests/cypress/e2e/datasets/datasetInfo.cy.js +++ b/tests/cypress/e2e/datasets/datasetInfo.cy.js @@ -103,7 +103,7 @@ datasetIds.forEach((datasetId) => { expect(url, 'URL should contain correct slug').to.contain('/about/projects/') }) // Check for the title - cy.get('.row > .heading2').should(($pTitle) => { + cy.get('.row > .heading2', { timeout: 60000 }).should(($pTitle) => { expect($pTitle, 'Project title should match').to.contain(title) }) cy.backToDetailPage(datasetId) diff --git a/tests/cypress/e2e/datasets/detailtabs.cy.js b/tests/cypress/e2e/datasets/detailtabs.cy.js index 8c3165a..9697d88 100644 --- a/tests/cypress/e2e/datasets/detailtabs.cy.js +++ b/tests/cypress/e2e/datasets/detailtabs.cy.js @@ -226,6 +226,8 @@ datasetIds.forEach((datasetId) => { } }) }) + }) + cy.get('@contact', { timeout: 60000 }).then(($content) => { cy.get('.about-section-container a').then(($email) => { cy.get('.dataset-owners').should(($contributors) => { const author = $content.text().replace($email.text(), '').replace('Contact Author:', '').replace(/[ ]+/g, ' ').trim() @@ -252,7 +254,7 @@ datasetIds.forEach((datasetId) => { const institution = $institution.text().replace('Institution(s):', '').trim() cy.wrap($project).find('a').click() cy.waitForPageLoading() - cy.get('.row > .heading2').should(($title) => { + cy.get('.row > .heading2', { timeout: 60000 }).should(($title) => { expect($title, 'Project title should be the same').to.contain(project) }) cy.get('span.label4').parent().contains(/INSTITUTION[(]S[)]/i).should(($institution) => { diff --git a/tests/cypress/e2e/mapsviewer.cy.js b/tests/cypress/e2e/mapsviewer.cy.js index a3e7a89..4341edb 100644 --- a/tests/cypress/e2e/mapsviewer.cy.js +++ b/tests/cypress/e2e/mapsviewer.cy.js @@ -164,7 +164,7 @@ describe('Maps Viewer', { testIsolation: false }, function () { cy.get('.tools > .control-button:visible').then(($tools) => { expect($tools, 'The control panel tools should have 2').to.have.length(2) }) - cy.get('.tools > :nth-child(2).control-button:visible').click() + cy.get('.tools > :nth-child(2).control-button:visible').click() cy.get('.connectivity-graph > .control-panel-nodes').then(($panelNodes) => { expect($panelNodes, 'The control panel nodes should exist').to.exist cy.wrap($panelNodes).get('.node-key > .key-box-container > .key-box').then(($keys) => { @@ -277,10 +277,7 @@ describe('Maps Viewer', { testIsolation: false }, function () { cy.wait(['@dataset_info', '@datasets'], { timeout: 20000 }) // Check for search result and the tag 'Scaffold' cy.get('.dataset-card-container > .dataset-card', { timeout: 30000 }).as('datasetCards') - cy.get('@datasetCards').contains(datasetId).should(($card) => { - expect($card, 'The search result should contain the specific dataset card').to.exist - }) - cy.get('@datasetCards').filter(`:contains(${datasetId})`).within(() => { + cy.get('@datasetCards').contains(datasetId).parents('.dataset-card-container.dataset-card').within(() => { cy.get('.badges-container > .container', { timeout: 30000 }).as('tags') cy.get('@tags').contains(/Scaffold/i).should(($tag) => { expect($tag, 'The dataset card should contain the scaffold tag').to.exist @@ -288,7 +285,7 @@ describe('Maps Viewer', { testIsolation: false }, function () { cy.get('@tags').contains(/Scaffold/i).click() }) // Check for button text - cy.get('.dataset-card-container > .dataset-card', { timeout: 30000 }).contains(/View Scaffold/i).click() + cy.get('@datasetCards').contains(/View Scaffold/i).click() cy.wait('@s3-resource', { timeout: 20000 }) // Check for context card cy.get('.context-card').should(($card) => { diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js index a34dcd6..d7b493c 100644 --- a/tests/cypress/support/commands.js +++ b/tests/cypress/support/commands.js @@ -60,42 +60,42 @@ Cypress.on('uncaught:exception', (err, runnable) => { }) Cypress.Commands.add('waitForBrowserLoading', () => { - cy.get('.el-loading-mask', { timeout: 30000 }).should(($loadingMask) => { + cy.get('.el-loading-mask', { timeout: 60000 }).should(($loadingMask) => { expect($loadingMask, 'Browser loading mask should not exist').to.not.exist }) cy.wait(5000) }) Cypress.Commands.add('waitForPageLoading', () => { - cy.get('.loading-container', { timeout: 30000 }).should(($loadingMask) => { + cy.get('.loading-container', { timeout: 60000 }).should(($loadingMask) => { expect($loadingMask, 'Page loading mask should not exist').to.not.exist }) cy.wait(5000) }) Cypress.Commands.add('waitForMapLoading', () => { - cy.get('.multi-container > .el-loading-parent--relative > .el-loading-mask', { timeout: 30000 }).should(($loadingMask) => { + cy.get('.multi-container > .el-loading-parent--relative > .el-loading-mask', { timeout: 60000 }).should(($loadingMask) => { expect($loadingMask, 'Map loading mask should not exist').to.not.exist }) cy.wait(5000) }) Cypress.Commands.add('waitForGalleryLoading', () => { - cy.get('.loading-gallery > .el-loading-mask > .el-loading-spinner', { timeout: 30000 }).should(($loadingMask) => { + cy.get('.loading-gallery > .el-loading-mask > .el-loading-spinner', { timeout: 60000 }).should(($loadingMask) => { expect($loadingMask, 'Gallery loading mask should not exist').to.not.exist }) cy.wait(5000) }) Cypress.Commands.add('waitForViewerContainer', (selector) => { - cy.get(selector, { timeout: 30000 }).should(($mapViewer) => { + cy.get(selector, { timeout: 60000 }).should(($mapViewer) => { expect($mapViewer, 'Viewer container should exist').to.exist }) cy.wait(5000) }) Cypress.Commands.add('waitForConnectivityGraphLoading', () => { - cy.get('.connectivity-graph > .el-loading-mask > .el-loading-spinner', { timeout: 30000 }).should(($loadingMask) => { + cy.get('.connectivity-graph > .el-loading-mask > .el-loading-spinner', { timeout: 60000 }).should(($loadingMask) => { expect($loadingMask, 'Connectivity graph loading mask should not exist').to.not.exist }) cy.wait(5000) @@ -235,7 +235,7 @@ Cypress.Commands.add('checkGalleyCardState', () => { cy.get('.cursor-pointer > .thumbnail').should(($image) => { expect($image, 'Image should be loaded').to.have.prop('naturalWidth').to.be.greaterThan(0) }) - cy.get('.details > .el-tooltip__trigger > .title').should(($title) => { + cy.get('.details > .el-tooltip__trigger > .title', { timeout: 30000 }).should(($title) => { expect($title, 'Title should exist').to.not.have.text('') }) cy.get('.details > .el-button').should(($button) => {