-
Notifications
You must be signed in to change notification settings - Fork 34
Add About Page E2E tests #162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| describe('About page tests', () => { | ||
| beforeEach(() => { | ||
| cy.visit('/about', { timeout: 30000 }); | ||
| }); | ||
|
|
||
| it('About header renders', () => { | ||
| cy.get('[data-cy="about-header-header"]') | ||
| .should('be.visible') | ||
| .and('contain', 'Transnational Job Listing Channel'); | ||
| cy.contains('p', 'So many jobs available, all you have to do is keep up with our posts. Check below for recent job openings.') | ||
| .should('be.visible'); | ||
| }); | ||
|
|
||
| it("About banner renders", () => { | ||
| cy.get('[data-cy="about-banner-header"]') | ||
| .should('be.visible') | ||
| .and('contain', 'Have a question?'); | ||
| cy.contains('p', 'If you have any questions, please contact us') | ||
| .should('be.visible'); | ||
| cy.get('[data-cy="about-banner-button"]') | ||
| .within(() => { | ||
| cy.validateLink('Contact Us', '/contact'); | ||
| }); | ||
| cy.contains('p', 'Follow us on Social Media:') | ||
| .should('be.visible'); | ||
| cy.get('main > div > section').eq(1) | ||
| .within(() => { | ||
| cy.validateLink('Twitter for Tech Is Hiring', 'https://www.twitter.com/TechIsHiring/') | ||
| cy.validateLink('LinkedIn for Tech Is Hiring', 'https://www.linkedin.com/company/TechIsHiring/') | ||
| cy.validateLink('YouTube for Tech Is Hiring', 'https://www.youtube.com/@TechIsHiring') | ||
| }) | ||
| }); | ||
|
|
||
| it("About banner renders on mobile", () => { | ||
| cy.viewport('iphone-5') | ||
| cy.get('[data-cy="about-banner-header"]') | ||
| .should('be.visible') | ||
| .and("contain", "Have a question?"); | ||
| cy.contains('p', 'If you have any questions, please contact us') | ||
| .should('be.visible'); | ||
| cy.get('[data-cy="about-banner-button"]') | ||
| .within(() => { | ||
| cy.validateLink('Contact Us', '/contact'); | ||
| }); | ||
| cy.contains('p', 'Follow us on Social Media:') | ||
| .should('not.be.visible'); | ||
| }); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's missing here is a test of the content on the right hand side, which only appears on wider viewports:
I'd suggest we change the default viewport size for e2e: {
baseUrl: 'http://localhost:3000',
viewportWidth: 1400,
...That will make all tests of "desktop layout" be more representative.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added tests for the rhs content |
||
|
|
||
| it('About details renders', () => { | ||
| cy.get('article').should('be.visible') | ||
| .within(() => { | ||
| cy.validateLink('Chad R. Stewart', 'https://www.linkedin.com/in/ChadRStewart/'); | ||
| cy.validateLink('#TechIsHiring', 'https://twitter.com/TechIsHiring/'); | ||
| cy.validateLink('Hire Chad R. Stewart', '/hire-chad'); | ||
|
Comment on lines
+52
to
+54
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For these, the issue wasn't too clear as written, but I was thinking specifically of covering these links at the bottom in the "Follow Us" section: I like that you asserted the links in the article content though, seems fine to leave those in, let's just add separate assertions for the "Follow Us" stuff.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added tests for "Follow Us" section |
||
| }); | ||
| }); | ||
|
|
||
| it('About details renders on mobile', () => { | ||
| cy.viewport('iphone-5'); | ||
| cy.get('article').should('be.visible') | ||
| .within(() => { | ||
| cy.validateLink('Chad R. Stewart', 'https://www.linkedin.com/in/ChadRStewart/'); | ||
| cy.validateLink('#TechIsHiring', 'https://twitter.com/TechIsHiring/'); | ||
| cy.validateLink('Hire Chad R. Stewart', '/hire-chad'); | ||
|
|
||
| cy.contains('p', 'Follow us'); | ||
| cy.validateLink('Twitter for Tech Is Hiring', 'https://www.twitter.com/TechIsHiring/'); | ||
| cy.validateLink('LinkedIn for Tech Is Hiring', 'https://www.linkedin.com/company/TechIsHiring/'); | ||
| cy.validateLink('YouTube for Tech Is Hiring', 'https://www.youtube.com/@TechIsHiring'); | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,13 +11,13 @@ export default function AboutHeader() { | |
| > | ||
| <div className="w-full flex flex-col items-center justify-center px-[18px] lg:px-0 bg-gradient-to-r from-black/60 to-transparent gap-4"> | ||
|
|
||
| <HeaderText level={"h1"} className={"text-white"} fontWeight={"extrabold"} fontSize={{base: "39px", md:"56px"}}> | ||
| <HeaderText data-cy={"about-header-header"} level={"h1"} className={"text-white"} fontWeight={"extrabold"} fontSize={{base: "39px", md:"56px"}}> | ||
| Transnational <span className="text-[#7AB8F1]">Job Listing</span> Channel | ||
| </HeaderText> | ||
|
|
||
| <div className="text-white flex justify-start items-start lg:px-5 w-full lg:w-[40%] text-left lg:text-center"> | ||
| <p className=""> | ||
| So many jobs available, all you have to do is keep up with our posts. Check below for recent job openings. | ||
| So many jobs available, all you have to do is keep up with our posts. Check below for recent job openings. | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed extraneous whitespace as it was messing up the cy.contains check (oddly should('contains', ...) was fine with it) |
||
| </p> | ||
| </div> | ||
|
|
||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good use of
data-cy- there's not a great way to use thevalidateLinkhelper to target a specific locator. It makes me want to allow that helper to take a new argument and allow scoping to a locator like you've done here.