Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt at fixing flaky E2E tests #730

Merged
merged 4 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
18 changes: 8 additions & 10 deletions apps/datahub-e2e/src/e2e/datasetDetailPage.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'cypress-real-events'
import path from 'path'

describe('dataset pages', () => {
beforeEach(() => {
Expand Down Expand Up @@ -27,7 +28,7 @@ describe('dataset pages', () => {
)
cy.intercept(
'GET',
'/geoserver/insee/ows?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&FORMAT=image%2Fpng&TRANSPARENT=true&LAYERS=rectangles_200m_menage_erbm*',
'/geoserver/insee/ows?REQUEST=GetMap&SERVICE=WMS&VERSION=1.3.0&FORMAT=image%2Fpng&STYLES=&TRANSPARENT=true&LAYERS=rectangles_200m_menage_erbm*',
{
fixture: 'insee-rectangles_200m_menage_erbm.png',
}
Expand All @@ -43,7 +44,7 @@ describe('dataset pages', () => {
'GET',
'/geoserver/insee/ows?SERVICE=WFS&REQUEST=GetFeature&VERSION=2.0.0&TYPENAMES=insee%3Arectangles_200m_menage_erbm&OUTPUTFORMAT=csv',
{
fixture: 'population-millesimee-communes-francaises.csv',
fixture: 'insee-rectangles_200m_menage_erbm.csv',
}
)
cy.intercept(
Expand Down Expand Up @@ -373,19 +374,16 @@ describe('dataset pages', () => {
})
})
it('downloads a file on click', () => {
cy.intercept(
'GET',
'https://www.geo2france.fr/geoserver/insee/ows?SERVICE=WFS&REQUEST=GetFeature&VERSION=2.0.0&TYPENAMES=insee%3Arectangles_200m_menage_erbm&OUTPUTFORMAT=csv'
).as('downloadRequest')

cy.get('datahub-record-downloads')
.find('gn-ui-download-item')
.first()
.click()

cy.wait('@downloadRequest').then((interception) => {
expect(interception.response.statusCode).to.equal(200)
})
cy.readFile(path.join('cypress/downloads', 'ows.csv')).as(
'downloadedFile'
)
cy.get('@downloadedFile').should('exist')
cy.get('@downloadedFile').its('length').should('equal', 3579)
})
it('displays the full list after clicking two times on one filter', () => {
cy.get('datahub-record-downloads')
Expand Down
19 changes: 9 additions & 10 deletions apps/datahub-e2e/src/e2e/datasets.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'cypress-real-events'

describe('datasets', () => {
beforeEach(() => {
cy.clearCookies()
jahow marked this conversation as resolved.
Show resolved Hide resolved
cy.visit('/search')

// aliases
Expand Down Expand Up @@ -445,15 +444,15 @@ describe('datasets', () => {
.as('initialResultTitles')
cy.get('@sortBy').selectDropdownOption('desc,createDate')
})
it('changes the results order', () => {
cy.get('@initialResultTitles').then((initialResultTitles) => {
cy.get('@results')
.find('[data-cy="recordTitle"]')
.then(($titles) =>
$titles.toArray().map((title) => title.innerText.trim())
)
.should('not.eql', initialResultTitles)
})
it('changes the results order', function () {
cy.get('@results')
.find('[data-cy="recordTitle"]')
.then(($titles) => {
const titles = $titles
.toArray()
.map((title) => title.innerText.trim())
assert.notEqual(titles, this.initialResultTitles) // @initialResultTitles
jahow marked this conversation as resolved.
Show resolved Hide resolved
})
})
})
})
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
code_region;nom_de_la_region;code_departement;code_arrondissement;code_canton;code_commune;nom_de_la_commune;population_municipale;population_comptee_a_part;population_totale;annee_recensement;annee_utilisation;code_insee;superficie;statut;code_insee_commune;nom_com;nom_dep;nom_reg;epci;code_epci;libepci
32;Hauts-de-France;59;5;13;163;Croix;20927;293;21220;2014;2017;59163;4.5;Commune;59163;Croix;NORD;HAUTS-DE-FRANCE;245900410;245900410;CU Lille Métropole
31;Nord-Pas-de-Calais;59;5;04;173;Deûlémont;1685;20;1705;2013;2016;59173;9.96;Commune;59173;Deûlémont;NORD;HAUTS-DE-FRANCE;245900410;245900410;CU de Lille Métropole
31;Nord-Pas-de-Calais;59;5;02;303;Herlies;2319;40;2359;2013;2016;59303;7.08;Commune;59303;Herlies;NORD;HAUTS-DE-FRANCE;245900410;245900410;CU de Lille Métropole
31;Nord-Pas-de-Calais;59;5;22;356;Lompret;2305;55;2360;2013;2016;59356;3.13;Commune;59356;;;;245900410;245900410;CU de Lille Métropole
31;Nord-Pas-de-Calais;59;5;57;011;Annoeullin;10335;110;10445;2012;2015;59011;8.94;Commune;59011;Annœullin;NORD;HAUTS-DE-FRANCE;245901061;245901061;CC de la Haute Deûle
31;Nord-Pas-de-Calais;59;5;38;328;Lambersart;28435;347;28782;2012;2015;59328;6.07;Commune;59328;Lambersart;NORD;HAUTS-DE-FRANCE;245900410;245900410;CU de Lille Métropole
31;Nord-Pas-de-Calais;59;5;37;410;Mons-en-Baroeul;21272;167;21439;2012;2015;59410;2.9;Commune;59410;Mons-en-Barœul;NORD;HAUTS-DE-FRANCE;245900410;245900410;CU de Lille Métropole
32;Hauts-de-France;59;5;02;052;Bauvin;5279;57;5336;2015;2018;59052;3.9;Commune;59052;Bauvin;NORD;HAUTS-DE-FRANCE;245901061;245901061;CC de la Haute Deûle
32;Hauts-de-France;59;5;04;088;Bois-Grenier;1589;22;1611;2015;2018;59088;7.47;Commune;59088;Bois-Grenier;NORD;HAUTS-DE-FRANCE;245900816;245900816;CC des Weppes
32;Hauts-de-France;59;5;02;133;Carnin;975;19;994;2015;2018;59133;2.34;Commune;59133;Carnin;NORD;HAUTS-DE-FRANCE;245901061;245901061;CC de la Haute Deûle
32;Hauts-de-France;59;5;37;426;Neuville-en-Ferrain;10434;67;10501;2015;2018;59426;6.2;Commune;59426;Neuville-en-Ferrain;NORD;HAUTS-DE-FRANCE;245900410;245900410;Métropole Européenne de Lille
32;Hauts-de-France;59;5;18;609;Vendeville;1649;13;1662;2015;2018;59609;2.58;Commune;59609;Vendeville;NORD;HAUTS-DE-FRANCE;245900410;245900410;Métropole Européenne de Lille
32;Hauts-de-France;59;5;04;202;Erquinghem-Lys;5081;40;5121;2016;2019;59202;9.2;Commune;59202;Erquinghem-Lys;NORD;HAUTS-DE-FRANCE;245900410;245900410;Métropole Européenne de Lille
32;Hauts-de-France;59;5;18;316;Houplin-Ancoisne;3439;43;3482;2016;2019;59316;6.49;Commune;59316;Houplin-Ancoisne;NORD;HAUTS-DE-FRANCE;245900410;245900410;Métropole Européenne de Lille
32;Hauts-de-France;59;5;18;193;Emmerin;3173;26;3199;2015;2018;59193;4.99;Commune;59193;Emmerin;NORD;HAUTS-DE-FRANCE;245900410;245900410;Métropole Européenne de Lille
32;Hauts-de-France;59;5;22;611;Verlinghem;2445;56;2501;2016;2019;59611;10.15;Commune;59611;Verlinghem;NORD;HAUTS-DE-FRANCE;245900410;245900410;Métropole Européenne de Lille
31;Nord-Pas-de-Calais;59;5;04;017;Armentières;25978;398;26376;2013;2016;59017;6.23;Commune;59017;Armentières;NORD;HAUTS-DE-FRANCE;245900410;245900410;CU de Lille Métropole
31;Nord-Pas-de-Calais;59;5;02;025;Aubers;1536;38;1574;2013;2016;59025;10.09;Commune;59025;;;;245900816;245900816;CC des Weppes
32;Hauts-de-France;59;5;02;011;Annœullin;10325;114;10439;2014;2017;59011;8.94;Commune;59011;Annœullin;NORD;HAUTS-DE-FRANCE;245901061;245901061;CC de la Haute Deûle
32;Hauts-de-France;59;5;13;332;Lannoy;1778;9;1787;2014;2017;59332;0.17;Commune;59332;;;;245900410;245900410;CU Lille Métropole
Loading
Loading