Skip to content

Commit

Permalink
Handle html entities also
Browse files Browse the repository at this point in the history
- Basically - we’re done parsing that HTML, what a mess. Only going to
parse the text within the HTML now for the tests.
- Add an html entity within the banners.yml so we make sure these are
tested.
  • Loading branch information
jennifer-shehane committed Aug 1, 2019
1 parent f03177e commit 4cb7f44
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions cypress/integration/contentful_banners_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ describe('Contentful driven banners', () => {
.each((banner, i) => {
cy.wrap(banner)
.find('.top-banners_item--body')
.invoke('html').invoke('trim')
.should((bannerHTML) => {
expect(utf8.encode(bannerHTML), `Banner #${i + 1} text is proper`).to.eq(banners[i].text)
.invoke('text').invoke('trim')
.should((bannerText) => {
const yamlText = Cypress.$(banners[i].text).text().trim()

expect(utf8.encode(bannerText), `Banner #${i + 1} text is proper`).to.eq(yamlText)
})

cy.wrap(banner)
Expand Down
2 changes: 1 addition & 1 deletion source/_data/banners.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- startDate: '2019-07-17T14:00-05:00'
endDate: '2019-07-31T23:59-05:00'
text: "<p>\U0001F6A9Learn how to get complete code coverage with Cypress <a href=\"https://zoom.us/webinar/register/2115632233252/WN_bbV5ezckSMu9icH0KwuHuA\">on July 31st at 11AM PDT/2PM EDT</a> with Gleb Bahmutov and Amir Rustamzadeh <a href=\"https://zoom.us/webinar/register/2115632233252/WN_bbV5ezckSMu9icH0KwuHuA\"></a></p>"
text: "<p>\U0001F6A9Learn how to get complete & awesome code coverage with Cypress <a href=\"https://zoom.us/webinar/register/2115632233252/WN_bbV5ezckSMu9icH0KwuHuA\">on July 31st at 11AM PDT/2PM EDT</a> with Gleb Bahmutov and Amir Rustamzadeh <a href=\"https://zoom.us/webinar/register/2115632233252/WN_bbV5ezckSMu9icH0KwuHuA\"></a></p>"
buttonText: 'Register Now '
buttonLink: 'https://zoom.us/webinar/register/2115632233252/WN_bbV5ezckSMu9icH0KwuHuA'

0 comments on commit 4cb7f44

Please sign in to comment.