diff --git a/.github/workflows/lodex-ci.yml b/.github/workflows/lodex-ci.yml index d6c2ae0a7..17cd38018 100644 --- a/.github/workflows/lodex-ci.yml +++ b/.github/workflows/lodex-ci.yml @@ -10,7 +10,7 @@ on: jobs: # Job use to create the test environment and run unit test suite test-unit: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 # Set a timeout of 10 mins timeout-minutes: 10 @@ -41,7 +41,7 @@ jobs: # Job use to create the test environment and run api e2e test suite test-api-e2e: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 # Set a timeout of 10 mins timeout-minutes: 10 @@ -71,7 +71,7 @@ jobs: # Job use to create the test environment and run e2e test suite test-e2e: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 # Set a timeout of 30 mins timeout-minutes: 30 diff --git a/cypress/e2e/book_summary.cy.js b/cypress/e2e/book_summary.cy.js deleted file mode 100644 index cf2a2edf9..000000000 --- a/cypress/e2e/book_summary.cy.js +++ /dev/null @@ -1,110 +0,0 @@ -import { teardown } from '../support/authentication'; -import * as datasetImportPage from '../support/datasetImportPage'; -import * as menu from '../support/menu'; -import * as bookSummary from '../support/bookSummary'; -import * as searchDrawer from '../support/searchDrawer'; - -describe('Book Summary Format', () => { - beforeEach(() => { - teardown(); - menu.openAdvancedDrawer(); - menu.goToAdminDashboard(); - datasetImportPage.importDataset('dataset/book.csv'); - datasetImportPage.importModel('model/book.json'); - datasetImportPage.publish(); - datasetImportPage.goToPublishedResources(); - }); - - describe('On Resource Page', () => { - const resourceTitle = 'MP. Molecular pathology'; - - beforeEach(() => { - menu.openSearchDrawer(); - searchDrawer.search(resourceTitle); - searchDrawer.findSearchResultByTitle(resourceTitle).click(); - }); - - it('should display list of year', () => { - bookSummary.checkYears([2003, 2002, 2001, 2000, 1999, 1998, 1997]); - bookSummary.openFold(1998); - bookSummary.checkVolumes(1998, [52]); - bookSummary.openFold('Volume: 52'); - bookSummary.checkIssues(1998, 52, [1, 2, 3, 4, 5, 6]); - - bookSummary.openFold('Issue: 3'); - bookSummary.checkDocuments(1998, 52, 3, [ - 'Cytochrome P450 CYP 1B1 mRNA in normal human brain.', - 'Absence of prolactin gene expression in colorectal cancer.', - 'Association of p53 genomic instability with the glutathione S-transferase null genotype in gastric cancer in the Portuguese population.', - 'Demystified ... DNA nucleotide sequencing.', - 'A simple method for PCR based analyses of immunohistochemically stained, microdissected, formalin fixed, paraffin wax embedded material.', - 'Proteolysis in colorectal cancer.', - 'Alterations in cadherin and catenin expression during the biological progression of melanocytic tumours.', - 'Use of magnetic beads for tissue DNA extraction and IS6110 Mycobacterium tuberculosis PCR.', - 'Molecular detection of c-mpl thrombopoietin receptor gene expression in chronic myeloproliferative disorders.', - 'Demystified ... gene knockouts.', - ]); - bookSummary.loadMore(); - bookSummary.checkDocuments(1998, 52, 3, [ - 'Cytochrome P450 CYP 1B1 mRNA in normal human brain.', - 'Absence of prolactin gene expression in colorectal cancer.', - 'Association of p53 genomic instability with the glutathione S-transferase null genotype in gastric cancer in the Portuguese population.', - 'Demystified ... DNA nucleotide sequencing.', - 'A simple method for PCR based analyses of immunohistochemically stained, microdissected, formalin fixed, paraffin wax embedded material.', - 'Proteolysis in colorectal cancer.', - 'Alterations in cadherin and catenin expression during the biological progression of melanocytic tumours.', - 'Use of magnetic beads for tissue DNA extraction and IS6110 Mycobacterium tuberculosis PCR.', - 'Molecular detection of c-mpl thrombopoietin receptor gene expression in chronic myeloproliferative disorders.', - 'Demystified ... gene knockouts.', - 'DNA repair gene status in oesophageal cancer.', - ]); - }); - - it('should allow to embed the summary into an external website', () => { - bookSummary.openEmbedDialog(); - cy.contains('embedded-istex-summary').should('exist'); - }); - }); - - describe('On Embedded Page', () => { - beforeEach(() => { - cy.visit('http://localhost:3000/tests/external/index.html'); - }); - - it('should display list of year', () => { - bookSummary.checkYears([2003, 2002, 2001, 2000, 1999, 1998, 1997]); - bookSummary.openFold(1998); - bookSummary.checkVolumes(1998, [52]); - bookSummary.openFold('Volume: 52'); - bookSummary.checkIssues(1998, 52, [1, 2, 3, 4, 5, 6]); - - bookSummary.openFold('Issue: 3'); - bookSummary.checkDocuments(1998, 52, 3, [ - 'Cytochrome P450 CYP 1B1 mRNA in normal human brain.', - 'Absence of prolactin gene expression in colorectal cancer.', - 'Association of p53 genomic instability with the glutathione S-transferase null genotype in gastric cancer in the Portuguese population.', - 'Demystified ... DNA nucleotide sequencing.', - 'A simple method for PCR based analyses of immunohistochemically stained, microdissected, formalin fixed, paraffin wax embedded material.', - 'Proteolysis in colorectal cancer.', - 'Alterations in cadherin and catenin expression during the biological progression of melanocytic tumours.', - 'Use of magnetic beads for tissue DNA extraction and IS6110 Mycobacterium tuberculosis PCR.', - 'Molecular detection of c-mpl thrombopoietin receptor gene expression in chronic myeloproliferative disorders.', - 'Demystified ... gene knockouts.', - ]); - bookSummary.loadMore(); - bookSummary.checkDocuments(1998, 52, 3, [ - 'Cytochrome P450 CYP 1B1 mRNA in normal human brain.', - 'Absence of prolactin gene expression in colorectal cancer.', - 'Association of p53 genomic instability with the glutathione S-transferase null genotype in gastric cancer in the Portuguese population.', - 'Demystified ... DNA nucleotide sequencing.', - 'A simple method for PCR based analyses of immunohistochemically stained, microdissected, formalin fixed, paraffin wax embedded material.', - 'Proteolysis in colorectal cancer.', - 'Alterations in cadherin and catenin expression during the biological progression of melanocytic tumours.', - 'Use of magnetic beads for tissue DNA extraction and IS6110 Mycobacterium tuberculosis PCR.', - 'Molecular detection of c-mpl thrombopoietin receptor gene expression in chronic myeloproliferative disorders.', - 'Demystified ... gene knockouts.', - 'DNA repair gene status in oesophageal cancer.', - ]); - }); - }); -}); diff --git a/cypress/e2e/chart_menu.cy.js b/cypress/e2e/chart_menu.cy.js deleted file mode 100644 index 1044aed3f..000000000 --- a/cypress/e2e/chart_menu.cy.js +++ /dev/null @@ -1,39 +0,0 @@ -import { teardown } from '../support/authentication'; -import * as datasetImportPage from '../support/datasetImportPage'; -import * as menu from '../support/menu'; - -describe('Chart Menu', () => { - beforeEach(() => { - teardown(); - menu.openAdvancedDrawer(); - menu.goToAdminDashboard(); - datasetImportPage.importDataset('dataset/chart.csv'); - datasetImportPage.importModel('model/chart.json'); - datasetImportPage.publish(); - datasetImportPage.goToPublishedResources(); - }); - - it('should display chart menu with list of all chart', () => { - menu.openChartDrawer(); - const charts = [ - 'Bar Chart', - 'Bubble Chart', - 'Pie Chart', - 'Radar Chart', - ]; - const chartMenu = cy.get('.graph-summary'); - charts.forEach(chartName => { - chartMenu - .get(`.graph-link`) - .contains(chartName) - .should('be.visible'); - }); - - menu.goToChart('Pie Chart'); - - menu.openChartDrawer(); - cy.get(`.graph-link.active`) - .contains('Pie Chart') - .should('be.visible'); - }); -}); diff --git a/cypress/e2e/enrichment.cy.js b/cypress/e2e/enrichment.cy.js deleted file mode 100644 index 75ee5793c..000000000 --- a/cypress/e2e/enrichment.cy.js +++ /dev/null @@ -1,26 +0,0 @@ -import { teardown } from '../support/authentication'; -import * as menu from '../support/menu'; -import * as adminNavigation from '../support/adminNavigation'; -import * as datasetImportPage from '../support/datasetImportPage'; -import * as enrichmentFormPage from '../support/enrichmentFormPage'; - -describe('Enrichment', () => { - beforeEach(teardown); - - describe('Advanced enrichment', () => { - it('should add an advanced enrichment', () => { - menu.openAdvancedDrawer(); - menu.goToAdminDashboard(); - cy.wait(300); - - datasetImportPage.addFile('dataset/simple.csv'); - enrichmentFormPage.openEnrichment(); - cy.wait(300); - enrichmentFormPage.fillAdvancedEnrichment(); - enrichmentFormPage.runEnrichment(); - adminNavigation.goToData(); - cy.wait(300); - enrichmentFormPage.checkIfEnrichmentExistInDataset(); - }); - }); -}); diff --git a/cypress/e2e/formats.cy.js b/cypress/e2e/formats.cy.js deleted file mode 100644 index fd408dd6d..000000000 --- a/cypress/e2e/formats.cy.js +++ /dev/null @@ -1,121 +0,0 @@ -import { teardown, logoutAndLoginAs } from '../support/authentication'; -import * as menu from '../support/menu'; -import * as datasetImportPage from '../support/datasetImportPage'; -import * as adminNavigation from '../support/adminNavigation'; - -describe('Transformers & Formats', () => { - beforeEach(teardown); - - describe('LIST format', () => { - it('should display a composed field with a LIST format', () => { - menu.openAdvancedDrawer(); - menu.goToAdminDashboard(); - - datasetImportPage.importDataset('dataset/simple.csv'); - - adminNavigation.goToDisplay(); - cy.get('.sidebar') - .contains('Main resource') - .click(); - - datasetImportPage.addColumn('Column 1', { - composedOf: ['Column 1', 'Column 2'], - display: { - format: 'list', - }, - searchable: true, - syndication: 1, - }); - - datasetImportPage.publish(); - - datasetImportPage.goToPublishedResources(); - menu.openSearchDrawer(); - - cy.contains('Row 1').should('be.visible'); - cy.contains('Row 2').should('be.visible'); - }); - }); - - describe('Broken Formats & Wrong Values', () => { - beforeEach(() => { - menu.openAdvancedDrawer(); - menu.goToAdminDashboard(); - - datasetImportPage.importDataset('dataset/broken-formats.csv'); - datasetImportPage.importModel('model/broken-formats.json'); - datasetImportPage.publish(); - - cy.visit('http://localhost:3000/uid:/wrong'); - }); - - describe('As Admin', () => { - describe('when we have a single value but want a list', () => { - it('should display an error message describing the issue and allow to fix the value for wrong list format', () => { - cy.get('.detail') - .find('.property') - .should('have.length', 2); - - cy.get('.detail') - .find('.invalid-format') - .should('have.length', 2); - cy.get( - '.format_markdown [data-testid="SettingsIcon"]', - ).should('exist'); - }); - - it('should display an error message describing the issue and changing the format should fix it', () => { - cy.get('.detail') - .find('.property') - .should('have.length', 2); - - cy.get('.detail') - .find('.invalid-format') - .should('have.length', 2); - }); - }); - - describe('when we want a list but have a single value', () => { - it('should display an error message describing the issue and allow to fix the value for wrong markdown format', () => { - cy.get('.detail') - .find('.property') - .should('have.length', 2); - - cy.get('.detail') - .find('.invalid-format') - .should('have.length', 2); - - cy.get('.format_list [data-testid="SettingsIcon"]').should( - 'exist', - ); - }); - - it('should display an error message describing the issue', () => { - cy.get('.detail') - .find('.property') - .should('have.length', 2); - - cy.get('.detail') - .find('.invalid-format') - .should('have.length', 2); - }); - }); - }); - - describe('As User', () => { - it('should not display broken fields or error messages', () => { - logoutAndLoginAs('user'); - - cy.visit('http://localhost:3000/uid:/wrong'); - - cy.get('.detail') - .find('.property') - .should('have.length', 0); - - cy.get('.detail') - .find('.invalid-format') - .should('have.length', 0); - }); - }); - }); -}); diff --git a/cypress/e2e/hiding_value.cy.js b/cypress/e2e/hiding_value.cy.js deleted file mode 100644 index 150c2ce68..000000000 --- a/cypress/e2e/hiding_value.cy.js +++ /dev/null @@ -1,60 +0,0 @@ -import { teardown, logoutAndLoginAs } from '../support/authentication'; -import * as menu from '../support/menu'; -import * as datasetImportPage from '../support/datasetImportPage'; -import * as searchDrawer from '../support/searchDrawer'; -import * as adminNavigation from '../support/adminNavigation'; - -describe('hiding null value to user', () => { - const dataset = 'dataset/simple.csv'; - const model = 'model/simple.json'; - - before(() => { - teardown(); - menu.openAdvancedDrawer(); - menu.goToAdminDashboard(); - - datasetImportPage.importDataset(dataset); - datasetImportPage.importModel(model); - datasetImportPage.publish(); - datasetImportPage.goToPublishedResources(); - }); - - it('admin should be able hide field to user by setting it to null', () => { - menu.openSearchDrawer(); - searchDrawer.goToResourceNumber(1); - cy.get('.detail') - .find('.property') - .should('have.length', 2); - - cy.get('.column1 h3').contains('Row 1'); - cy.get('.column2').contains('Test 1'); - cy.get('.column2 [data-testid="SettingsIcon"]').should('exist'); - - menu.openAdvancedDrawer(); - menu.goToAdminDashboard(); - adminNavigation.goToDisplay(); - cy.get('.sidebar') - .contains('Main resource') - .click(); - - cy.wait(1000); - cy.get('.react-grid-item') - .eq(1) - .click(15, 40, { force: true }); - - cy.get('#tab-display').click(); - cy.contains('Visible').click(); - cy.get('.btn-save').click(); - cy.get('.go-published-button', { timeout: 1000 }).click(); - - logoutAndLoginAs('user'); - menu.openSearchDrawer(); - searchDrawer.goToResourceNumber(1); - cy.get('.detail') - .find('.property') - .should('have.length', 1); - - cy.get('.column1').should('be.visible'); - cy.get('.column2').should('not.exist'); - }); -}); diff --git a/cypress/e2e/home_page.cy.js b/cypress/e2e/home_page.cy.js deleted file mode 100644 index c1e2fb56a..000000000 --- a/cypress/e2e/home_page.cy.js +++ /dev/null @@ -1,38 +0,0 @@ -import { teardown } from '../support/authentication'; -import * as datasetImportPage from '../support/datasetImportPage'; -import * as menu from '../support/menu'; -import * as graphPage from '../support/graphPage'; -import * as homePage from '../support/homePage'; - -describe('Home Page', () => { - beforeEach(() => { - teardown(); - menu.openAdvancedDrawer(); - menu.goToAdminDashboard(); - - datasetImportPage.importDataset('dataset/film.csv'); - datasetImportPage.importModel('model/film.json'); - datasetImportPage.publish(); - datasetImportPage.goToPublishedResources(); - }); - - // @todo: Fix it after mid-sprint presentation - it.skip('should not use the facets to filter the home page formats', () => { - menu.openChartDrawer(); - menu.goToChart('Répartition par réalisateurs'); - - graphPage.getStats().should('have.text', 'Found 30 on 30'); - graphPage.searchFor('Lucas'); - graphPage.getStats().should('have.text', 'Found 4 on 30'); - - menu.goToHomePage(); - homePage.checkCharacteristicsOrder([ - 'Dataset Name', - 'Dataset Description', - 'Nombre de films', - 'Liste des films', - //TODO with Graph Links 'Répartition par réalisateurs', - ]); - homePage.checkCharacteristic('mzm2', '30'); - }); -}); diff --git a/cypress/e2e/login.cy.js b/cypress/e2e/login.cy.js deleted file mode 100644 index 5cd8e61b0..000000000 --- a/cypress/e2e/login.cy.js +++ /dev/null @@ -1,37 +0,0 @@ -import { teardown, login } from '../support/authentication'; -import * as datasetImportPage from '../support/datasetImportPage'; -import * as loginPage from '../support/loginPage'; -import * as menu from '../support/menu'; - -describe('Login', () => { - beforeEach(() => { - teardown(true); - }); - - it('should successfully login as an admin', () => { - login(); - cy.contains('No data published').should('be.visible'); - }); - - it('should successfully sign out and go to login page', () => { - login(); - menu.openAdvancedDrawer(); - menu.goToAdminDashboard(); - - datasetImportPage.importDataset('dataset/chart.csv'); - datasetImportPage.importModel('model/chart.json'); - datasetImportPage.publish(); - datasetImportPage.goToPublishedResources(); - - menu.openAdvancedDrawer(); - menu.signOut(); - - cy.visit('http://localhost:3000'); - cy.wait(300); - menu.openAdvancedDrawer(); - menu.openChartDrawer(); - menu.clickOnChart('Pie Chart'); - - loginPage.checkLoginPage(); - }); -}); diff --git a/cypress/integration/phase_1/home_page.spec.js b/cypress/e2e/phase_1/home_page.cy.js similarity index 100% rename from cypress/integration/phase_1/home_page.spec.js rename to cypress/e2e/phase_1/home_page.cy.js diff --git a/cypress/integration/phase_1/publication.spec.js b/cypress/e2e/phase_1/publication.cy.js similarity index 100% rename from cypress/integration/phase_1/publication.spec.js rename to cypress/e2e/phase_1/publication.cy.js diff --git a/cypress/integration/phase_1/subresource.spec.js b/cypress/e2e/phase_1/subresource.cy.js similarity index 100% rename from cypress/integration/phase_1/subresource.spec.js rename to cypress/e2e/phase_1/subresource.cy.js diff --git a/cypress/integration/phase_2/book_summary.spec.js b/cypress/e2e/phase_2/book_summary.cy.js similarity index 100% rename from cypress/integration/phase_2/book_summary.spec.js rename to cypress/e2e/phase_2/book_summary.cy.js diff --git a/cypress/integration/phase_2/chart_menu.spec.js b/cypress/e2e/phase_2/chart_menu.cy.js similarity index 100% rename from cypress/integration/phase_2/chart_menu.spec.js rename to cypress/e2e/phase_2/chart_menu.cy.js diff --git a/cypress/integration/phase_2/enrichment.spec.js b/cypress/e2e/phase_2/enrichment.cy.js similarity index 100% rename from cypress/integration/phase_2/enrichment.spec.js rename to cypress/e2e/phase_2/enrichment.cy.js diff --git a/cypress/integration/phase_2/formats.spec.js b/cypress/e2e/phase_2/formats.cy.js similarity index 100% rename from cypress/integration/phase_2/formats.spec.js rename to cypress/e2e/phase_2/formats.cy.js diff --git a/cypress/integration/phase_3/hiding_value.spec.js b/cypress/e2e/phase_3/hiding_value.cy.js similarity index 100% rename from cypress/integration/phase_3/hiding_value.spec.js rename to cypress/e2e/phase_3/hiding_value.cy.js diff --git a/cypress/integration/phase_3/login.spec.js b/cypress/e2e/phase_3/login.cy.js similarity index 100% rename from cypress/integration/phase_3/login.spec.js rename to cypress/e2e/phase_3/login.cy.js diff --git a/cypress/e2e/search.cy.js b/cypress/e2e/phase_3/search.cy.js similarity index 97% rename from cypress/e2e/search.cy.js rename to cypress/e2e/phase_3/search.cy.js index 535ac8e66..dde2fcf29 100644 --- a/cypress/e2e/search.cy.js +++ b/cypress/e2e/phase_3/search.cy.js @@ -1,7 +1,7 @@ -import { teardown } from '../support/authentication'; -import * as menu from '../support/menu'; -import * as datasetImportPage from '../support/datasetImportPage'; -import * as searchDrawer from '../support/searchDrawer'; +import { teardown } from '../../support/authentication'; +import * as menu from '../../support/menu'; +import * as datasetImportPage from '../../support/datasetImportPage'; +import * as searchDrawer from '../../support/searchDrawer'; const initSearchDataset = ( dataset = 'dataset/book_summary.csv', diff --git a/cypress/e2e/graph_page.cy.js b/cypress/e2e/phase_4/graph_page.cy.js similarity index 91% rename from cypress/e2e/graph_page.cy.js rename to cypress/e2e/phase_4/graph_page.cy.js index f0ddfcb4d..c293f1da1 100644 --- a/cypress/e2e/graph_page.cy.js +++ b/cypress/e2e/phase_4/graph_page.cy.js @@ -1,8 +1,8 @@ -import { teardown } from '../support/authentication'; -import * as datasetImportPage from '../support/datasetImportPage'; -import * as menu from '../support/menu'; -import * as graphPage from '../support/graphPage'; -import * as searchDrawer from '../support/searchDrawer'; +import { teardown } from '../../support/authentication'; +import * as datasetImportPage from '../../support/datasetImportPage'; +import * as menu from '../../support/menu'; +import * as graphPage from '../../support/graphPage'; +import * as searchDrawer from '../../support/searchDrawer'; describe('Graph Page', () => { beforeEach(() => { diff --git a/cypress/e2e/model.cy.js b/cypress/e2e/phase_4/model.cy.js similarity index 90% rename from cypress/e2e/model.cy.js rename to cypress/e2e/phase_4/model.cy.js index b4356db10..dc5110456 100644 --- a/cypress/e2e/model.cy.js +++ b/cypress/e2e/phase_4/model.cy.js @@ -1,8 +1,8 @@ -import { teardown } from '../support/authentication'; -import * as datasetImportPage from '../support/datasetImportPage'; -import * as menu from '../support/menu'; -import * as homePage from '../support/homePage'; -import * as searchDrawer from '../support/searchDrawer'; +import { teardown } from '../../support/authentication'; +import * as datasetImportPage from '../../support/datasetImportPage'; +import * as menu from '../../support/menu'; +import * as homePage from '../../support/homePage'; +import * as searchDrawer from '../../support/searchDrawer'; describe('Model Page', () => { describe('handling old models', () => { diff --git a/cypress/e2e/publication.cy.js b/cypress/e2e/publication.cy.js deleted file mode 100644 index 4df4ac67b..000000000 --- a/cypress/e2e/publication.cy.js +++ /dev/null @@ -1,510 +0,0 @@ -import { teardown } from '../support/authentication'; -import * as menu from '../support/menu'; -import * as datasetImportPage from '../support/datasetImportPage'; -import * as adminNavigation from '../support/adminNavigation'; - -describe('Dataset Publication', () => { - beforeEach(teardown); - - describe('Dataset Import', () => { - it('should get the list of possible loaders', () => { - menu.openAdvancedDrawer(); - menu.goToAdminDashboard(); - cy.wait(300); - datasetImportPage.addFileWithoutClick('dataset/simple.csv'); - - datasetImportPage.checkListOfSupportedFileFormats(); - datasetImportPage.checkListOfFiltererFileFormats(); - }); - - it('should receive a csv file and preview its data in a table', () => { - menu.openAdvancedDrawer(); - menu.goToAdminDashboard(); - cy.wait(300); - datasetImportPage.importDataset('dataset/simple.csv'); - cy.wait(300); - cy.get('[data-rowindex=0]', { timeout: 500 }).should( - 'contains.text', - ['"1"', '"Row 1"', '"Test 1"'].join(''), - ); - - cy.get('[data-rowindex=1]').should( - 'contains.text', - ['"2"', '"Row 2"', '"Test 2"'].join(''), - ); - }); - - it('should display a information popup when adding a second dataset', () => { - menu.openAdvancedDrawer(); - menu.goToAdminDashboard(); - cy.wait(300); - datasetImportPage.importDataset('dataset/simple.csv'); - cy.wait(1000); - cy.contains('Add more', { timeout: 1500 }).click(); - - cy.wait(300); - datasetImportPage.importOtherDataset('dataset/simple.csv'); - cy.wait(500); - - cy.get('[data-rowindex=1]').should( - 'contains.text', - ['"2"', '"Row 2"', '"Test 2"'].join(''), - ); - }); - }); - describe('Dataset Sorting', () => { - it('should by default sort by uri asc', () => { - menu.openAdvancedDrawer(); - menu.goToAdminDashboard(); - cy.wait(300); - datasetImportPage.importDataset('dataset/simpleForOrderTests.csv'); - - cy.get('[data-rowindex=0]', { timeout: 3000 }).should( - 'contains.text', - ['"1"', '"Bobby"', '"Womack"'].join(''), - ); - }); - - it('should sort by firstName asc when clicking one time on it', () => { - menu.openAdvancedDrawer(); - menu.goToAdminDashboard(); - cy.wait(300); - datasetImportPage.importDataset('dataset/simpleForOrderTests.csv'); - - cy.get( - '[role=columnheader][data-field=firstName] [aria-label=Sort]', - { - timeout: 500, - }, - ).click({ force: true }); - - cy.get('[data-rowindex=0]', { timeout: 3000 }).should( - 'contains.text', - ['"2"', '"Alain"', '"Chabat"'].join(''), - ); - }); - - it('should sort by firstName desc when clicking two times on it', () => { - menu.openAdvancedDrawer(); - menu.goToAdminDashboard(); - cy.wait(300); - datasetImportPage.importDataset('dataset/simpleForOrderTests.csv'); - - cy.get( - '[role=columnheader][data-field=firstName] [aria-label=Sort]', - { - timeout: 500, - }, - ).click({ force: true }); - cy.get( - '[role=columnheader][data-field=firstName] [aria-label=Sort]', - { - timeout: 500, - }, - ).click({ force: true }); - - cy.get('[data-rowindex=0]', { timeout: 3000 }).should( - 'contains.text', - ['"4"', '"Rob"', '"Zombie"'].join(''), - ); - }); - }); - describe('Dataset Filtering', () => { - it('should filter by uri', () => { - menu.openAdvancedDrawer(); - menu.goToAdminDashboard(); - cy.wait(300); - datasetImportPage.importDataset( - 'dataset/simpleForFilterTests.json', - ); - cy.get('[role=columnheader][data-field=uri] [aria-label=Menu]', { - timeout: 500, - }).click({ force: true }); - cy.get('[role=menu] :nth-child(4)').click(); - cy.focused().type('2'); - - cy.get('[data-rowindex=0]', { timeout: 3000 }).should( - 'contains.text', - ['2', '"Alain"', '"Chabat"', 'true'].join(''), - ); - }); - it('should filter by firstName', () => { - menu.openAdvancedDrawer(); - menu.goToAdminDashboard(); - cy.wait(300); - datasetImportPage.importDataset( - 'dataset/simpleForFilterTests.json', - ); - cy.get( - '[role=columnheader][data-field=firstName] [aria-label=Menu]', - { - timeout: 500, - }, - ).click({ force: true }); - cy.wait(100); - cy.get('[role=menu] :nth-child(4)').click({ force: true }); - cy.focused().type('b'); - - cy.get('[data-rowindex=0]', { timeout: 3000 }).should( - 'contains.text', - ['1', '"Bobby"', '"Womack"', 'true'].join(''), - ); - - cy.get('[data-rowindex=1]', { timeout: 3000 }).should( - 'contains.text', - ['4', '"Rob"', '"Zombie"', 'false'].join(''), - ); - }); - it('should filter by boolean', () => { - menu.openAdvancedDrawer(); - menu.goToAdminDashboard(); - cy.wait(300); - datasetImportPage.importDataset( - 'dataset/simpleForFilterTests.json', - ); - cy.get( - '[role=columnheader][data-field=boolean] [aria-label=Menu]', - { - timeout: 500, - }, - ).click({ force: true }); - cy.get('[role=menu] :nth-child(4)').click(); - cy.focused().select('true'); - - cy.get('[data-rowindex=0]', { timeout: 3000 }).should( - 'contains.text', - ['1', '"Bobby"', '"Womack"', 'true'].join(''), - ); - - cy.get('[data-rowindex=1]', { timeout: 3000 }).should( - 'contains.text', - ['2', '"Alain"', '"Chabat"', 'true'].join(''), - ); - }); - }); - - describe('Transformers upsert', () => { - it('should allow to add and update transformers', () => { - menu.openAdvancedDrawer(); - menu.goToAdminDashboard(); - datasetImportPage.importDataset('dataset/simple.csv'); - datasetImportPage.importModel('model/simple.json'); - - adminNavigation.goToDisplay(); - cy.get('.sidebar') - .contains('Main resource') - .click(); - - cy.contains('New field').click(); - cy.get('.wizard', { timeout: 10000 }).should('be.visible'); - cy.wait(1000); - - cy.contains('Arbitrary value').click(); - cy.contains('Add an operation').click(); - - cy.get('[aria-label="Select an operation"]').click(); - cy.contains('BOOLEAN').click(); - cy.contains('confirm').click(); - - cy.get('[aria-label="transformer-edit-transformers[1]').click(); - cy.get('[aria-label="Select an operation"]').click(); - cy.contains('GET').click(); - cy.get('input[placeholder="path"]').type('example'); - cy.contains('confirm').click(); - cy.contains('GET'); - cy.contains('example'); - cy.get('.btn-save').click(); - cy.get('.wizard').should('not.exist'); - }); - - it('should keep transformers when changing source value', () => { - menu.openAdvancedDrawer(); - menu.goToAdminDashboard(); - datasetImportPage.importDataset('dataset/simple.csv'); - datasetImportPage.importModel('model/simple.json'); - - adminNavigation.goToDisplay(); - cy.get('.sidebar') - .contains('Main resource') - .click(); - - cy.contains('New field').click(); - cy.get('.wizard', { timeout: 10000 }).should('be.visible'); - cy.wait(1000); - - cy.contains('Arbitrary value').click(); - cy.get('textarea[placeholder="Enter an arbitrary value"]').type( - 'test', - ); - - cy.contains('Add an operation').click(); - - cy.get('[aria-label="Select an operation"]').click(); - cy.contains('UPPERCASE').click(); - cy.contains('confirm').click(); - - cy.get('textarea[placeholder="Enter an arbitrary value"]').type( - 'updated', - ); - cy.contains('UPPERCASE').should('be.visible'); - - cy.contains('Existing Column(s)').click(); - cy.get('[data-testid="source-value-from-columns"]').click(); - cy.get('[role="listbox"]') - .contains('Column 1') - .click(); - cy.contains('UPPERCASE').should('be.visible'); - - cy.get('[data-testid="source-value-from-columns"]').click(); - cy.get('[role="listbox"]') - .contains('Column 2') - .click(); - cy.contains('UPPERCASE').should('be.visible'); - - cy.get('.btn-save').click(); - cy.get('.wizard').should('not.exist'); - }); - - it('should remove transformers when clicking on delete all', () => { - menu.openAdvancedDrawer(); - menu.goToAdminDashboard(); - datasetImportPage.importDataset('dataset/simple.csv'); - datasetImportPage.importModel('model/simple.json'); - - adminNavigation.goToDisplay(); - cy.get('.sidebar') - .contains('Main resource') - .click(); - - cy.contains('New field').click(); - cy.get('.wizard', { timeout: 10000 }).should('be.visible'); - cy.wait(1000); - - cy.contains('Arbitrary value').click(); - cy.get('textarea[placeholder="Enter an arbitrary value"]').type( - 'test', - ); - - cy.contains('Add an operation').click(); - cy.get('[aria-label="Select an operation"]').click(); - cy.contains('UPPERCASE').click(); - cy.contains('confirm').click(); - - cy.contains('Add an operation').click(); - cy.get('[aria-label="Select an operation"]').click(); - cy.contains('SUFFIX').click(); - cy.get('input[placeholder="with"]').type('suffix'); - cy.contains('confirm').click(); - - cy.contains('UPPERCASE').should('be.visible'); - cy.contains('SUFFIX').should('be.visible'); - - cy.contains('Delete all').click(); - cy.get('.confirm-delete-all').click(); - cy.contains('UPPERCASE').should('not.exist'); - cy.contains('SUFFIX').should('not.exist'); - - cy.get('.btn-save').click(); - cy.get('.wizard').should('not.exist'); - }); - }); - - describe('Publication', () => { - it('should display a disabled publish button if no model', () => { - menu.openAdvancedDrawer(); - menu.goToAdminDashboard(); - datasetImportPage.importDataset('dataset/simple.csv'); - adminNavigation.goToDisplay(); - cy.get('.btn-publish button', { timeout: 300 }).should( - 'be.disabled', - ); - }); - - it('should enable publish button if model', () => { - menu.openAdvancedDrawer(); - menu.goToAdminDashboard(); - datasetImportPage.importDataset('dataset/simple.csv'); - adminNavigation.goToDisplay(); - cy.get('.sidebar') - .contains('Main resource') - .click(); - - datasetImportPage.addColumn('Column 1'); - cy.get('.btn-publish button', { timeout: 300 }).should( - 'not.be.disabled', - ); - }); - - it('should publish dataset by manually adding columns', () => { - menu.openAdvancedDrawer(); - menu.goToAdminDashboard(); - datasetImportPage.importDataset('dataset/simple.csv'); - adminNavigation.goToDisplay(); - - cy.get('.sidebar') - .contains('Main resource') - .click(); - - datasetImportPage.addColumn('Column 1'); - - cy.contains('button', 'Published data').click(); - - cy.get('.publication-excerpt') - .contains('Row 1') - .should('be.visible'); - cy.get('.publication-excerpt') - .contains('Row 2') - .should('be.visible'); - - datasetImportPage.publish(); - datasetImportPage.goToPublishedResources(); - }); - - it('should publish dataset by importing an existing model', () => { - menu.openAdvancedDrawer(); - menu.goToAdminDashboard(); - datasetImportPage.importDataset('dataset/simple.csv'); - datasetImportPage.importModel('model/concat.json'); - - adminNavigation.goToDisplay(); - cy.get('.sidebar') - .contains('Main resource') - .click(); - - cy.contains('button', 'Published data').click(); - - cy.contains('["Row 1","Test 1"]').should('be.visible'); - cy.contains('["Row 2","Test 2"]').should('be.visible'); - - datasetImportPage.publish(); - datasetImportPage.goToPublishedResources(); - menu.openSearchDrawer(); - - cy.get('.search-result-title') - .contains('Row 1') - .should('be.visible'); - cy.get('.search-result-title') - .contains('Row 2') - .should('be.visible'); - }); - - it('should allow to fix obsolete imported model before publish dataset', () => { - menu.openAdvancedDrawer(); - menu.goToAdminDashboard(); - datasetImportPage.importDataset('dataset/simple.csv'); - datasetImportPage.importModel('model/concat-obsolete.json'); - - cy.get('.validation-button').click(); - cy.contains('Operation UNKNOWN-OPERATION does not exist').click(); - - datasetImportPage.setOperationTypeInWizard('BOOLEAN'); - datasetImportPage.publish(); - }); - - it('should allow to load a file multiple times', () => { - menu.openAdvancedDrawer(); - menu.goToAdminDashboard(); - datasetImportPage.importDataset('dataset/simple.csv'); - cy.wait(500); - datasetImportPage.importModel('model/concat.json'); - datasetImportPage.publish(); - cy.wait(3000); - cy.log('import 1'); - datasetImportPage.importMoreDataset('dataset/simplewithouturi.csv'); - - cy.log('go to published resource'); - datasetImportPage.goToPublishedResources(); - - cy.log('Open searchDrawer'); - menu.openSearchDrawer(); - cy.get('.search-result-link').should('have.length', 4); - }); - }); - - describe('Facets', () => { - it('should allow to have a facet with a single value', () => { - menu.openAdvancedDrawer(); - menu.goToAdminDashboard(); - datasetImportPage.importDataset('dataset/single-facet.csv'); - datasetImportPage.importModel('model/facet.json'); - datasetImportPage.publish(); - - datasetImportPage.goToPublishedResources(); - menu.openSearchDrawer(); - - cy.contains('Affiliation(s)').click(); - cy.get('.search-facets') - .find('.facet-item') - .should('have.length', 1); - - cy.get('.search-facets') - .find('.facet-value-item') - .should('have.length', 1); - }); - - it('should allow to have facets with multiples values in them', () => { - menu.openAdvancedDrawer(); - menu.goToAdminDashboard(); - datasetImportPage.importDataset('dataset/multiple-facet.csv'); - datasetImportPage.importModel('model/facet.json'); - datasetImportPage.publish(); - - datasetImportPage.goToPublishedResources(); - menu.openSearchDrawer(); - - cy.contains('Affiliation(s)').click(); - cy.get('.search-facets') - .find('.facet-item') - .should('have.length', 1); - - cy.get('.search-facets') - .find('.facet-value-item') - .should('have.length', 3); - }); - }); - describe('Automatic Publication', () => { - it('should re-publish dataset when updating field', () => { - menu.openAdvancedDrawer(); - menu.goToAdminDashboard(); - datasetImportPage.importDataset('dataset/book_summary.csv'); - datasetImportPage.importModel('model/book_summary.json'); - datasetImportPage.publish(); - adminNavigation.goToResourcePage(); - cy.wait(2000); - cy.get('[aria-label="Title"]', { timeout: 3000 }) - .eq(0) - .click({ - force: true, - }); - cy.get('.btn-save').click(); - - cy.get('[aria-label="job-progress"]', { timeout: 3000 }).should( - 'have.css', - 'opacity', - '1', - ); - }); - it('should re-publish dataset when deleting field', () => { - menu.openAdvancedDrawer(); - menu.goToAdminDashboard(); - datasetImportPage.importDataset('dataset/book_summary.csv'); - datasetImportPage.importModel('model/book_summary.json'); - datasetImportPage.publish(); - adminNavigation.goToResourcePage(); - cy.wait(2000); - cy.get('[aria-label="Title"]', { timeout: 3000 }) - .eq(0) - .click({ - force: true, - }); - cy.contains('Remove').click({ force: true }); - cy.contains('Accept').click({ force: true }); - - cy.get('[aria-label="job-progress"]', { timeout: 3000 }).should( - 'have.css', - 'opacity', - '1', - ); - }); - }); -}); diff --git a/cypress/e2e/subresource.cy.js b/cypress/e2e/subresource.cy.js deleted file mode 100644 index 87be8b110..000000000 --- a/cypress/e2e/subresource.cy.js +++ /dev/null @@ -1,210 +0,0 @@ -import { teardown } from '../support/authentication'; -import * as menu from '../support/menu'; -import * as navigationPage from '../support/adminNavigation'; -import * as datasetImportPage from '../support/datasetImportPage'; -import * as subresourcePage from '../support/subresource'; -import * as searchDrawer from '../support/searchDrawer'; - -describe('Subresource Page', () => { - beforeEach(() => { - teardown(); - menu.openAdvancedDrawer(); - menu.goToAdminDashboard(); - datasetImportPage.importDataset('dataset/subresources-data.json'); - navigationPage.goToDisplay(); - - cy.get('.sidebar') - .contains('Subresources') - .click(); - }); - - it('should allow to add a subresource', () => { - subresourcePage.createSubresource(); - }); - - it('should allow to add a subresource field', () => { - subresourcePage.createSubresource(); - subresourcePage.addField('name', 'myField', false); - - cy.get('.wizard') - .find('#value-preview') - .each((item, index) => { - cy.wrap(item).should( - 'contain.text', - ['Canidae', 'Felinae', 'Canidae'][index], - ); - }); - - cy.get('.wizard') - .find('.btn-save') - .click(); - - cy.get('.wizard', { timeout: 2000 }).should('not.exist'); - - cy.contains('button', 'Published data').click(); - cy.contains('.publication-excerpt-column', 'myField').should('exist'); - }); - - it('should successfully publish subresources', () => { - subresourcePage.createSubresource(); - subresourcePage.addField('name', 'myField'); - - navigationPage.publishAndGoToPublishedData(); - }); - - it('should allow to create link to subresource', () => { - subresourcePage.createSubresource(); - subresourcePage.addField('name', 'myField'); - - cy.get('.sidebar') - .contains('a', 'Main resource') - .click(); - - cy.url().should('contain', '/display/document/main'); - cy.wait(200); // fix unexpected refresh after page change - - cy.contains('New field').click(); - cy.get('.wizard', { timeout: 10000 }).should('be.visible'); - cy.get('.wizard') - .find(`input[name="label"]`) - .clear() - .type('Resource field'); - - cy.contains('From Subresource').click(); - - cy.get('#tab-display').click(); - - datasetImportPage.fillTabDisplayFormat('link'); - - cy.get('.wizard') - .find('.btn-save') - .click(); - - cy.get('.wizard').should('not.exist'); - - datasetImportPage.addColumn('name', { syndication: 1 }); - - cy.get('.sidebar') - .contains('Search & Facet') - .click(); - cy.get('[data-testid="autocomplete_search_in_fields"]').click(); - cy.get('[role="listbox"]') - .contains('Resource field') - .click(); - - navigationPage.publishAndGoToPublishedData(); - - menu.openSearchDrawer(); - searchDrawer.findSearchResultByTitle('Publication n°1').click(); - - cy.location('pathname').should('not.equal', '/'); - }); - - it('should allow to create named link to subresource', () => { - subresourcePage.createSubresource(); - subresourcePage.addField('name', 'Name'); - - cy.contains('button', 'Published data').click(); - cy.contains('.publication-excerpt-column', 'Name').should('exist'); - - cy.get('.sidebar') - .contains('a', 'Main resource') - .click(); - - cy.url().should('contain', '/display/document/main'); - cy.wait(200); // fix unexpected refresh after page change - - // Add subresource data to main resource - - cy.contains('New field').click(); - cy.get('.wizard', { timeout: 10000 }).should('be.visible'); - - cy.get('input[name="label"]') - .clear() - .type('Animal crossing'); - - cy.contains('From Subresource').click(); - - cy.get('[data-testid="autocomplete-subresource-label"]').click(); - - cy.get('[role="listbox"]') - .contains('name') - .click(); - - cy.get('.wizard') - .find('.btn-save') - .click(); - - cy.get('.wizard').should('not.exist'); - - cy.contains('button', 'Published data').click(); - - let fieldName; - cy.contains('span', 'Animal crossing') - .parent('p') - .within(() => { - cy.get('span[data-field-name]') - .invoke('attr', 'data-field-name') - .then(fieldNameAttrValue => { - fieldName = fieldNameAttrValue; - }); - }); - - // Add subresource link using previously created field - - cy.contains('button', 'Page').click(); - cy.contains('New field').click(); - cy.get('.wizard', { timeout: 10000 }).should('be.visible'); - - cy.get('input[name="label"]') - .clear() - .type('Animal link'); - - cy.contains('From Subresource').click(); - - cy.get('#tab-display').click(); - - datasetImportPage.fillTabDisplayFormat('link', false); - cy.contains('The column content').click(); - cy.get(`[role="listbox"] li[data-value="column"]`).click(); - cy.get(`[role="listbox"]`).should('not.be.visible'); - cy.contains('label', 'Custom text') - .parent('div') - .within(() => { - cy.get('input').type(fieldName); - }); - cy.get('#format-edit-dialog') - .contains('confirm', { matchCase: false }) - .click(); - cy.get('.wizard') - .find('.btn-save') - .click(); - - cy.get('.wizard').should('not.exist'); - - datasetImportPage.addColumn('name', { syndication: 1 }); - - cy.get('.sidebar') - .contains('Search & Facet') - .click(); - cy.get('[data-testid="autocomplete_search_in_fields"]').click(); - cy.get('[role="listbox"]') - .contains('Animal link') - .click(); - - navigationPage.publishAndGoToPublishedData(); - - menu.openSearchDrawer(); - searchDrawer.findSearchResultByTitle('Publication n°1').click(); - - cy.location('pathname').should('not.equal', '/'); - - cy.contains('.property', 'Animal crossing').within(() => { - cy.contains('Canidae').should('be.visible'); - }); - - cy.contains('.property', 'Animal link').within(() => { - cy.contains('Canidae').should('be.visible'); - }); - }); -}); diff --git a/cypress/integration/phase_3/search.spec.js b/cypress/integration/phase_3/search.spec.js deleted file mode 100644 index d07481ab7..000000000 --- a/cypress/integration/phase_3/search.spec.js +++ /dev/null @@ -1,249 +0,0 @@ -import { teardown } from '../../support/authentication'; -import * as menu from '../../support/menu'; -import * as datasetImportPage from '../../support/datasetImportPage'; -import * as searchDrawer from '../../support/searchDrawer'; - -const initSearchDataset = ( - dataset = 'dataset/book_summary.csv', - model = 'model/book_summary.json', -) => () => { - teardown(); - menu.openAdvancedDrawer(); - menu.goToAdminDashboard(); - - datasetImportPage.importDataset(dataset); - datasetImportPage.importModel(model); - datasetImportPage.publish(); - datasetImportPage.goToPublishedResources(); -}; - -describe('Search', () => { - describe('Basics', () => { - beforeEach(initSearchDataset()); - - it('should have the right information in the search results', () => { - menu.openSearchDrawer(); - searchDrawer.checkResultsCount(10); - searchDrawer.checkMoreResultsCount(10, 12); - }); - - it('should export the dataset', () => { - menu.openSearchDrawer(); - searchDrawer.checkResultsCount(10); - cy.get('.export').click(); - cy.wait(300); - cy.get('.export-menuList li[role="menuitem"]') - .should('have.length', 3) - .contains('CSV') - .should('be.visible'); - }); - - it('should do a search, and its result redirect to a resource', () => { - menu.openSearchDrawer(); - searchDrawer.search('Annals of the rheumatic'); - - searchDrawer - .findSearchResultByTitle('Annals of the rheumatic diseases') - .click(); - - cy.url().should('contain', '/uid'); - cy.get('.loading').should('not.be.visible'); - cy.get('.property_value') - .contains('Annals of the rheumatic diseases') - .should('be.visible'); - }); - - it('should be able to load more search results several times', () => { - menu.openSearchDrawer(); - - searchDrawer.checkStatsCount(12, 12); - searchDrawer.checkResultsCount(10); - searchDrawer.checkMoreResultsCount(10, 12); - - searchDrawer.loadMore(); // Call load more for the first time - - searchDrawer.checkResultsCount(12); - searchDrawer.checkMoreResultsNotExist(); - - searchDrawer.search('bezoar'); - searchDrawer.clearSearch(); - - searchDrawer.checkResultsCount(10); - searchDrawer.checkMoreResultsCount(10, 12); - - searchDrawer.loadMore(); // Call load more for the second time - - searchDrawer.checkResultsCount(12); - searchDrawer.checkMoreResultsNotExist(); - }); - - it('should mark active resource on the result list', () => { - menu.openSearchDrawer(); - searchDrawer.search('Annals of the rheumatic'); - - searchDrawer - .findSearchResultByTitle('Annals of the rheumatic diseases') - .click(); - - cy.url().should('contain', '/uid'); - cy.get('.loading').should('not.be.visible'); - menu.openSearchDrawer(); - - cy.get('.search-result-link[class*=activeLink_]').should('exist'); - }); - - it('should keep track of the current search after changing page', () => { - const query = 'Annals of the rheumatic'; - menu.openSearchDrawer(); - searchDrawer.search(query); - searchDrawer.checkResultsCount(1); - - searchDrawer - .findSearchResultByTitle('Annals of the rheumatic diseases') - .click(); - - cy.url().should('contain', '/uid'); - cy.get('.loading').should('not.be.visible'); - menu.openSearchDrawer(); - - searchDrawer.checkResultsCount(1); - searchDrawer.searchInput().should('have.value', query); - }); - - it.skip('should sort result by pertinence', () => { - menu.openSearchDrawer(); - searchDrawer.search('medicine'); - searchDrawer.checkStatsCount(2, 12); - searchDrawer.checkResultsCount(2); - - searchDrawer.checkResultList([ - 'Acupuncture in medicine', - 'Archives of emergency medicine', - ]); - searchDrawer.search(' archive'); - searchDrawer.checkResultsCount(5); - - searchDrawer.checkResultList([ - 'Archives of emergency medicine', - 'Acupuncture in medicine', - 'Archives of disease in childhood', - 'Archives of disease in childhood. Education and practice edition', - 'Archives of disease in childhood. Fetal and neonatal edition', - ]); - }); - }); - - describe('Advanced Search', () => { - beforeEach(initSearchDataset()); - - it('should filter search results by facets', () => { - menu.openSearchDrawer(); - searchDrawer.checkResultsCount(10); - - searchDrawer.setFacet('Dernière mise en ligne en', '2014'); - searchDrawer.checkResultsCount(1); - }); - - it('should allow to clear facets from the search results', () => { - menu.openSearchDrawer(); - searchDrawer.setFacet('Dernière mise en ligne en', '2014'); - searchDrawer.checkResultsCount(1); - - searchDrawer.clearFacet('2014'); - searchDrawer.checkResultsCount(10); - }); - - it.skip('should allow to sort facet', () => { - menu.openSearchDrawer(); - searchDrawer.getFacet('Première mise en ligne en').click(); - cy.wait(500); - searchDrawer.checkFacetsItem('Première mise en ligne en (10)', [ - '2011', - '1988', - '2008', - '1853', - '1984', - '1983', - '2007', - '1939', - '1926', - '2004', - ]); - searchDrawer.sortFacet('Première mise en ligne en', 'value'); - - searchDrawer.checkFacetsItem('Première mise en ligne en (10)', [ - '2011', - '2008', - '2007', - '2004', - '1988', - '1984', - '1983', - '1939', - '1926', - '1853', - ]); - searchDrawer.sortFacet('Première mise en ligne en (10)', 'value'); - searchDrawer.checkFacetsItem('Première mise en ligne en (10)', [ - '1853', - '1926', - '1939', - '1983', - '1984', - '1988', - '2004', - '2007', - '2008', - '2011', - ]); - searchDrawer.sortFacet('Première mise en ligne en (10)', 'count'); - searchDrawer.checkFacetsItem('Première mise en ligne en (10)', [ - '2011', - '1988', - '2008', - '1853', - '1984', - '1983', - '2007', - '1939', - '1926', - '2004', - ]); - searchDrawer.sortFacet('Première mise en ligne en (10)', 'count'); - searchDrawer.checkFacetsItem('Première mise en ligne en (10)', [ - '2008', - '1853', - '1984', - '1983', - '2007', - '1939', - '1926', - '2004', - '2011', - '1988', - ]); - }); - }); - - // @TODO Investigate why this test fails (due to publication of exotic-search-dataset) - // describe('Edge Cases', () => { - // beforeEach( - // initSearchDataset( - // 'dataset/exotic-search-dataset.csv', - // 'model/exotic-search-model.json', - // ), - // ); - - // it('should have a diacritic insensible text-based search', () => { - // menu.openSearchDrawer(); - // searchDrawer.search('sirene'); - // searchDrawer.checkResultsCount(1); - // }); - - // it('should allow to search for long sentences or descriptions', () => { - // menu.openSearchDrawer(); - // searchDrawer.search('Lorem ipsum'); - // searchDrawer.checkResultsCount(1); - // }); - // }); -}); diff --git a/cypress/integration/phase_4/graph_page.spec.js b/cypress/integration/phase_4/graph_page.spec.js deleted file mode 100644 index d2443c4d9..000000000 --- a/cypress/integration/phase_4/graph_page.spec.js +++ /dev/null @@ -1,94 +0,0 @@ -import { teardown } from '../../support/authentication'; -import * as datasetImportPage from '../../support/datasetImportPage'; -import * as menu from '../../support/menu'; -import * as graphPage from '../../support/graphPage'; -import * as searchDrawer from '../../support/searchDrawer'; - -describe('Graph Page', () => { - beforeEach(() => { - // ResizeObserver doesn't like when the app has to many renders / re-renders - // and throws an exception to say, "I wait for the next paint" - // https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver#observation_errors - cy.on('uncaught:exception', error => { - return !error.message.includes('ResizeObserver'); - }); - - teardown(); - menu.openAdvancedDrawer(); - menu.goToAdminDashboard(); - - datasetImportPage.importDataset('dataset/chart.csv'); - datasetImportPage.importModel('model/chart.json'); - datasetImportPage.publish(); - datasetImportPage.goToPublishedResources(); - }); - - it('should not reset the facets and the search query when switching to another graph', () => { - menu.openChartDrawer(); - menu.goToChart('Bar Chart'); - - graphPage.getStats().should('have.text', 'Found 50 on 50'); - - graphPage.searchFor('Biodiversity'); - graphPage.getStats().should('have.text', 'Found 5 on 50'); - - graphPage.clearSearch(); - graphPage.getStats().should('have.text', 'Found 5 on 50'); - - graphPage.searchFor('Biodiversity'); - graphPage.setFacet('Publication Year', '2011'); - cy.wait(400); - graphPage.getStats().should('have.text', 'Found 4 on 50'); - - menu.openChartDrawer(); - menu.goToChart('Bubble Chart'); - - graphPage.getSearchInput().should('have.value', 'Biodiversity'); - graphPage.getStats().should('have.text', 'Found 4 on 50'); - - graphPage.getFacet('Publication Year').click(); - cy.wait(500); - graphPage - .getFacetItem('Publication Year', '2011') - .find('input[type=checkbox]') - .should('be.checked'); - }); - - it('should copy filters to search drawer', () => { - menu.openChartDrawer(); - menu.goToChart('Bar Chart'); - - graphPage.searchFor('Biodiversity'); - graphPage.getStats().should('have.text', 'Found 5 on 50'); - graphPage.setFacet('Publication Year', '2011'); - graphPage.getStats().should('have.text', 'Found 4 on 50'); - - menu.openSearchDrawer(); - searchDrawer.getFacet('Publication Year').click(); - searchDrawer - .getFacetItem('Publication Year', '2011') - .find('input[type=checkbox]') - .should('not.checked'); - searchDrawer.searchInput().should('have.value', ''); - - menu.closeSearchDrawer(); - graphPage.browseResults(); - - searchDrawer.getFacet('Publication Year').click(); - searchDrawer.searchInput().should('have.value', 'Biodiversity'); - searchDrawer - .getFacetItem('Publication Year', '2011') - .find('input[type=checkbox]') - .should('checked'); - - menu.closeSearchDrawer(); - graphPage.setFacetExclude('Publication Year'); - graphPage.browseResults(); - searchDrawer.getFacet('Publication Year (14)').click(); - searchDrawer.searchInput().should('have.value', 'Biodiversity'); - searchDrawer - .getFacetExcludeItem('Publication Year') - .find('input[type=checkbox]') - .should('checked'); - }); -}); diff --git a/cypress/integration/phase_4/model.spec.js b/cypress/integration/phase_4/model.spec.js deleted file mode 100644 index d8e94ae94..000000000 --- a/cypress/integration/phase_4/model.spec.js +++ /dev/null @@ -1,86 +0,0 @@ -import { teardown } from '../../support/authentication'; -import * as datasetImportPage from '../../support/datasetImportPage'; -import * as menu from '../../support/menu'; -import * as homePage from '../../support/homePage'; -import * as searchDrawer from '../../support/searchDrawer'; - -describe('Model Page', () => { - describe('handling old models', () => { - beforeEach(() => { - // ResizeObserver doesn't like when the app has to many renders / re-renders - // and throws an exception to say, "I wait for the next paint" - // https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver#observation_errors - cy.on('uncaught:exception', error => { - return !error.message.includes('ResizeObserver'); - }); - - teardown(); - menu.openAdvancedDrawer(); - menu.goToAdminDashboard(); - datasetImportPage.importDataset('dataset/film.csv'); - datasetImportPage.importModel('model/film-obsolete.json'); - datasetImportPage.publish(); - datasetImportPage.goToPublishedResources(); - }); - - it('should display list of fields in home', () => { - homePage.checkCharacteristicsOrder([ - 'Dataset Name', - 'Dataset Description', - 'Nombre de films', - 'Liste des films', - 'Répartition par créateurs', - ]); - - cy.get('.property_label') - .contains('rating') - .should('not.be.visible'); - }); - - it('should display list of fields in resources', () => { - menu.openSearchDrawer(); - searchDrawer.search('Star Wars Episode IV: A New Hope'); - searchDrawer - .findSearchResultByTitle('Star Wars Episode IV: A New Hope') - .click(); - - cy.get('.property_label') - .contains('actors') - .should('be.visible'); - - cy.get('.property_value') - .contains('Mark Hamill') - .should('be.visible'); - - cy.get('.property_label') - .contains('rating') - .should('be.visible'); - - cy.get('.property_value') - .contains('8,7') - .should('be.visible'); - - cy.get('.property_label') - .contains('Répartition par créateurs') - .should('not.be.visible'); - - cy.get('.property_label') - .contains('Répartition par réalisateurs uniques') - .should('not.be.visible'); - }); - - it('should display list of fields in graphics', () => { - menu.openChartDrawer(); - - cy.get('.graph-summary-label') - .contains('Répartition par créateurs') - .should('be.visible'); - - cy.get('.graph-summary-label') - .contains('Répartition par réalisateurs uniques') - .should('be.visible'); - - menu.goToChart('Répartition par créateurs'); - }); - }); -}); diff --git a/package.json b/package.json index 3dadf0466..ed03ab028 100644 --- a/package.json +++ b/package.json @@ -27,10 +27,10 @@ "test:api:e2e:watch": "./node_modules/jest/bin/jest.js --colors --runInBand --detectOpenHandles -c src/api/e2e/jest.config.js src/api/e2e --watch", "test:unit": "./node_modules/jest/bin/jest.js --force-exit --detectOpenHandles --colors", "test:unit:watch": "./node_modules/jest/bin/jest.js --watch --colors", - "test:e2e:phase:one": "cypress run --browser chrome --spec \"cypress/integration/phase_1/*.spec.js\"", - "test:e2e:phase:two": "cypress run --browser chrome --spec \"cypress/integration/phase_2/*.spec.js\"", - "test:e2e:phase:three": "cypress run --browser chrome --spec \"cypress/integration/phase_3/*.spec.js\"", - "test:e2e:phase:four": "cypress run --browser chrome --spec \"cypress/integration/phase_4/*.spec.js\"", + "test:e2e:phase:one": "cypress run --browser chrome --spec \"cypress/e2e/phase_1/*.cy.js\"", + "test:e2e:phase:two": "cypress run --browser chrome --spec \"cypress/e2e/phase_2/*.cy.js\"", + "test:e2e:phase:three": "cypress run --browser chrome --spec \"cypress/e2e/phase_3/*.cy.js\"", + "test:e2e:phase:four": "cypress run --browser chrome --spec \"cypress/e2e/phase_4/*.cy.js\"", "test:e2e:all": "cypress run --browser chrome", "insertversion:readme": "sed -i \"s#\\(lodex:\\)\\([\\.a-z0-9]\\+\\)#\\1${npm_package_version}#g\" README.md", "insertversion:makefile": "sed -i \"s#\\(lodex:\\)\\([\\.a-z0-9]\\+\\)#\\1${npm_package_version}#g\" Makefile", @@ -279,5 +279,10 @@ "prettier": "^1.19.1", "sleepjs": "3.0.1", "webpack-dev-server": "^3.11.3" + }, + "config": { + "mongodbMemoryServer": { + "version": "4.4.4" + } } }