Skip to content

Commit

Permalink
fix: cypress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mariojsnunes committed Jun 14, 2024
1 parent bf8a6be commit 96ce744
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 84 deletions.
4 changes: 3 additions & 1 deletion packages/components/src/Icon/svgs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ export const iconMap = {
employee: <img alt="icon" style={imgStyle} src={employeeSVG} />,
flagUnknown: <img alt="alt" style={imgStyle} src={flagUnknownSVG} />,
hide: <img alt="icon" style={imgStyle} src={eyeCrossedSVG} />,
loading: <img alt="icon" style={imgStyle} src={loadingSVG} />,
loading: (
<img alt="icon" data-cy="icon-loading" style={imgStyle} src={loadingSVG} />
),
machine: <img alt="icon" style={imgStyle} src={machineSVG} />,
plastic: <img alt="icon" style={imgStyle} src={plasticSVG} />,
revenue: <img alt="icon" style={imgStyle} src={revenueSVG} />,
Expand Down

This file was deleted.

20 changes: 6 additions & 14 deletions packages/cypress/src/integration/research/write.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,6 @@ describe('[Research]', () => {
const updateDescription = 'This is the description for the update.'
const updateVideoUrl = 'http://youtube.com/watch?v=sbcWY7t-JX8'

const newCollaborator = generateNewUserDetails()
cy.signUpNewUser(newCollaborator)
cy.logout()
cy.login(researcherEmail, researcherPassword)

cy.step('Create the research article')
Expand All @@ -302,30 +299,25 @@ describe('[Research]', () => {
cy.step('Research article displays correctly')
cy.contains(expected.title)
cy.contains(expected.description)
cy.contains(newCollaborator.username)

cy.get('[data-cy=create-update]').click()
cy.get('[data-cy=addResearchUpdateButton]').click()

cy.step('Enter update details')
cy.get('[data-cy=intro-title]')
.clear()
.type(updateTitle)
.blur({ force: true })
cy.get('[data-cy=intro-title]').clear().type(updateTitle).blur()

cy.get('[data-cy=intro-description]')
.clear()
.type(updateDescription)
.blur({ force: true })
.blur()

cy.get('[data-cy=videoUrl]')
.clear()
.type(updateVideoUrl)
.blur({ force: true })
cy.get('[data-cy=videoUrl]').clear().type(updateVideoUrl).blur()

cy.step('Save as Draft')
cy.get('[data-cy=draft]').click()

cy.step('Can see Draft after refresh')
cy.contains('Uploading Update').should('exist')
cy.get('[data-cy="icon-loading"]').should('not.exist')
cy.visit(`/research/${expected.slug}`)

cy.contains(updateTitle)
Expand Down

0 comments on commit 96ce744

Please sign in to comment.