diff --git a/cypress/integration/large-dataset.js b/cypress/integration/large-dataset.js index 0e9adbb0..25bd539b 100644 --- a/cypress/integration/large-dataset.js +++ b/cypress/integration/large-dataset.js @@ -6,244 +6,247 @@ describe('Login, upload and do a search using large dataset including selecting }); it('Lets login, go to results page, check its empty then try to upload an abstract file', () => { - cy.visit('/logout'); - cy.visit('/'); - cy.get('#side-menu') - .contains('Login') - .click() - cy.get('title') - .invoke('text') - .should('equal', 'TeMMPo: Login') - - cy.get('#id_username').type(Cypress.env('CREDENTIALS_USR')); - cy.get('#id_password').type(Cypress.env('CREDENTIALS_PSW')); - cy.get('button[type=submit]').click() + + // NB: Disabled for the test instance, as fixtures were only manually added to demo and prod vs part of a data migration. + if (Cypress.config("baseUrl") != "https://py-web-t0.epi.bris.ac.uk") { - cy.get('title') - .invoke('text') - .should('equal', 'TeMMPo: My list') + cy.visit('/logout'); + cy.visit('/'); + cy.get('#side-menu') + .contains('Login') + .click() + cy.get('title') + .invoke('text') + .should('equal', 'TeMMPo: Login') - // goto results tab and check its empty + cy.get('#id_username').type(Cypress.env('CREDENTIALS_USR')); + cy.get('#id_password').type(Cypress.env('CREDENTIALS_PSW')); + cy.get('button[type=submit]').click() - cy.get('#side-menu') - .contains('Results') - .click() + cy.get('title') + .invoke('text') + .should('equal', 'TeMMPo: My list') - cy.get('.page-header') - .should('have.text', 'Results') + // goto results tab and check its empty - cy.get('table') - .find('tr') - .eq(1) - .contains('No data available in table', { matchCase: false }) + cy.get('#side-menu') + .contains('Results') + .click() - // lets go to the search page try to upload an ovid medline abstract file + cy.get('.page-header') + .should('have.text', 'Results') - cy.get('.controls') - .find('a.btn.btn-default') - .contains('New search', { matchCase: false }) - .click() + cy.get('table') + .find('tr') + .eq(1) + .contains('No data available in table', { matchCase: false }) - cy.get('title') - .invoke('text') - .should('equal', 'TeMMPo: Search') + // lets go to the search page try to upload an ovid medline abstract file - cy.get('.form-group') - .find('a.btn.btn-primary') - .eq(0) - .contains('Upload OVID MEDLINE® formatted abstracts', { matchCase: false }) - .click() + cy.get('.controls') + .find('a.btn.btn-default') + .contains('New search', { matchCase: false }) + .click() - // Goes to the ovid medline abstract file upload page + cy.get('title') + .invoke('text') + .should('equal', 'TeMMPo: Search') - cy.get('title') - .invoke('text') - .should('equal', 'TeMMPo: Search Ovid MEDLINE®') + cy.get('.form-group') + .find('a.btn.btn-primary') + .eq(0) + .contains('Upload OVID MEDLINE® formatted abstracts', { matchCase: false }) + .click() - cy.get('input[type=file]') - .selectFile('tests/test-abstract.txt') + // Goes to the ovid medline abstract file upload page - cy.get('#upload_button') - .contains('Upload', { matchCase: false }) - .click() + cy.get('title') + .invoke('text') + .should('equal', 'TeMMPo: Search Ovid MEDLINE®') - // We should be on the Select exposure MeSH® terms page + cy.get('input[type=file]') + .selectFile('tests/test-abstract.txt') - cy.get('title') - .invoke('text') - .should('equal', 'TeMMPo: Select exposure MeSH® terms') + cy.get('#upload_button') + .contains('Upload', { matchCase: false }) + .click() - // Lets tick some exposure terms in the checkbox tree + // We should be on the Select exposure MeSH® terms page - cy.get('a') - .contains('Anatomy', { matchCase: false }) - .click() + cy.get('title') + .invoke('text') + .should('equal', 'TeMMPo: Select exposure MeSH® terms') - // Lets add some exposure terms in the textarea, click add, then move on to mediators + // Lets tick some exposure terms in the checkbox tree - cy.get('#term_names').type('Neoplasm Metastasis;DNA Methylation;Gene Silencing;Neoplasm Invasiveness;Drug Design;Structure-Activity Relationship;Flow Cytometry;Enzyme-Linked Immunosorbent Assay;Real-Time Polymerase Chain Reaction;Reverse Transcriptase Polymerase Chain Reaction;Tumor Cells, Cultured;Castration;Mice, Nude;Radioimmunoassay;Tumor Burden;Xenograft Model Antitumor Assays;Disease Progression;Gene Knockout Techniques;Down-Regulation;Oxidation-Reduction;Humans'); + cy.get('a') + .contains('Anatomy', { matchCase: false }) + .click() - cy.contains('Add', { matchCase: false }) - .click() + // Lets add some exposure terms in the textarea, click add, then move on to mediators - cy.contains('Save and move on to select mediators', { matchCase: false }) - .click() + cy.get('#term_names').type('Neoplasm Metastasis;DNA Methylation;Gene Silencing;Neoplasm Invasiveness;Drug Design;Structure-Activity Relationship;Flow Cytometry;Enzyme-Linked Immunosorbent Assay;Real-Time Polymerase Chain Reaction;Reverse Transcriptase Polymerase Chain Reaction;Tumor Cells, Cultured;Castration;Mice, Nude;Radioimmunoassay;Tumor Burden;Xenograft Model Antitumor Assays;Disease Progression;Gene Knockout Techniques;Down-Regulation;Oxidation-Reduction;Humans'); - // We should be on the Select mediator MeSH® terms page + cy.contains('Add', { matchCase: false }) + .click() - cy.get('title') - .invoke('text') - .should('equal', 'TeMMPo: Select mediator MeSH® terms') + cy.contains('Save and move on to select mediators', { matchCase: false }) + .click() - // Lets add terms in the textarea, click add, then move on to outcomes + // We should be on the Select mediator MeSH® terms page - cy.get('#term_names').type('Genetic Markers; Penetrance;Age of Onset;Alleles;Founder Effect;Base Sequence;Female;Molecular Sequence Data;Sequence Analysis, RNA;Aorta/ph [Physiology];Chick Embryo;Chorioallantoic Membrane/de [Drug Effects];Cytokines/bi [Biosynthesis];Rats;TOR Serine-Threonine Kinases/me [Metabolism];Xenograft Model Antitumor Assays;Cross-Sectional Studies;Infant;Child;Milk;Aged'); + cy.get('title') + .invoke('text') + .should('equal', 'TeMMPo: Select mediator MeSH® terms') - cy.contains('Add', { matchCase: false }) - .click() + // Lets add terms in the textarea, click add, then move on to outcomes - // add some more terms from the checkbox tree + cy.get('#term_names').type('Genetic Markers; Penetrance;Age of Onset;Alleles;Founder Effect;Base Sequence;Female;Molecular Sequence Data;Sequence Analysis, RNA;Aorta/ph [Physiology];Chick Embryo;Chorioallantoic Membrane/de [Drug Effects];Cytokines/bi [Biosynthesis];Rats;TOR Serine-Threonine Kinases/me [Metabolism];Xenograft Model Antitumor Assays;Cross-Sectional Studies;Infant;Child;Milk;Aged'); - cy.get('a') - .contains('Information Science', { matchCase: false }) - .click() + cy.contains('Add', { matchCase: false }) + .click() - cy.contains('Save and move on to select outcomes', { matchCase: false }) - .click() + // add some more terms from the checkbox tree - // We should be on the Select outcome MeSH® terms page + cy.get('a') + .contains('Information Science', { matchCase: false }) + .click() - cy.get('title') - .invoke('text') - .should('equal', 'TeMMPo: Select outcome MeSH® terms') + cy.contains('Save and move on to select outcomes', { matchCase: false }) + .click() - // Lets add outcome term in the textarea, click add, move on to genes + // We should be on the Select outcome MeSH® terms page - cy.get('#term_names').type('Neoplasm Metastasis;Eryptosis;Randomized Controlled Trials as Topic;Risk Factors;Immunoassay;Disease-Free Survival;Prostatectomy;Sensitivity and Specificity;Microfluidic Analytical Techniques;Reverse Transcriptase Polymerase Chain Reaction;Signal Transduction;Blotting, Western;Proteomics;Nutritional Requirements;Replicon;Analysis of Variance;Sorghum;Trifolium;Solubility;Industrial Waste;Latex;Dimerization;Young Adult'); + cy.get('title') + .invoke('text') + .should('equal', 'TeMMPo: Select outcome MeSH® terms') - cy.contains('Add', { matchCase: false }) - .click() + // Lets add outcome term in the textarea, click add, move on to genes - // Lets tick an outcome term in the checkbox + cy.get('#term_names').type('Neoplasm Metastasis;Eryptosis;Randomized Controlled Trials as Topic;Risk Factors;Immunoassay;Disease-Free Survival;Prostatectomy;Sensitivity and Specificity;Microfluidic Analytical Techniques;Reverse Transcriptase Polymerase Chain Reaction;Signal Transduction;Blotting, Western;Proteomics;Nutritional Requirements;Replicon;Analysis of Variance;Sorghum;Trifolium;Solubility;Industrial Waste;Latex;Dimerization;Young Adult'); - cy.get('a') - .contains('Named Groups', { matchCase: false }) - .click() + cy.contains('Add', { matchCase: false }) + .click() - cy.contains('Save and move on to select Genes and Filters', { matchCase: false }) - .click() + // Lets tick an outcome term in the checkbox - // We should be on the Select genes and filter page + cy.get('a') + .contains('Named Groups', { matchCase: false }) + .click() - cy.get('title') - .invoke('text') - .should('equal', 'TeMMPo: Select genes and filter') + cy.contains('Save and move on to select Genes and Filters', { matchCase: false }) + .click() - // click the button to continue and get some results + // We should be on the Select genes and filter page - cy.get('button.btn.btn-primary') - .contains('Search', { matchCase: false }) - .click() + cy.get('title') + .invoke('text') + .should('equal', 'TeMMPo: Select genes and filter') - // We should be on the my list of Results page + // click the button to continue and get some results - cy.get('title') - .invoke('text') - .should('equal', 'TeMMPo: My list') + cy.get('button.btn.btn-primary') + .contains('Search', { matchCase: false }) + .click() - // get the table and check it has the uploaded text file listed + // We should be on the my list of Results page - cy.get('table') - .eq(0) - .find('tr') - .eq(1) - .should('not.be.empty') + cy.get('title') + .invoke('text') + .should('equal', 'TeMMPo: My list') - // now we are gonna wait a minute... + // get the table and check it has the uploaded text file listed - cy.wait(60000) + cy.get('table') + .eq(0) + .find('tr') + .eq(1) + .should('not.be.empty') - // reload the page + // now we are gonna wait 10 seconds... - cy.reload() + cy.wait(10000) - // this is where we will do the visualiations... + // reload the page by pressing the refresh button... + cy.contains('Refresh', { matchCase: false }) + .click() - // select sankey chart + // this is where we will do the visualiations... - cy.get('tbody') - .contains('View Sankey diagram') - .click() + // select sankey chart - // check sankey chart contains human....etc + cy.get('tbody') + .contains('View Sankey diagram') + .click() - cy.get('#sankey_multiple') - .should('include.text', 'Humans') + // check sankey chart contains human....etc - // go back to results tab + cy.get('#sankey_multiple') + .should('include.text', 'Humans') - cy.get('#side-menu') - .contains('Results') - .click() - cy.get('.page-header') - .should('have.text', 'Results') + // go back to results tab - // select bubble chart + cy.get('#side-menu') + .contains('Results') + .click() - cy.get('tbody') - .contains('View bubble chart') - .click() + cy.get('.page-header') + .should('have.text', 'Results') - // should contain Genetic Markers on the page + // select bubble chart - cy.get('#bubble_chart') - .should('include.text', 'Base Sequence') + cy.get('tbody') + .contains('View bubble chart') + .click() + // should contain Genetic Markers on the page - // thats the end of visualiations test, now lets delete the file we uploaded... + cy.get('#bubble_chart') + .should('include.text', 'Base Sequence') - // goto results tab... - cy.get('#side-menu') - .contains('Results') - .click() + // thats the end of visualiations test, now lets delete the file we uploaded... - cy.get('.page-header') - .should('have.text', 'Results') + // goto results tab... - // find and click the delete button + cy.get('#side-menu') + .contains('Results') + .click() - cy.get('.controls') - .find('a.btn.btn-danger.btn-sm') - .contains('Delete', { matchCase: false }) - .click({force:true}) + cy.get('.page-header') + .should('have.text', 'Results') - // now check we go the the delete search page + // find and click the delete button - cy.get('title') - .invoke('text') - .should('equal', 'TeMMPo: Delete search') + cy.get('.controls') + .find('a.btn.btn-danger.btn-sm') + .contains('Delete', { matchCase: false }) + .click({force:true}) - // find the delete search button and click it + // now check we go the the delete search page - cy.get('input.btn.btn-danger') - .contains('Delete search', { matchCase: false }) - .click({force:true}) + cy.get('title') + .invoke('text') + .should('equal', 'TeMMPo: Delete search') - // now were redirected to the results page with an alert saying Search results deleted + // find the delete search button and click it - cy.get('title') - .invoke('text') - .should('equal', 'TeMMPo: My list') + cy.get('input.btn.btn-danger') + .contains('Delete search', { matchCase: false }) + .click({force:true}) - cy.get('.info') - .contains('Search results deleted', { matchCase: false }) + // now were redirected to the results page with an alert saying Search results deleted + cy.get('title') + .invoke('text') + .should('equal', 'TeMMPo: My list') + cy.get('.info') + .contains('Search results deleted', { matchCase: false }) + } }) - }); \ No newline at end of file diff --git a/cypress/integration/user-journey.js b/cypress/integration/user-journey.js index 1296300e..1fc4eea0 100644 --- a/cypress/integration/user-journey.js +++ b/cypress/integration/user-journey.js @@ -1,11 +1,13 @@ describe('User journey of login, upload abstracts, perform search, view, visualisation and then delete search.', () => { - beforeEach(() => { cy.visit('/'); cy.viewport(1920, 1080) }); - it('Lets login, go to results page, check its empty then try to upload an abstract file', () => { + if (Cypress.config("baseUrl") != "https://py-web-t0.epi.bris.ac.uk") { + + // NB: Disabled for the test instance, as fixtures were only manually added to demo and prod vs part of a data migration. + it('Lets login, go to results page, check its empty then try to upload an abstract file', () => { cy.visit('/logout'); cy.visit('/'); cy.get('#side-menu') @@ -141,13 +143,14 @@ describe('User journey of login, upload abstracts, perform search, view, visuali .eq(1) .should('not.be.empty') - // now we are gonna wait 30 seconds... + // now we are gonna wait 5 seconds... - cy.wait(30000) + cy.wait(5000) - // reload the page + // reload the page by pressing the refresh button... - cy.reload() + cy.contains('Refresh', { matchCase: false }) + .click() // this is where we will do the visualiations... @@ -227,7 +230,6 @@ describe('User journey of login, upload abstracts, perform search, view, visuali cy.get('.info') .contains('Search results deleted', { matchCase: false }) - - }) - + }) + } }); \ No newline at end of file