Skip to content

Commit

Permalink
feat: CLIN-3292 Adjuts Cypress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Karine St-Onge committed Oct 25, 2024
1 parent ef7e818 commit ba08d59
Show file tree
Hide file tree
Showing 7 changed files with 150 additions and 3 deletions.
38 changes: 37 additions & 1 deletion cypress/e2e/Colonnes/TableauStudies.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
5 changes: 5 additions & 0 deletions cypress/e2e/Consultation/PageStudy.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
14 changes: 12 additions & 2 deletions cypress/e2e/Consultation/TableauStudies.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});

Expand All @@ -22,20 +28,24 @@ 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');
cy.get('tr[data-row-key="T-DEE"] [class="ant-table-cell"]').eq(11).contains('genetic studies only').should('exist');
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');
});
});

Expand Down
15 changes: 15 additions & 0 deletions cypress/e2e/Facettes/PageStudies.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});
9 changes: 9 additions & 0 deletions cypress/e2e/Recherche/PageStudies.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/);
Expand Down
40 changes: 40 additions & 0 deletions cypress/e2e/Telechargement/TableauStudies.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/// <reference types="cypress"/>
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');
});
});
32 changes: 32 additions & 0 deletions cypress/fixtures/ExportTableauStudies.json
Original file line number Diff line number Diff line change
@@ -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"]
}

0 comments on commit ba08d59

Please sign in to comment.