From ba08d59502702d99f5cf870bbdd5a3c6c9ab13d2 Mon Sep 17 00:00:00 2001 From: Karine St-Onge Date: Fri, 25 Oct 2024 14:46:55 -0400 Subject: [PATCH] feat: CLIN-3292 Adjuts Cypress tests --- cypress/e2e/Colonnes/TableauStudies.cy.ts | 38 +++++++++++++++++- cypress/e2e/Consultation/PageStudy.cy.ts | 5 +++ cypress/e2e/Consultation/TableauStudies.cy.ts | 14 ++++++- cypress/e2e/Facettes/PageStudies.cy.ts | 15 +++++++ cypress/e2e/Recherche/PageStudies.cy.ts | 9 +++++ .../e2e/Telechargement/TableauStudies.cy.ts | 40 +++++++++++++++++++ cypress/fixtures/ExportTableauStudies.json | 32 +++++++++++++++ 7 files changed, 150 insertions(+), 3 deletions(-) create mode 100644 cypress/e2e/Telechargement/TableauStudies.cy.ts create mode 100644 cypress/fixtures/ExportTableauStudies.json diff --git a/cypress/e2e/Colonnes/TableauStudies.cy.ts b/cypress/e2e/Colonnes/TableauStudies.cy.ts index 47af4290..2e7beaa1 100644 --- a/cypress/e2e/Colonnes/TableauStudies.cy.ts +++ b/cypress/e2e/Colonnes/TableauStudies.cy.ts @@ -73,12 +73,48 @@ describe('Page des études - Colonnes du tableau', () => { cy.get('div[class="ant-popover-inner"]') .find('div[class="ant-space-item"]').eq(12) .contains('Access Requirement').should('exist'); - + cy.get('thead[class="ant-table-thead"]') .contains('Description').should('not.exist'); cy.get('div[class="ant-popover-inner"]') .find('div[class="ant-space-item"]').eq(13) .contains('Description').should('exist'); + + cy.get('thead[class="ant-table-thead"]') + .contains('Overall Design').should('not.exist'); + cy.get('div[class="ant-popover-inner"]') + .find('div[class="ant-space-item"]').eq(14) + .contains('Overall Design').should('exist'); + + cy.get('thead[class="ant-table-thead"]') + .contains('Data Collection Method').should('not.exist'); + cy.get('div[class="ant-popover-inner"]') + .find('div[class="ant-space-item"]').eq(15) + .contains('Data Collection Method').should('exist'); + + cy.get('thead[class="ant-table-thead"]') + .contains('Principal Investigators').should('not.exist'); + cy.get('div[class="ant-popover-inner"]') + .find('div[class="ant-space-item"]').eq(16) + .contains('Principal Investigators').should('exist'); + + cy.get('thead[class="ant-table-thead"]') + .contains('Contact Persons').should('not.exist'); + cy.get('div[class="ant-popover-inner"]') + .find('div[class="ant-space-item"]').eq(17) + .contains('Contact Persons').should('exist'); + + cy.get('thead[class="ant-table-thead"]') + .contains('Affiliated Institutions').should('not.exist'); + cy.get('div[class="ant-popover-inner"]') + .find('div[class="ant-space-item"]').eq(18) + .contains('Affiliated Institutions').should('exist'); + + cy.get('thead[class="ant-table-thead"]') + .contains('Inclusion and Exclusion Criteria').should('not.exist'); + cy.get('div[class="ant-popover-inner"]') + .find('div[class="ant-space-item"]').eq(19) + .contains('Inclusion and Exclusion Criteria').should('exist'); }); it('Masquer une colonne affichée', () => { diff --git a/cypress/e2e/Consultation/PageStudy.cy.ts b/cypress/e2e/Consultation/PageStudy.cy.ts index 2ac307ff..a74bb29c 100644 --- a/cypress/e2e/Consultation/PageStudy.cy.ts +++ b/cypress/e2e/Consultation/PageStudy.cy.ts @@ -173,6 +173,11 @@ describe('Page d\'une étude - Vérifier les informations affichées', () => { }); describe('Page d\'une étude - Valider les liens disponibles', () => { + it('Lien du Website du panneau Summary', () => { + cy.get('[id="summary"] [class="ant-descriptions-item-content"]').eq(13).find('[href]') + .should('have.attr', 'href', 'https://www.t_dee.com/'); + }); + it('Lien Duo de l\'Access Limitations du panneau Data Access', () => { cy.get('[id="data_access"] [class="ant-descriptions-item-content"]').eq(0).find('[href]') .should('have.attr', 'href', 'http://purl.obolibrary.org/obo/DUO_0000006'); diff --git a/cypress/e2e/Consultation/TableauStudies.cy.ts b/cypress/e2e/Consultation/TableauStudies.cy.ts index ec39a25a..a8cfaaa7 100644 --- a/cypress/e2e/Consultation/TableauStudies.cy.ts +++ b/cypress/e2e/Consultation/TableauStudies.cy.ts @@ -8,6 +8,12 @@ beforeEach(() => { cy.showColumn('Population'); cy.showColumn('Access Limitation'); cy.showColumn('Access Requirement'); + cy.showColumn('Overall design'); + cy.showColumn('Data Collection Method'); + cy.showColumn('Principal Investigator(s)'); + cy.showColumn('Contact person(s)'); + cy.showColumn('Affiliated institution(s)'); + cy.showColumn('Inclusion and exclusion criteria'); cy.showColumn('Description'); }); @@ -22,13 +28,11 @@ describe.skip('Page des études - Vérifier les informations affichées', () => cy.get('tr[data-row-key="T-DEE"] [class="ant-table-cell"]').eq(2).contains('Neurodevelopmental Conditions').should('exist'); cy.get('tr[data-row-key="T-DEE"] [class="ant-table-cell"]').eq(3).contains('Pediatric and adult').should('exist'); cy.get('tr[data-row-key="T-DEE"] [class="ant-table-cell"]').eq(4).contains('588').should('exist'); - cy.get('tr[data-row-key="STUDY2"] [class="ant-table-cell"]').eq(4).find('[href]').should('not.exist'); cy.get('tr[data-row-key="T-DEE"] [class="ant-table-cell"]').eq(5).contains('196').should('exist'); cy.get('tr[data-row-key="T-DEE"] [class="ant-table-cell"]').eq(6).find('[data-icon="check"]').should('exist'); cy.get('tr[data-row-key="T-DEE"] [class="ant-table-cell"]').eq(7).contains('-').should('exist'); cy.get('tr[data-row-key="T-DEE"] [class="ant-table-cell"]').eq(8).contains('-').should('exist'); cy.get('tr[data-row-key="T-DEE"] [class="ant-table-cell"]').eq(9).contains('2,940').should('exist'); - cy.get('tr[data-row-key="STUDY2"] [class="ant-table-cell"]').eq(9).find('[href]').should('not.exist'); cy.get('tr[data-row-key="T-DEE"] [class="ant-table-cell"]').eq(10).contains('health or medical or biomedical research').should('exist'); cy.get('tr[data-row-key="T-DEE"] [class="ant-table-cell"]').eq(10).contains('DUO:').should('exist'); cy.get('tr[data-row-key="T-DEE"] [class="ant-table-cell"]').eq(10).contains('0000006').should('exist'); @@ -36,6 +40,12 @@ describe.skip('Page des études - Vérifier les informations affichées', () => cy.get('tr[data-row-key="T-DEE"] [class="ant-table-cell"]').eq(11).contains('DUO:').should('exist'); cy.get('tr[data-row-key="T-DEE"] [class="ant-table-cell"]').eq(11).contains('0000016').should('exist'); cy.get('tr[data-row-key="T-DEE"] [class="ant-table-cell"]').eq(12).contains('Case-parent trio stu').should('exist'); + cy.get('tr[data-row-key="T-DEE"] [class="ant-table-cell"]').eq(13).contains('Case only').should('exist'); + cy.get('tr[data-row-key="T-DEE"] [class="ant-table-cell"]').eq(14).contains('Investigator Assessment').should('exist'); + cy.get('tr[data-row-key="T-DEE"] [class="ant-table-cell"]').eq(15).contains('Toto').should('exist'); + cy.get('tr[data-row-key="T-DEE"] [class="ant-table-cell"]').eq(16).contains('Tata').should('exist'); + cy.get('tr[data-row-key="T-DEE"] [class="ant-table-cell"]').eq(17).contains('Toto Institution').should('exist'); + cy.get('tr[data-row-key="T-DEE"] [class="ant-table-cell"]').eq(18).contains('Children with a diagnosis of intractable seizures').should('exist'); }); }); diff --git a/cypress/e2e/Facettes/PageStudies.cy.ts b/cypress/e2e/Facettes/PageStudies.cy.ts index ed972fdd..917da7c9 100644 --- a/cypress/e2e/Facettes/PageStudies.cy.ts +++ b/cypress/e2e/Facettes/PageStudies.cy.ts @@ -45,4 +45,19 @@ describe('Page des études - Filtrer avec les facettes', () => { cy.validateFacetFilter('Access Requirement', 'Genetic studies only (DUO:0000016)', 'genetic studies only (DUO:0000016)', /\d{1} Results/, false); cy.validateFacetRank(3, 'Access Requirement'); }); + + it('Data Category - Genomics', () => { + cy.validateFacetFilter('Data Category', 'Genomics', 'Genomics', /\d{1} Results/, false); + cy.validateFacetRank(4, 'Data Category'); + }); + + it('Overall Design - Case only', () => { + cy.validateFacetFilter('Overall Design', 'Case only', 'Case only', /\d{1} Results/, false); + cy.validateFacetRank(5, 'Overall Design'); + }); + + it('Data Collection Method - Medical Records', () => { + cy.validateFacetFilter('Data Collection Method', 'Medical Records', 'Medical Records', /\d{1} Results/, false); + cy.validateFacetRank(6, 'Data Collection Method'); + }); }); diff --git a/cypress/e2e/Recherche/PageStudies.cy.ts b/cypress/e2e/Recherche/PageStudies.cy.ts index 50a9f449..f0166142 100644 --- a/cypress/e2e/Recherche/PageStudies.cy.ts +++ b/cypress/e2e/Recherche/PageStudies.cy.ts @@ -34,6 +34,15 @@ describe('Page des études - Rechercher des études', () => { cy.validateTableResultsCount(/\d{1} Results/); }); + it('Par chercheur principal', () => { + cy.typeAndIntercept('[class*="PageContent_search"]', 'batman', 'POST', '**/graphql', 6); + cy.validateTableResultsCount(/1 Result/); + cy.validateTableFirstRow('STUDY1', 0); + + cy.get('button[class*="Header_clearFilterLink"]').should('contain', 'Clear filters').clickAndWait({force: true}); + cy.validateTableResultsCount(/\d{1} Results/); + }); + it('Par mot-clé', () => { cy.typeAndIntercept('[class*="PageContent_search"]', 'FAMILY', 'POST', '**/graphql', 6); cy.validateTableResultsCount(/\d{1} Results/); diff --git a/cypress/e2e/Telechargement/TableauStudies.cy.ts b/cypress/e2e/Telechargement/TableauStudies.cy.ts new file mode 100644 index 00000000..7a1f4e84 --- /dev/null +++ b/cypress/e2e/Telechargement/TableauStudies.cy.ts @@ -0,0 +1,40 @@ +/// +import { getDateTime } from '../../support/utils'; +import { oneMinute } from '../../support/utils'; + +const { strDate } = getDateTime(); + +beforeEach(() => { + cy.removeFilesFromFolder(Cypress.config('downloadsFolder')); + + cy.login(); + cy.visitStudiesPage(); + cy.showColumn('Population'); + cy.showColumn('Access Limitation'); + cy.showColumn('Access Requirement'); + cy.showColumn('Overall design'); + cy.showColumn('Data Collection Method'); + cy.showColumn('Principal Investigator(s)'); + cy.showColumn('Contact person(s)'); + cy.showColumn('Affiliated institution(s)'); + cy.showColumn('Inclusion and exclusion criteria'); + cy.showColumn('Description'); + cy.wait(1000); + + cy.clickAndIntercept('div[id="content"] svg[data-icon="download"]', 'POST', '**/download', 1); + cy.waitUntilFile(oneMinute); +}); + +describe('Page des études - Exporter les études en TSV', () => { + it('Valider le nom du fichier', () => { + cy.validateFileName('cqdg-study-table-'+`${strDate.slice(0, 4)}-${strDate.slice(4, 6)}-${strDate.slice(6, 8)}`+'.tsv'); + }); + + it('Valider les en-têtes du fichier', () => { + cy.validateFileHeaders('ExportTableauStudies.json'); + }); + + it('Valider le contenu du fichier', () => { + cy.validateFileContent('ExportTableauStudies.json'); + }); +}); diff --git a/cypress/fixtures/ExportTableauStudies.json b/cypress/fixtures/ExportTableauStudies.json new file mode 100644 index 00000000..d5a6df71 --- /dev/null +++ b/cypress/fixtures/ExportTableauStudies.json @@ -0,0 +1,32 @@ +{ + "headers": ["Code", + "Name", + "Domain", + "Population", + "Participants", + "Families", + "Files", + "Description", + "Overall Design", + "Data Collection Method", + "Principal Investigators", + "Contact Persons", + "Affiliated Institutions", + "Inclusion and Exclusion Criteria"], + "content": ["T-DEE", + "Developmental and epileptic encephalopathies", + "Neurodevelopmental Conditions", + "Pediatric and adult", + "588", + "196", + "2940", + "Case-parent trio study on developmental and epileptic encephalopaties (DEE)|Description en francais, Case-parent trio study on developmental and epileptic encephalopaties (DEE)", + "Case only", + "Case-control", + "Investigator Assessment", + "Medical Records", + "Toto", + "Tata", + "Toto Institution", + "Children with a diagnosis of intractable seizures"] +}