Skip to content

Commit

Permalink
TMMA-461: Make Cypress tests more robust; Add clean up of results fro…
Browse files Browse the repository at this point in the history
…m failing tests; Add looping around use of Refresh button; Increase overall Cypress time out
  • Loading branch information
asset-web committed Oct 18, 2023
1 parent c90ed96 commit 7544121
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 81 deletions.
3 changes: 2 additions & 1 deletion cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ const { defineConfig } = require('cypress')
module.exports = defineConfig({
e2e: {
baseUrl: 'https://py-web-d0.epi.bris.ac.uk',
supportFile: false,
pageLoadTimeout: 100000,
supportFile: 'cypress/support/commands.js',
specPattern: 'cypress/integration/*.js',
video: true,
videoCompression: false,
Expand Down
79 changes: 37 additions & 42 deletions cypress/integration/large-dataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ describe('Login, upload and do a search using large dataset including selecting

beforeEach(() => {
cy.visit('/');
cy.viewport(1920, 1080)
cy.viewport(1920, 1080);
});

it('Lets login, go to results page, check its empty then try to upload an abstract file', () => {
Expand All @@ -27,21 +27,22 @@ describe('Login, upload and do a search using large dataset including selecting
.invoke('text')
.should('equal', 'TeMMPo: My list')

// goto results tab and check its empty

// goto results tab and ensure its empty
cy.get('#side-menu')
.contains('Results')
.click()

cy.get('.page-header')
.should('have.text', 'Results')

cy.get('table')
cy.deleteAnyExistingResults()

cy.get('#results')
.find('tr')
.eq(1)
.contains('No data available in table', { matchCase: false })

// lets go to the search page try to upload an ovid medline abstract file
// lets go to the search page try to upload an ovid medline abstract file

cy.get('.controls')
.find('a.btn.btn-default')
Expand All @@ -58,7 +59,7 @@ describe('Login, upload and do a search using large dataset including selecting
.contains('Upload OVID MEDLINE® formatted abstracts', { matchCase: false })
.click()

// Goes to the ovid medline abstract file upload page
// Goes to the ovid medline abstract file upload page

cy.get('title')
.invoke('text')
Expand All @@ -71,19 +72,19 @@ describe('Login, upload and do a search using large dataset including selecting
.contains('Upload', { matchCase: false })
.click()

// We should be on the Select exposure MeSH® terms page
// We should be on the Select exposure MeSH® terms page

cy.get('title')
.invoke('text')
.should('equal', 'TeMMPo: Select exposure MeSH® terms')

// Lets tick some exposure terms in the checkbox tree
// Lets tick some exposure terms in the checkbox tree

cy.get('a')
.contains('Anatomy', { matchCase: false })
.click()

// Lets add some exposure terms in the textarea, click add, then move on to mediators
// Lets add some exposure terms in the textarea, click add, then move on to mediators

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');

Expand All @@ -93,20 +94,20 @@ describe('Login, upload and do a search using large dataset including selecting
cy.contains('Save and move on to select mediators', { matchCase: false })
.click()

// We should be on the Select mediator MeSH® terms page
// We should be on the Select mediator MeSH® terms page

cy.get('title')
.invoke('text')
.should('equal', 'TeMMPo: Select mediator MeSH® terms')

// Lets add terms in the textarea, click add, then move on to outcomes
// Lets add terms in the textarea, click add, then move on to outcomes

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.contains('Add', { matchCase: false })
.click()

// add some more terms from the checkbox tree
// add some more terms from the checkbox tree

cy.get('a')
.contains('Information Science', { matchCase: false })
Expand All @@ -115,20 +116,20 @@ describe('Login, upload and do a search using large dataset including selecting
cy.contains('Save and move on to select outcomes', { matchCase: false })
.click()

// We should be on the Select outcome MeSH® terms page
// We should be on the Select outcome MeSH® terms page

cy.get('title')
.invoke('text')
.should('equal', 'TeMMPo: Select outcome MeSH® terms')

// Lets add outcome term in the textarea, click add, move on to genes
// Lets add outcome term in the textarea, click add, move on to genes

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.contains('Add', { matchCase: false })
.click()

// Lets tick an outcome term in the checkbox
// Lets tick an outcome term in the checkbox

cy.get('a')
.contains('Named Groups', { matchCase: false })
Expand All @@ -137,58 +138,52 @@ describe('Login, upload and do a search using large dataset including selecting
cy.contains('Save and move on to select Genes and Filters', { matchCase: false })
.click()

// We should be on the Select genes and filter page
// We should be on the Select genes and filter page

cy.get('title')
.invoke('text')
.should('equal', 'TeMMPo: Select genes and filter')

// click the button to continue and get some results
// click the button to continue and get some results

cy.get('button.btn.btn-primary')
.contains('Search', { matchCase: false })
.click()

// We should be on the my list of Results page
// We should be on the my list of Results page

cy.get('title')
.invoke('text')
.should('equal', 'TeMMPo: My list')

// get the table and check it has the uploaded text file listed
// get the table and check it has the uploaded text file listed

cy.get('table')
.eq(0)
.find('tr')
.eq(1)
.should('not.be.empty')

// now we are gonna wait 10 seconds...

cy.wait(10000)

// reload the page by pressing the refresh button...

cy.contains('Refresh', { matchCase: false })
.click()

// this is where we will do the visualiations...
for (let i = 0; i < 50; i++) {
cy.checkForResults()
}

// this is where we go to the visualiations...

// select sankey chart

// select sankey chart

cy.get('tbody')
cy.get('#results tbody')
.contains('View Sankey diagram')
.click()


// check sankey chart contains human....etc
// check sankey chart contains human....etc

cy.get('#sankey_multiple')
.should('include.text', 'Humans')


// go back to results tab
// go back to results tab

cy.get('#side-menu')
.contains('Results')
Expand All @@ -197,21 +192,21 @@ describe('Login, upload and do a search using large dataset including selecting
cy.get('.page-header')
.should('have.text', 'Results')

// select bubble chart
// select bubble chart

cy.get('tbody')
.contains('View bubble chart')
.click()

// should contain Genetic Markers on the page
// should contain Genetic Markers on the page

cy.get('#bubble_chart')
.should('include.text', 'Base Sequence')


// thats the end of visualiations test, now lets delete the file we uploaded...
// thats the end of visualiations test, now lets delete the file we uploaded...

// goto results tab...
// goto results tab...

cy.get('#side-menu')
.contains('Results')
Expand All @@ -220,26 +215,26 @@ describe('Login, upload and do a search using large dataset including selecting
cy.get('.page-header')
.should('have.text', 'Results')

// find and click the delete button
// find and click the delete button

cy.get('.controls')
.find('a.btn.btn-danger.btn-sm')
.contains('Delete', { matchCase: false })
.click({force:true})

// now check we go the the delete search page
// now check we go the the delete search page

cy.get('title')
.invoke('text')
.should('equal', 'TeMMPo: Delete search')

// find the delete search button and click it
// find the delete search button and click it

cy.get('input.btn.btn-danger')
.contains('Delete search', { matchCase: false })
.click({force:true})

// now were redirected to the results page with an alert saying Search results deleted
// now were redirected to the results page with an alert saying Search results deleted

cy.get('title')
.invoke('text')
Expand Down
Loading

0 comments on commit 7544121

Please sign in to comment.