Created
October 13, 2019 13:57
-
-
Save wlsf82/a4c771d70683fdd43f32c8cf15566558 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe("Home page", () => { | |
beforeEach(() => cy.exec("npm run drop-db")); | |
context("With items state", () => { | |
const min = 6; | |
const max = 54; | |
beforeEach(() => { | |
cy.exec("npm run seed-db"); | |
cy.visit("/"); | |
}); | |
it.only("asserts on the sum of item titles", () => { | |
let sum = 0; | |
cy.get(".item-title") | |
.each(($title, index, $titles) => { | |
sum += parseInt($title.text()); | |
if (index === $titles.length - 1) { | |
expect(sum).to.be.gte(min); | |
expect(sum).not.to.be.gt(max); | |
} | |
}); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment