Skip to content

Instantly share code, notes, and snippets.

@jessesanders
Created December 7, 2018 19:08
Show Gist options
  • Save jessesanders/bb791377270d84a1424324ceb47c87df to your computer and use it in GitHub Desktop.
Save jessesanders/bb791377270d84a1424324ceb47c87df to your computer and use it in GitHub Desktop.
Simple Cypress tests to check Angular CLI generated base page
describe("The Home Page", function() {
beforeEach(() => {
cy.visit("/");
});
it("h2 should have proper text", () => {
// https://on.cypress.io/within
cy.get("h2:first").should(
"have.text",
"Here are some links to help you start: "
);
});
it("links should have proper text", () => {
// https://on.cypress.io/within
cy.get("ul").within(() => {
cy.get("h2 a:first").should(
"have.attr",
"href",
"https://angular.io/tutorial"
);
cy.get("h2 a:last").should(
"have.attr",
"href",
"https://blog.angular.io/"
);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment