-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Impl. structural variants table in study view
- Loading branch information
1 parent
9626fb1
commit 48669a1
Showing
38 changed files
with
3,052 additions
and
251 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
var assert = require('assert'); | ||
var goToUrlAndSetLocalStorage = require('../../shared/specUtils') | ||
.goToUrlAndSetLocalStorage; | ||
var waitForStudyView = require('../../shared/specUtils').waitForStudyView; | ||
|
||
const CBIOPORTAL_URL = process.env.CBIOPORTAL_URL.replace(/\/$/, ''); | ||
// TODO remove feature flag after merge. | ||
const studyViewUrl = `${CBIOPORTAL_URL}/study/summary?id=study_es_0&featureFlags=STUDY_VIEW_STRUCT_VAR_TABLE`; | ||
const structVarTable = '//*[@data-test="structural variant pairs-table"]'; | ||
const filterCheckBox = '[data-test=labeledCheckbox]'; | ||
const structVarFilterPillTag = '[data-test=pill-tag]'; | ||
const uncheckedSvIcon = '[data-test=structVarQueryCheckboxUnchecked]'; | ||
const checkedSvIcon = '[data-test=structVarQueryCheckboxChecked]'; | ||
const structVarNameCell = '[data-test=structVarNameCell]'; | ||
const toast = '.Toastify div[role=alert]'; | ||
|
||
describe('study view structural variant table', function() { | ||
beforeEach(() => { | ||
goToUrlAndSetLocalStorage(studyViewUrl, true); | ||
waitForStudyView(); | ||
}); | ||
|
||
it('adds structural variant to study view filter', () => { | ||
$(structVarTable) | ||
.$(filterCheckBox) | ||
.click(); | ||
$('[data-test=selectSamplesButton]').waitForExist(); | ||
$('[data-test=selectSamplesButton]').click(); | ||
assert($(structVarFilterPillTag).isExisting()); | ||
}); | ||
|
||
it('shows all checkboxes when row is hovered', () => { | ||
$(structVarNameCell).waitForExist(); | ||
const firstSvRowCell = $$(structVarNameCell)[0]; | ||
assert.equal($$(structVarNameCell)[1].getText(), 'SND1'); | ||
assert.equal($$(structVarNameCell)[2].getText(), 'BRAF'); | ||
|
||
movePointerWithRetry(firstSvRowCell, () => | ||
$(uncheckedSvIcon).waitForDisplayed() | ||
); | ||
assert.equal($$(uncheckedSvIcon).length, 3); | ||
}); | ||
|
||
it('shows only checked checkboxes when row is not hovered', () => { | ||
$(structVarNameCell).waitForExist(); | ||
const gene1Cell = $$(structVarNameCell)[1]; | ||
movePointerWithRetry(gene1Cell, () => | ||
$(uncheckedSvIcon).waitForDisplayed() | ||
); | ||
assert.equal($$(uncheckedSvIcon).length, 3); | ||
|
||
gene1Cell.waitForClickable(); | ||
gene1Cell.click(); | ||
|
||
// hover somewhere else: | ||
movePointerWithRetry($('span=Gene 2'), $(checkedSvIcon).waitForExist()); | ||
|
||
assert.equal($$(uncheckedSvIcon).length, 0); | ||
assert.equal($$(checkedSvIcon).length, 1); | ||
}); | ||
|
||
it('adds gene1::gene2 to Results View query', () => { | ||
$(structVarNameCell).waitForExist(); | ||
const firstSvRowCell = $$(structVarNameCell)[0]; | ||
|
||
movePointerWithRetry(firstSvRowCell, () => { | ||
$$(uncheckedSvIcon)[0].waitForClickable(); | ||
}); | ||
const gene1And2Checkbox = $$(uncheckedSvIcon)[0]; | ||
gene1And2Checkbox.click(); | ||
$(toast).waitForDisplayed(); | ||
clearToast(); | ||
|
||
const resultsViewQueryBox = openResultViewQueryBox(); | ||
assert.equal('SND1: FUSION::BRAF ;', resultsViewQueryBox.getValue()); | ||
}); | ||
|
||
it('adds gene1::* to Results View query', () => { | ||
$(structVarNameCell).waitForExist(); | ||
const gene1Cell = $$(structVarNameCell)[1]; | ||
movePointerWithRetry(gene1Cell, () => | ||
$(uncheckedSvIcon).waitForDisplayed() | ||
); | ||
gene1Cell.waitForClickable(); | ||
gene1Cell.click(); | ||
$(toast).waitForDisplayed(); | ||
clearToast(); | ||
|
||
const resultsViewQueryBox = openResultViewQueryBox(); | ||
assert.equal('SND1: FUSION:: ;', resultsViewQueryBox.getValue()); | ||
}); | ||
|
||
it('adds *::gene2 to Results View query', () => { | ||
$(structVarNameCell).waitForExist(); | ||
const gene2Cell = $$(structVarNameCell)[2]; | ||
movePointerWithRetry(gene2Cell, () => | ||
$(uncheckedSvIcon).waitForDisplayed() | ||
); | ||
gene2Cell.waitForClickable(); | ||
gene2Cell.click(); | ||
$(toast).waitForDisplayed(); | ||
clearToast(); | ||
|
||
const resultsViewQueryBox = openResultViewQueryBox(); | ||
assert.equal('BRAF: ::FUSION ;', resultsViewQueryBox.getValue()); | ||
}); | ||
}); | ||
|
||
function openResultViewQueryBox() { | ||
const resultsViewQueryBox = $('[data-test=geneSet]'); | ||
resultsViewQueryBox.waitForClickable(); | ||
resultsViewQueryBox.click(); | ||
return resultsViewQueryBox; | ||
} | ||
|
||
function clearToast() { | ||
const toastify = $('.Toastify button'); | ||
toastify.waitForClickable(); | ||
toastify.click(); | ||
browser.pause(100); | ||
} | ||
|
||
function movePointerTo(element) { | ||
element.waitForDisplayed(); | ||
element.scrollIntoView(); | ||
const x = element.getLocation('x'); | ||
const y = element.getLocation('y'); | ||
browser.performActions([ | ||
{ | ||
type: 'pointer', | ||
parameters: { pointerType: 'mouse' }, | ||
actions: [ | ||
{ type: 'pointerMove', duration: 0, x, y }, | ||
{ type: 'pointerMove', duration: 0, x, y }, | ||
], | ||
}, | ||
]); | ||
} | ||
|
||
/** | ||
* When scrolling to the new location, some tooltips might pop up and interfere. | ||
* A retry solves this problem: the second time the pointer is already near/at the desired location | ||
*/ | ||
function movePointerWithRetry(element, isOk) { | ||
movePointerTo(element); | ||
try { | ||
if (isOk()) { | ||
return; | ||
} | ||
} catch (e) { | ||
// retry | ||
} | ||
movePointerTo(element); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,17 +30,17 @@ | |
"buildBootstrap": "sass --style :compressed src/globalStyles/bootstrap-entry.scss src/globalStyles/prefixed-bootstrap.min.css", | ||
"heroku-postbuild": "yarn run build && yarn add [email protected] -g", | ||
"updateAPI": "yarn run fetchAPI && yarn run buildAPI && yarn run updateOncoKbAPI && yarn run updateGenomeNexusAPI", | ||
"fetchAPILocal": "export CBIOPORTAL_URL=http://localhost:8090 && curl -L -k ${CBIOPORTAL_URL}/api/api-docs | json | grep -v basePath | grep -v termsOfService | grep -v host > packages/cbioportal-ts-api-client/src/generated/CBioPortalAPI-docs.json && curl -L -k ${CBIOPORTAL_URL}/api/api-docs?group=internal | json | grep -v host | grep -v basePath | grep -v termsOfService > packages/cbioportal-ts-api-client/src/generated/CBioPortalAPIInternal-docs.json", | ||
"fetchAPI": "./scripts/env_vars.sh && eval \"$(./scripts/env_vars.sh)\" && curl -L -k ${CBIOPORTAL_URL}/api/api-docs | json | grep -v basePath | grep -v termsOfService | grep -v host > packages/cbioportal-ts-api-client/src/generated/CBioPortalAPI-docs.json && curl -L -k ${CBIOPORTAL_URL}/api/api-docs?group=internal | json | grep -v host | grep -v basePath | grep -v termsOfService > packages/cbioportal-ts-api-client/src/generated/CBioPortalAPIInternal-docs.json", | ||
"fetchAPILocal": "export CBIOPORTAL_URL=http://localhost:8090 && curl -s -L -k ${CBIOPORTAL_URL}/api/api-docs | json | grep -v basePath | grep -v termsOfService | grep -v host > packages/cbioportal-ts-api-client/src/generated/CBioPortalAPI-docs.json && curl -s -L -k ${CBIOPORTAL_URL}/api/api-docs?group=internal | json | grep -v host | grep -v basePath | grep -v termsOfService > packages/cbioportal-ts-api-client/src/generated/CBioPortalAPIInternal-docs.json", | ||
"fetchAPI": "./scripts/env_vars.sh && eval \"$(./scripts/env_vars.sh)\" && curl -s -L -k ${CBIOPORTAL_URL}/api/api-docs | json | grep -v basePath | grep -v termsOfService | grep -v host > packages/cbioportal-ts-api-client/src/generated/CBioPortalAPI-docs.json && curl -s -L -k ${CBIOPORTAL_URL}/api/api-docs?group=internal | json | grep -v host | grep -v basePath | grep -v termsOfService > packages/cbioportal-ts-api-client/src/generated/CBioPortalAPIInternal-docs.json", | ||
"buildAPI": "node scripts/generate-api.js packages/cbioportal-ts-api-client/src/generated CBioPortalAPI CBioPortalAPIInternal", | ||
"updateOncoKbAPI": "yarn run fetchOncoKbAPI && yarn run buildOncoKbAPI", | ||
"fetchOncoKbAPI": "curl -k https://www.oncokb.org/api/v1/v2/api-docs?group=Public%20APIs | json | grep -v basePath | grep -v termsOfService | grep -v host > packages/oncokb-ts-api-client/src/generated/OncoKbAPI-docs.json", | ||
"fetchOncoKbAPI": "curl -s -k https://www.oncokb.org/api/v1/v2/api-docs?group=Public%20APIs | json | grep -v basePath | grep -v termsOfService | grep -v host > packages/oncokb-ts-api-client/src/generated/OncoKbAPI-docs.json", | ||
"buildOncoKbAPI": "node scripts/generate-api.js packages/oncokb-ts-api-client/src/generated OncoKbAPI", | ||
"updateG2SAPI": "yarn run fetchG2SAPI && yarn run buildG2SAPI", | ||
"fetchG2SAPI": "curl -k http://g2s.genomenexus.org/v2/api-docs?group=api > packages/genome-nexus-ts-api-client/src/generated/Genome2StructureAPI-docs.json", | ||
"fetchG2SAPI": "curl -s -k http://g2s.genomenexus.org/v2/api-docs?group=api > packages/genome-nexus-ts-api-client/src/generated/Genome2StructureAPI-docs.json", | ||
"buildG2SAPI": "node scripts/generate-api.js packages/genome-nexus-ts-api-client/src/generated Genome2StructureAPI", | ||
"updateGenomeNexusAPI": "yarn run fetchGenomeNexusAPI && yarn run buildGenomeNexusAPI", | ||
"fetchGenomeNexusAPI": "./scripts/env_vars.sh && eval \"$(./scripts/env_vars.sh)\" && curl -k ${GENOME_NEXUS_URL}/v2/api-docs | json | grep -v basePath | grep -v termsOfService | grep -v host > packages/genome-nexus-ts-api-client/src/generated/GenomeNexusAPI-docs.json && curl -k ${GENOME_NEXUS_URL}/v2/api-docs?group=internal | json | grep -v basePath | grep -v termsOfService | grep -v host > packages/genome-nexus-ts-api-client/src/generated/GenomeNexusAPIInternal-docs.json", | ||
"fetchGenomeNexusAPI": "./scripts/env_vars.sh && eval \"$(./scripts/env_vars.sh)\" && curl -s -k ${GENOME_NEXUS_URL}/v2/api-docs | json | grep -v basePath | grep -v termsOfService | grep -v host > packages/genome-nexus-ts-api-client/src/generated/GenomeNexusAPI-docs.json && curl -s -k ${GENOME_NEXUS_URL}/v2/api-docs?group=internal | json | grep -v basePath | grep -v termsOfService | grep -v host > packages/genome-nexus-ts-api-client/src/generated/GenomeNexusAPIInternal-docs.json", | ||
"buildGenomeNexusAPI": "node scripts/generate-api.js packages/genome-nexus-ts-api-client/src/generated GenomeNexusAPI GenomeNexusAPIInternal", | ||
"updateHotspotGenes": "./scripts/get_hotspot_genes.sh > src/shared/static-data/hotspotGenes.json", | ||
"compileOqlParser": "cd src/shared/lib/oql && pegjs oql-parser.pegjs", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.