Skip to content
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

Apply e2e test at resume app's work experience section #95

Merged
merged 2 commits into from
Jul 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/resume/cypress/e2e/root/header.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('root - header', () => {
});

it('should render header data at level 1 heading where inside of header', () => {
cy.get('header').find('h1').contains(headerData.heading);
cy.get('header').find('h1').should('contain', headerData.heading);
});

it('should display image at header', () => {
Expand Down
65 changes: 65 additions & 0 deletions apps/resume/cypress/e2e/root/work-experience.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import { data as workExperienceData } from '../../../_content/Work-Experience';

describe('root - work experience', () => {
it('should render work experience title', () => {
cy.visit('/');
// NOTE: scrollIntoView is used because user can change the position of work experience section.
cy.get('h2').contains(workExperienceData.title).scrollIntoView();
});

const FIRST_EXPERIENCE = workExperienceData.list[0];

it('should render first company name with level 3 heading', () => {
cy.get('h3').should('contain', FIRST_EXPERIENCE.name);
});

it('should contain company start, end date at small tag', () => {
cy.get('small').should('contain', FIRST_EXPERIENCE.startDate).and('contain', FIRST_EXPERIENCE.endDate);
});

it('should render company position', () => {
cy.contains(FIRST_EXPERIENCE.position).should('be.visible');
});

it('should render company description', () => {
cy.contains(FIRST_EXPERIENCE.description).should('be.visible');
});

const FIRST_PROJECT = FIRST_EXPERIENCE.projects[0];

it('should render first project title with level 3 heading', () => {
cy.get('h3').should('contain', FIRST_PROJECT.title.text);
});

it('should contain project start, end date at small tag', () => {
cy.get('small').should('contain', FIRST_PROJECT.startDate).and('contain', FIRST_PROJECT.endDate);
});

it('should render project description', () => {
cy.contains(FIRST_PROJECT.description).should('be.visible');
});

it('should render which elements', () => {
if (FIRST_PROJECT.which.length <= 0) {
return;
}

FIRST_PROJECT.which.forEach(whichElem => {
cy.contains(whichElem).should('exist');
});
});

it('should render tech stack elements', () => {
if (typeof FIRST_PROJECT.techStack === null) {
return;
}

if (FIRST_PROJECT.techStack.length <= 0) {
return;
}

FIRST_PROJECT.techStack.forEach(techStackElem => {
cy.contains(techStackElem).should('exist');
});
});
});