From f9f32fb15a1ac4794c424360b24ca13f3f0f0a60 Mon Sep 17 00:00:00 2001 From: Hyesung Oh Date: Thu, 14 Jul 2022 21:46:29 +0900 Subject: [PATCH 1/2] test: replace resume header test's contains to should contain --- apps/resume/cypress/e2e/root/header.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/resume/cypress/e2e/root/header.spec.ts b/apps/resume/cypress/e2e/root/header.spec.ts index 7e019e3e..254896e7 100644 --- a/apps/resume/cypress/e2e/root/header.spec.ts +++ b/apps/resume/cypress/e2e/root/header.spec.ts @@ -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', () => { From 80d8b3d8888f57c477b66254b6bb66c6eaaca69a Mon Sep 17 00:00:00 2001 From: Hyesung Oh Date: Thu, 14 Jul 2022 21:46:53 +0900 Subject: [PATCH 2/2] test: e2e resume - work experience --- .../cypress/e2e/root/work-experience.spec.ts | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 apps/resume/cypress/e2e/root/work-experience.spec.ts diff --git a/apps/resume/cypress/e2e/root/work-experience.spec.ts b/apps/resume/cypress/e2e/root/work-experience.spec.ts new file mode 100644 index 00000000..cbc7b388 --- /dev/null +++ b/apps/resume/cypress/e2e/root/work-experience.spec.ts @@ -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'); + }); + }); +});