Skip to content

Commit

Permalink
chore: use 50 second timeout for card title to appear (#2730)
Browse files Browse the repository at this point in the history
The "add event layer" test continues to be flaky.
This change increases the timeout to 50 seconds.
Also, since the default timeout is now 15 seconds, the EXTENDED_TIMOUT
option isn't needed anymore (since that also sets to 15 seconds)
  • Loading branch information
jenniferarnesen authored Jun 27, 2023
1 parent 09de660 commit fd5696d
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions cypress/elements/layer.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { EXTENDED_TIMEOUT } from '../support/util.js'

export class Layer {
openDialog(layer) {
const dataTest = `addlayeritem-${layer
.toLowerCase()
.replace(/\s/g, '_')}`

cy.getByDataTest('add-layer-button', EXTENDED_TIMEOUT).click()
cy.getByDataTest('add-layer-button').click()

cy.get(`[data-test="${dataTest}"]`).click()

Expand Down Expand Up @@ -51,38 +49,36 @@ export class Layer {
}

addToMap() {
cy.getByDataTest('dhis2-uicore-modalactions', EXTENDED_TIMEOUT)
cy.getByDataTest('dhis2-uicore-modalactions')
.contains('Add layer')
.click()
}

validateDialogClosed(closed) {
if (closed) {
cy.getByDataTest('layeredit', EXTENDED_TIMEOUT).should('not.exist')
cy.getByDataTest('layeredit').should('not.exist')
} else {
cy.getByDataTest('layeredit', EXTENDED_TIMEOUT).should('be.visible')
cy.getByDataTest('layeredit').should('be.visible')
}
}

validateCardTitle(title) {
cy.getByDataTest('layercard', EXTENDED_TIMEOUT)
.contains(title, EXTENDED_TIMEOUT)
cy.getByDataTest('layercard')
.contains(title, { timeout: 50000 })
.should('be.visible')

return this
}

validateCardPeriod(period) {
cy.getByDataTest('layercard', EXTENDED_TIMEOUT)
.contains(period)
.should('be.visible')
cy.getByDataTest('layercard').contains(period).should('be.visible')

return this
}

validateCardItems(items) {
items.forEach((item) => {
cy.getByDataTest('layercard', EXTENDED_TIMEOUT)
cy.getByDataTest('layercard')
.find('[data-test="layerlegend-item"]')
.contains(item)
.should('be.visible')
Expand Down

0 comments on commit fd5696d

Please sign in to comment.