Skip to content

Commit

Permalink
Merge pull request #597 from CalCorbin/e2e-landing
Browse files Browse the repository at this point in the history
Add e2e test for landing page links
  • Loading branch information
CalCorbin authored Oct 29, 2024
2 parents 6e52080 + 1f32ac0 commit 6026118
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
8 changes: 8 additions & 0 deletions TASKS.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Portfolio Task List

- Upgrade eslint
- Create hover state for cards that shows a description of the project
- Create a new page for the blog
- Create automated package versioning that informs me of errors
- Create a websocket project that allows users to draw together
- Add 'no .only' rule to eslint
35 changes: 35 additions & 0 deletions cypress/e2e/landing.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
describe('Landing Page', () => {
beforeEach(() => {
cy.visit('/');

// Load the page
cy.findByText('cal corbin').should('be.visible');
});

it('should go to landing page and open the LinkedIn link', () => {
// Click on the LinkedIn link
cy.get('a[href="https://www.linkedin.com/in/calcorbin/"]').click();

// Verify the LinkedIn link opens
cy.origin('https://www.linkedin.com/in/calcorbin/', () => {
cy.on('uncaught:exception', (e) => {
if (e.message.includes('Things went bad')) {
// we expected this error, so let's ignore it
// and let the test continue
return false;
}
});
cy.contains('Experience & Education').should('be.visible');
});
});

it('should go to landing page and open the GitHub link', () => {
// Click on the GitHub link
cy.get('a[href="https://github.com/CalCorbin"]').click();

// Verify the GitHub link opens
cy.origin('https://github.com', () => {
cy.contains("When I'm not coding").should('be.visible');
});
});
});
4 changes: 2 additions & 2 deletions src/components/Landing/Landing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const Landing = () => (
</a>
<a
data-testid="cal-linkedin"
target="_blank"
target="_self"
rel="noopener noreferrer"
href="https://www.linkedin.com/in/calcorbin/"
>
Expand All @@ -35,7 +35,7 @@ const Landing = () => (
</a>
<a
data-testid="cal-github"
target="_blank"
target="_self"
rel="noopener noreferrer"
href="https://github.com/CalCorbin"
>
Expand Down

0 comments on commit 6026118

Please sign in to comment.