Skip to content

Instantly share code, notes, and snippets.

@wlsf82
Created October 13, 2019 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wlsf82/a4c771d70683fdd43f32c8cf15566558 to your computer and use it in GitHub Desktop.
Save wlsf82/a4c771d70683fdd43f32c8cf15566558 to your computer and use it in GitHub Desktop.
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