-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from Vizzuality/AF-cypress
[FE](test): Cypress configs and UI tests
- Loading branch information
Showing
18 changed files
with
12,151 additions
and
3,601 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Cypress Tests | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'client/**' | ||
- '.github/workflows/testing-e2e.yml' | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
cypress-run: | ||
runs-on: ubuntu-22.04 | ||
defaults: | ||
run: | ||
working-directory: ${{github.workspace}}/client | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Use Node.js 18.13 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: 'client/.nvmrc' | ||
cache: 'yarn' | ||
cache-dependency-path: client/yarn.lock | ||
|
||
- name: Install dependencies | ||
run: yarn install --immutable | ||
|
||
- name: Cypress run | ||
uses: cypress-io/github-action@v6 | ||
with: | ||
build: yarn build | ||
start: yarn start | ||
command: "yarn cypress:open" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { defineConfig } from 'cypress'; | ||
|
||
export default defineConfig({ | ||
e2e: { | ||
baseUrl: 'http://localhost:3000', | ||
supportFile: false, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
describe('map', () => { | ||
it('changes basemap', () => { | ||
cy.visit('/'); | ||
cy.get('button[data-cy="map-settings-button"]').click(); | ||
cy.get('button[data-cy="basemap-satellite"]').click(); | ||
// Todo: We would need to check if basemap is in the url | ||
}); | ||
|
||
it('loads', () => { | ||
cy.visit('/'); | ||
const map = cy.get('#default').wait(8000); | ||
map.should('exist'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
describe('navigation', () => { | ||
it('redirects to project page', () => { | ||
cy.visit('/').url().should('be.equal', 'http://localhost:3000/projects'); | ||
}); | ||
|
||
it('access to project detail page and switch dashboard', () => { | ||
cy.visit('/'); | ||
cy.get('a[data-cy="project-item-link"]').first().click(); | ||
cy.get('button[data-cy="project-dashboard-button"]').click().wait(1000); | ||
cy.get('[data-cy="project-dashboard"]').should('exist'); | ||
cy.get('button[data-cy="project-dashboard-button"]').click(); | ||
cy.get('[data-cy="project-dashboard"]').should('not.exist'); | ||
}); | ||
|
||
it('access to country detail page', () => { | ||
cy.visit('/'); | ||
cy.get('a[data-cy="sidebar-tab-countries"]').click(); | ||
cy.get('a[data-cy="country-item-link"]').first().click(); | ||
cy.get('[data-cy="country-detail-name"]').should('exist'); | ||
}); | ||
|
||
it('access to datasets and displays an info dialog', () => { | ||
cy.visit('/'); | ||
cy.get('a[data-cy="sidebar-tab-datasets"]').click().wait(1000); | ||
cy.get('button[data-cy="info-soil-carbon-density-button"]').click(); | ||
cy.get('div[data-cy="info-soil-carbon-density-dialog"]').should('exist'); | ||
cy.get('button[data-cy="info-soil-carbon-density-dialog-close"]').click(); | ||
cy.get('div[data-cy="info-soil-carbon-density-dialog"]').should('not.exist'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.