Skip to content

Commit

Permalink
feat(e2e): add fixtures for third party requests, remove video, fix t…
Browse files Browse the repository at this point in the history
…ypos
  • Loading branch information
jahow committed Jul 27, 2023
1 parent 6e17d60 commit 7def4d2
Show file tree
Hide file tree
Showing 13 changed files with 65,800 additions and 63,202 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ You can test the datahub app by page :
Start docker from 'support-services', and then in the 'geonetwork-ui' folder :

```shell script
ngpx nx e2e appname --watch
npx nx e2e appname --watch
```

Then select the file(s) you want to test in the interface.
Expand Down
8 changes: 5 additions & 3 deletions apps/datahub-e2e/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { defineConfig } from 'cypress'
import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset'

export default defineConfig({
e2e: nxE2EPreset(__dirname),
downloadsFolder: 'cypress/downloads',
video: false,
e2e: {
...nxE2EPreset(__dirname),
video: false,
downloadsFolder: 'cypress/downloads',
},
})
126,344 changes: 63,172 additions & 63,172 deletions apps/datahub-e2e/cypress/downloads/rectangles_200m_menage_erbm.csv

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions apps/datahub-e2e/cypress/fixtures/example.json

This file was deleted.

68 changes: 54 additions & 14 deletions apps/datahub-e2e/src/e2e/datasetDetailPage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,42 @@ describe('dataset pages', () => {
// cy.visit('/dataset/8698bf0b-fceb-4f0f-989b-111e7c4af0a4')
// dataset with pretty much everything
cy.visit('/dataset/04bcec79-5b25-4b16-b635-73115f7456e4')

cy.intercept(
'GET',
'/geoserver/insee/ows?SERVICE=WMS&REQUEST=GetCapabilities',
{
fixture: 'insee-wms-getcapabilities.xml',
}
)
cy.intercept(
'GET',
'/geoserver/insee/ows?SERVICE=WMS&REQUEST=GetCapabilities',
{
fixture: 'insee-wfs-getcapabilities.xml',
}
)
cy.intercept(
'GET',
'/geoserver/insee/ows?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&FORMAT=image%2Fpng&TRANSPARENT=true&LAYERS=rectangles_200m_menage_erbm*',
{
fixture: 'insee-rectangles_200m_menage_erbm.png',
}
)
cy.intercept(
'GET',
'/geoserver/insee/ows?SERVICE=WFS&REQUEST=GetFeature&VERSION=2.0.0&TYPENAMES=insee%3Arectangles_200m_menage_erbm&OUTPUTFORMAT=application%2Fjson*',
{
fixture: 'insee-rectangles_200m_menage_erbm.json',
}
)
cy.intercept(
'GET',
'/explore/dataset/population-millesimee-communes-francaises/download?format=csv&timezone=Europe/Berlin&use_labels_for_header=false',
{
fixture: 'population-millesimee-communes-francaises.csv',
}
)
})

describe('GENERAL : display & functions', () => {
Expand Down Expand Up @@ -115,7 +151,7 @@ describe('dataset pages', () => {
.find('gn-ui-expandable-panel')
})
})
describe('functionnalities', () => {
describe('features', () => {
let targetLink
let keyword
it('should go to provider website on click', () => {
Expand Down Expand Up @@ -200,7 +236,7 @@ describe('dataset pages', () => {
.children('div')
.eq(1)
.click()
cy.wait(5000)
cy.wait(1000)
cy.get('@prevSection').find('gn-ui-table').should('be.visible')
cy.get('@prevSection')
.find('gn-ui-table')
Expand All @@ -227,7 +263,7 @@ describe('dataset pages', () => {
})
})
})
describe('functionnalities', () => {
describe('features', () => {
it('MAP : should open a popup on layer click', () => {
cy.get('@prevSection').find('canvas').realClick()
cy.request({
Expand Down Expand Up @@ -309,8 +345,8 @@ describe('dataset pages', () => {
})
})
})
describe('functionnalities', () => {
it('filtrates the download list on format filter click', () => {
describe('features', () => {
it('filters the download list on format filter click', () => {
cy.get('gn-ui-data-downloads')
.find('gn-ui-button')
.children('button')
Expand Down Expand Up @@ -359,9 +395,8 @@ describe('dataset pages', () => {
.should('have.length.gt', 0)
})
})
describe('functionnalities', () => {
describe('features', () => {
it('goes to external link on click', () => {
let targetLink
cy.get('gn-ui-data-otherlinks')
.find('gn-ui-link-card')
.first()
Expand All @@ -371,9 +406,9 @@ describe('dataset pages', () => {
cy.get('@proviLink')
.invoke('attr', 'href')
.then((link) => {
targetLink = link
cy.get('@proviLink').invoke('removeAttr', 'target').click()
cy.url().should('include', targetLink)
expect(link).to.eq(
'https://www.data.gouv.fr/fr/datasets/donnees-carroyees-a-200-m-sur-la-population/'
)
})
})
it('copies the API path on click', () => {
Expand All @@ -382,11 +417,16 @@ describe('dataset pages', () => {
.find('button')
.first()
.click({ force: true })
cy.window().then((win) => {
win.navigator.clipboard.readText().then((text) => {
expect(text).to.eq('https://www.geo2france.fr/geoserver/insee/ows')
cy.get('body')
.click()
.window()
.then((win) => {
win.navigator.clipboard.readText().then((text) => {
expect(text).to.eq(
'https://www.geo2france.fr/geoserver/insee/ows'
)
})
})
})
})
it('goes to dataset on click', () => {
let targetLink
Expand Down
2 changes: 1 addition & 1 deletion apps/datahub-e2e/src/e2e/datasets.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ describe('datasets', () => {
const uniqueListOptions = [...new Set(listOptions)]

uniqueListOptions.forEach((item) => {
expect(dropdownOptions.includes(item)).to.be.true
expect(dropdownOptions).to.include(item)
})
})
})
Expand Down
4 changes: 2 additions & 2 deletions apps/datahub-e2e/src/e2e/organisations.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('organisations', () => {
})
})

describe('list functionnalities', () => {
describe('list features', () => {
let providerOrg
beforeEach(() => {
cy.get('[data-cy="providerDesc"]')
Expand All @@ -94,7 +94,7 @@ describe('organisations', () => {
})
})

describe('page toggle functionnalities', () => {
describe('page toggle features', () => {
let proviList = []
beforeEach(() => {
cy.get('gn-ui-organisations-sort')
Expand Down
4 changes: 0 additions & 4 deletions apps/datahub-e2e/src/fixtures/example.json

This file was deleted.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions apps/datahub-e2e/src/fixtures/insee-wfs-getcapabilities.xml

Large diffs are not rendered by default.

Loading

0 comments on commit 7def4d2

Please sign in to comment.