-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add sypress test to contact component
- Loading branch information
1 parent
8c5c943
commit a47a858
Showing
6 changed files
with
72 additions
and
31 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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
describe('ContactSection Component - Happy Path', () => { | ||
|
||
beforeEach(() => { | ||
cy.visit('http://localhost:3000/'); | ||
}); | ||
|
||
it('should display the main elements of the homepage', () => { | ||
cy.get('.home-header').should('be.visible'); | ||
cy.get('.nav-bar').should('be.visible'); | ||
cy.get('[href="/contact"]').should('contain', 'helpful resources'); | ||
cy.get('[href="/contact"]').click(); | ||
}); | ||
|
||
it('should render the component correctly', () => { | ||
cy.visit('http://localhost:3000/contact'); | ||
|
||
cy.location('pathname').should('eq', '/contact'); | ||
cy.viewport(1280, 720); | ||
cy.get('.weallhuman-img').should('be.visible'); | ||
}); | ||
|
||
it('should navigate to the contact page from the homepage', () => { | ||
cy.visit('http://localhost:3000'); | ||
cy.get('.nav-bar').should('be.visible'); | ||
cy.get('[href="/contact"]').click(); | ||
cy.url().should('include', '/contact'); | ||
}); | ||
}); | ||
|
||
describe('ContactSection Component - Sad Path', () => { | ||
|
||
it('should handle missing image gracefully', () => { | ||
cy.intercept('GET', '**/usa-custom.jpeg', { statusCode: 404 }); | ||
cy.visit('http://localhost:3000/contact'); | ||
cy.reload(); | ||
cy.viewport(1280, 720); | ||
cy.get('img[alt="usa-custom"]').should('be.visible'); | ||
}); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
File renamed without changes