Skip to content

Commit

Permalink
Fix failing alert test (#620)
Browse files Browse the repository at this point in the history
* Make alert test more resilient to other alerts being present

* fix publication test table

Co-authored-by: Tim Yao <31641325+tim-yao@users.noreply.github.com>
  • Loading branch information
dylankelly and tim-yao committed Jan 16, 2020
1 parent 626ecab commit 8ccf0d2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Feature: Publication
| Author | Demo Department |
| Date | July 2019 |

@focus
Scenario: Print all publication pages
Given the "/demo-publication" route exists
Given the "/demo-publication/demo-publication-chapter-1" route exists
Expand Down Expand Up @@ -39,5 +38,5 @@ Feature: Publication
| Demo Publication - Chapter 2 - Page 1 | demo-publication-chapter-2-page-1 |
| Demo Publication - Chapter 2 - Page 2 | demo-publication-chapter-2-page-2 |
| Demo Publication - Chapter 2 - Page 3 | demo-publication-chapter-2-page-3 |
| Demo Publication - Chapter 3 | demo-publication-chapter-3 |
| Demo Publication - Chapter 3 | demo-publication-chapter-3 |
And the contact component should exist
22 changes: 11 additions & 11 deletions packages/ripple-test-tools/step_definitions/common/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ Then(`I should see {int} global notification`, (alertCount) => {

Then(`there should be the following global notifications:`, (dataTable) => {
const alerts = dataTable.rawTable.slice(1)
alerts.forEach((alertTest, index) => {
cy.get('.rpl-alert').eq(index).then(alert => {
const title = alertTest[0]
const type = alertTest[1]
const url = alertTest[2]
const linkText = alertTest[3]
cy.wrap(alert).get('.rpl-alert__title').should('contain', title)
cy.wrap(alert).get('.rpl-alert__link').should('have.attr', 'href', url)
cy.wrap(alert).get('.rpl-alert__link').should('contain', linkText)
cy.wrap(alert).should('have.attr', 'data-alert-type', type)
})
alerts.forEach((expected, index) => {
const title = expected[0]
const type = expected[1]
const url = expected[2]
const linkText = expected[3]
cy.get('.rpl-alert').contains(title).parent().parent().as('alert')

cy.get('@alert').find('.rpl-alert__title').should('contain', title)
cy.get('@alert').find('.rpl-alert__link').should('have.attr', 'href', url)
cy.get('@alert').find('.rpl-alert__link').should('contain', linkText)
cy.get('@alert').should('have.attr', 'data-alert-type', type)
})
})

Expand Down

0 comments on commit 8ccf0d2

Please sign in to comment.