Skip to content

Commit

Permalink
add e2e and screenshot tests for comparison mutations table
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryan Lai committed Jul 5, 2023
1 parent c969fd6 commit 0cf182a
Show file tree
Hide file tree
Showing 3 changed files with 196 additions and 5 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ describe('group comparison page screenshot tests', function() {
);
$(
'div[data-test="GroupComparisonGenericAssayEnrichments"]'
).waitForDisplayed({ timeout: 10000 });
).waitForDisplayed({ timeout: 20000 });
$(
'div[data-test="GroupComparisonGenericAssayEnrichments"]'
).waitForDisplayed({ timeout: 10000 });
Expand All @@ -415,7 +415,7 @@ describe('group comparison page screenshot tests', function() {
);
$(
'div[data-test="GroupComparisonGenericAssayEnrichments"]'
).waitForDisplayed({ timeout: 10000 });
).waitForDisplayed({ timeout: 20000 });
$('b=Lawsonia').waitForDisplayed({ timeout: 10000 });
$('b=Lawsonia').click();
$('body').moveTo({ xOffset: 0, yOffset: 0 });
Expand All @@ -428,6 +428,21 @@ describe('group comparison page screenshot tests', function() {
);
assertScreenShotMatch(res);
});

it('group comparison page mutations tab two groups', function() {
goToUrlAndSetLocalStorage(
`${CBIOPORTAL_URL}/comparison/mutations?sessionId=5cf89323e4b0ab413787436c&selectedGene=AR`
);
$('.borderedChart svg').waitForDisplayed({ timeout: 20000 });
var res = browser.checkElement(
'[data-test="ComparisonPageMutationsTabPlot"]',
'',
{
viewportChangePause: 4000,
}
); // hide these things because the timing of data loading makes this test so flaky
assertScreenShotMatch(res);
});
});

describe('delete group from session', function() {
Expand All @@ -436,7 +451,7 @@ describe('group comparison page screenshot tests', function() {
`${CBIOPORTAL_URL}/comparison?sessionId=5ce411c7e4b0ab4137874076`
);
$('div[data-test="ComparisonPageOverlapTabDiv"]').waitForDisplayed({
timeout: 20000,
timeout: 30000,
});
});
it('group comparison page delete group from session', function() {
Expand All @@ -458,7 +473,7 @@ describe('group comparison page screenshot tests', function() {
);
$(
'div[data-test="ComparisonPageOverlapTabDiv"]'
).waitForDisplayed({ timeout: 20000 });
).waitForDisplayed({ timeout: 30000 });
});

it('group comparison page overlap tab disjoint venn diagram view', function() {
Expand Down
178 changes: 177 additions & 1 deletion end-to-end-test/remote/specs/core/groupComparisonLollipop.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ var goToUrlAndSetLocalStorage = require('../../../shared/specUtils')
var setInputText = require('../../../shared/specUtils').setInputText;
var setSettingsMenuOpen = require('../../../shared/specUtils')
.setSettingsMenuOpen;
const { getElementByTestHandle } = require('../../../shared/specUtils');
const {
jsApiHover,
getElementByTestHandle,
} = require('../../../shared/specUtils');

const CBIOPORTAL_URL = process.env.CBIOPORTAL_URL.replace(/\/$/, '');

Expand Down Expand Up @@ -815,4 +818,177 @@ describe('group comparison mutations tab tests', function() {
);
});
});

