-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from Pma913/feature/cypress
Feature/cypress
- Loading branch information
Showing
4 changed files
with
37 additions
and
47 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,26 @@ | ||
describe('error page', () => { | ||
// it('should display an error page if failed to get fact', () => { | ||
// cy.intercept('https://catfact.ninja/fact', { | ||
// statusCode: 500 | ||
// }) | ||
// cy.visit('https://cats-meow.vercel.app/') | ||
// cy.get('button[class=fact-btn]').click() | ||
// cy.get('h2').contains('Looks like there was a problem. Please try again later') | ||
// }) | ||
it('should display an error page if failed to get fact', () => { | ||
cy.intercept('https://catfact.ninja/fact', { | ||
statusCode: 500 | ||
}) | ||
cy.visit('http://localhost:3000/') | ||
cy.get('button[class=fact-btn]').click() | ||
cy.get('h2').contains("Looks like something is wrong. Please try again later.") | ||
}) | ||
|
||
// it('should display message if no favorited facts', () => { | ||
// cy.visit('https://cats-meow.vercel.app/') | ||
// cy.get('button[class=fav-btn]').click() | ||
// cy.get('h2').contains('No saved ideas yet') | ||
// }) | ||
it('should be able to visit home page', () => { | ||
cy.visit('https://cats-meow.vercel.app/') | ||
it('should display message if no favorited facts', () => { | ||
cy.visit('https://cats-meow.vercel.app/') | ||
cy.get('button[class=fav-btn]').click() | ||
cy.get('h2').contains('No saved ideas yet') | ||
}) | ||
it('should be able to navigate back to home page', () => { | ||
cy.intercept('https://catfact.ninja/fact', { | ||
statusCode: 500 | ||
}) | ||
cy.visit('http://localhost:3000/') | ||
cy.get('button[class=fact-btn]').click() | ||
cy.get('h2').contains("Looks like something is wrong. Please try again later.") | ||
cy.get('h3').click() | ||
cy.get('h1').contains('Cats Meow') | ||
}) | ||
}) |
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
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
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