Skip to content

Commit

Permalink
Merge pull request #239 from ddjnw1yu/testing-fix
Browse files Browse the repository at this point in the history
Testing fix
  • Loading branch information
alan-wu authored Dec 12, 2024
2 parents 277dbab + 6393536 commit 2e68a98
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 17 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/quality_control_cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
4 changes: 2 additions & 2 deletions tests/cypress/e2e/databrowser.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion tests/cypress/e2e/datasets/datasetInfo.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion tests/cypress/e2e/datasets/detailtabs.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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) => {
Expand Down
9 changes: 3 additions & 6 deletions tests/cypress/e2e/mapsviewer.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -277,18 +277,15 @@ 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
})
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) => {
Expand Down
14 changes: 7 additions & 7 deletions tests/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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) => {
Expand Down

0 comments on commit 2e68a98

Please sign in to comment.