describe('displaying fisher exact test label', function() {
before(function() {
goToUrlAndSetLocalStorage(
`${CBIOPORTAL_URL}/comparison/mutations?sessionId=5cf89323e4b0ab413787436c&selectedGene=AR`
);
$('.lollipop-svgnode').waitForDisplayed({
timeout: 30000,
});
});

it('fisher test text and tooltip dynamically changes when filtering and selecting', function() {
// filter value
getElementByTestHandle('missense_putative_driver_only').click();

assert.equal(
getElementByTestHandle('fisherTestLabel').getText(),
'Fisher Exact Two-Sided Test p-value for filtered mutations - (A) Metastasis vs (B) Primary: 4.21e-8'
);

jsApiHover(getElementByTestHandle('infoIcon'));

getElementByTestHandle(
'patientMultipleMutationsMessage'
).waitForExist();
assert.equal(
getElementByTestHandle(
'patientMultipleMutationsMessage'
).getText(),
'3 patients have more than one mutation in AR'
);

// select value
$('.lollipop-3').click();

assert.equal(
getElementByTestHandle('fisherTestLabel').getText(),
'Fisher Exact Two-Sided Test p-value for selected mutations - (A) Metastasis vs (B) Primary: 0.0305'
);

jsApiHover(getElementByTestHandle('infoIcon'));

getElementByTestHandle(
'patientMultipleMutationsMessage'
).waitForExist();
assert.equal(
getElementByTestHandle(
'patientMultipleMutationsMessage'
).getText(),
'1 patient has more than one mutation in AR'
);

// default value
$('button=Remove filter').click();

assert.equal(
getElementByTestHandle('fisherTestLabel').getText(),
'Fisher Exact Two-Sided Test p-value for all mutations - (A) Metastasis vs (B) Primary: 7.200e-6'
);

jsApiHover(getElementByTestHandle('infoIcon'));

getElementByTestHandle(
'patientMultipleMutationsMessage'
).waitForExist();
assert.equal(
getElementByTestHandle(
'patientMultipleMutationsMessage'
).getText(),
'4 patients have more than one mutation in AR'
);
});
});

describe('displaying table header and pagination status text', function() {
before(function() {
goToUrlAndSetLocalStorage(
`${CBIOPORTAL_URL}/comparison/mutations?sessionId=5cf89323e4b0ab413787436c&selectedGene=AR`
);
$('.lollipop-svgnode').waitForDisplayed({
timeout: 30000,
});
});

it('displays correct text and number of mutations and protein changes when filtering and selecting', function() {
// filter value
$('strong=Inframe').click();

assert.equal(
getElementByTestHandle('LazyMobXTable_CountHeader').getText(),
'14 Mutations (page 1 of 1)'
);

assert.equal(
$('.topPagination').getText(),
'Showing 1-14 of 14 Mutations'
);

// select value
$('.lollipop-1').click();

assert.equal(
getElementByTestHandle('LazyMobXTable_CountHeader').getText(),
'1 Mutation (page 1 of 1)'
);

assert.equal(
$('.topPagination').getText(),
'Showing 1-1 of 1 Mutation'
);

// default value
$('button=Remove filter').click();

assert.equal(
getElementByTestHandle('LazyMobXTable_CountHeader').getText(),
'16 Mutations (page 1 of 1)'
);

assert.equal(
$('.topPagination').getText(),
'Showing 1-16 of 16 Mutations'
);
});
});

describe('mutation table filtering options', function() {
beforeEach(function() {
goToUrlAndSetLocalStorage(
`${CBIOPORTAL_URL}/comparison/mutations?sessionId=5cf89323e4b0ab413787436c&selectedGene=AR`
);
$('.lollipop-svgnode').waitForDisplayed({
timeout: 30000,
});
});

it('filters table with search box', () => {
var searchInput = '[data-test=table-search-input]';
var numberOfRowsBefore = $$('tr').length;
$(searchInput).setValue('w7');
browser.waitUntil(() => $$('tr').length < numberOfRowsBefore);
assert($$('tr').length < numberOfRowsBefore);
});

it('filters table with enriched in dropdown', () => {
var numberOfRowsBefore = $$('tr').length;
getElementByTestHandle('enrichedInDropdown').click();
$('#react-select-6-option-0-0').click();
browser.waitUntil(() => $$('tr').length < numberOfRowsBefore);
assert($$('tr').length < numberOfRowsBefore);
});

it('filters table with significant only checkbox', () => {
var numberOfRowsBefore = $$('tr').length;
getElementByTestHandle('significantOnlyCheckbox').click();
browser.waitUntil(() => $$('tr').length < numberOfRowsBefore);
assert($$('tr').length < numberOfRowsBefore);
});

it('filters table with protein badge filtering', () => {
var numberOfRowsBefore = $$('tr').length;
$('strong=Missense').click();
browser.waitUntil(() => $$('tr').length < numberOfRowsBefore);
assert($$('tr').length < numberOfRowsBefore);
});

it('filters table with lollipop selection', () => {
var numberOfRowsBefore = $$('tr').length;
$('.lollipop-1').click();
browser.waitUntil(() => $$('tr').length < numberOfRowsBefore);
assert($$('tr').length < numberOfRowsBefore);
});
});
});

0 comments on commit 0cf182a

Please sign in to comment.