Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Chore: add Cypress #3745

Merged
merged 3 commits into from
Apr 1, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 3 additions & 0 deletions cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"baseUrl": "http://localhost:3000/app"
}
33 changes: 33 additions & 0 deletions cypress/integration/landing.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
describe('Landing page', () => {
it('redirects to welcome page', () => {
cy.visit('/')

cy.url().should('include', '/app/welcome')
})

it('features discoverability cookies', () => {
cy.visit('/')

const cookieBannerId = '[data-testid="cookies-banner-form"]'

cy.get(cookieBannerId).contains('We use cookies to provide you with the best experience')
usame-algan marked this conversation as resolved.
Show resolved Hide resolved

cy.get(cookieBannerId).contains('Accept selection').click()

cy.get(cookieBannerId).should('not.exist')

cy.contains("What's new").click()

cy.get(cookieBannerId).contains('We use cookies to provide you with the best experience')
cy.get(cookieBannerId).contains('Please accept the community support & updates cookies.')

cy.get(cookieBannerId).contains('Community support & updates').click()
cy.get(cookieBannerId).contains('Accept selection').click()
cy.get(cookieBannerId).should('not.exist')

// Open the features discoverability section
cy.wait(3000) // TODO: wait for Beamer cookies to be set
cy.contains("What's new").click()
cy.get('#beamerOverlay .iframeCointaner').should('exist')
})
})
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
"test:ci": "REACT_APP_ENV=test yarn test --ci --coverage --json --watchAll=false --testLocationInResults --runInBand --outputFile=jest.results.json",
"update-mocks": "./scripts/update-mocks.sh",
"sentry-upload-sourcemaps": "sentry-cli --auth-token $SENTRY_AUTH_TOKEN releases -o $SENTRY_ORG -p $SENTRY_PROJECT files $npm_package_version upload-sourcemaps ./build/static/js/",
"prepare": "husky install"
"prepare": "husky install",
"cypress:open": "cypress open",
"cypress:run": "cypress run"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do I get it right that it will run on safe-team.dev.gnosisdev.com?
How do I launch it on localhost?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can change baseUrl in cypress.json to localhost:3000/app

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the cy.visit("/") are going to prepend baseUrl

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest we change it to localhost then. And merge.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've changed the baseUrl to test against localhost

},
"lint-staged": {
"src/**/*.{js,jsx,ts,tsx}": [
Expand Down Expand Up @@ -170,6 +172,7 @@
"@typescript-eslint/parser": "^4.31.1",
"concurrently": "^6.0.0",
"cross-env": "^7.0.3",
"cypress": "^9.5.1",
"dotenv": "^10.0.0",
"dotenv-expand": "^5.1.0",
"eslint": "^7.32.0",
Expand Down
Loading