-
Notifications
You must be signed in to change notification settings - Fork 320
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add end-to-end tests for custom init columns in cna and structural va…
…riant tables
- Loading branch information
1 parent
a04d947
commit 1247534
Showing
2 changed files
with
135 additions
and
0 deletions.
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
end-to-end-test/local/specs/init-columns-in-cna-tables.spec.js
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,61 @@ | ||
const assert = require('assert'); | ||
const { | ||
goToUrlAndSetLocalStorageWithProperty, | ||
} = require('../../shared/specUtils'); | ||
const { waitForTable } = require('./namespace-columns-utils'); | ||
|
||
const CBIOPORTAL_URL = process.env.CBIOPORTAL_URL.replace(/\/$/, ''); | ||
|
||
const DEFAULT_COLS = { | ||
GENE: 'Gene', | ||
CNA: 'CNA', | ||
ANNOTATION: 'Annotation', | ||
CYTOBAND: 'Cytoband', | ||
COHORT: 'Cohort', | ||
}; | ||
|
||
describe('namespace columns in cna tables', function() { | ||
describe('patient view', () => { | ||
const patientViewUrl = `${CBIOPORTAL_URL}/patient?studyId=study_es_0&caseId=TCGA-A2-A04U`; | ||
const patientCnaTable = 'patientview-copynumber-table'; | ||
|
||
it('shows default columns when property is not set', () => { | ||
goToUrlAndSetLocalStorageWithProperty(patientViewUrl, true, {}); | ||
waitForTable(patientCnaTable); | ||
assert(defaultColumnsAreDisplayed()); | ||
}); | ||
|
||
it('shows selected columns when property is set', () => { | ||
goToUrlAndSetLocalStorageWithProperty(patientViewUrl, true, { | ||
skin_patient_view_copy_number_table_columns_show_on_init: | ||
'Gene,Annotation,Gene panel', | ||
}); | ||
waitForTable(patientCnaTable); | ||
assert(columnIsDisplayed(DEFAULT_COLS.GENE)); | ||
assert(columnIsNotDisplayed(DEFAULT_COLS.CNA)); | ||
assert(columnIsDisplayed(DEFAULT_COLS.ANNOTATION)); | ||
assert(columnIsNotDisplayed(DEFAULT_COLS.CYTOBAND)); | ||
assert(columnIsNotDisplayed(DEFAULT_COLS.COHORT)); | ||
assert(columnIsDisplayed('Gene panel')); //Failing | ||
}); | ||
}); | ||
}); | ||
|
||
defaultColumnsAreDisplayed = () => { | ||
return ( | ||
$("//span[text() = '" + DEFAULT_COLS.GENE + "']").isDisplayed() && | ||
$("//span[text() = '" + DEFAULT_COLS.CNA + "']").isDisplayed() && | ||
$("//span[text() = '" + DEFAULT_COLS.ANNOTATION + "']").isDisplayed() && | ||
$("//span[text() = '" + DEFAULT_COLS.CYTOBAND + "']").isDisplayed() && | ||
$("//span[text() = '" + DEFAULT_COLS.COHORT + "']").isDisplayed() && | ||
!$("//span[text() = 'Gene panel']").isDisplayed() | ||
); | ||
}; | ||
|
||
function columnIsDisplayed(column) { | ||
return $("//span[text() = '" + column + "']").isDisplayed(); | ||
} | ||
|
||
function columnIsNotDisplayed(column) { | ||
return !$("//span[text() = '" + column + "']").isDisplayed(); | ||
} |
74 changes: 74 additions & 0 deletions
74
end-to-end-test/local/specs/init-columns-in-struct-var-tables.spec.js
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,74 @@ | ||
const assert = require('assert'); | ||
const { | ||
goToUrlAndSetLocalStorageWithProperty, | ||
} = require('../../shared/specUtils'); | ||
const { waitForTable } = require('./namespace-columns-utils'); | ||
|
||
const CBIOPORTAL_URL = process.env.CBIOPORTAL_URL.replace(/\/$/, ''); | ||
|
||
const DEFAULT_COLS = { | ||
GENE_1: 'Gene 1', | ||
GENE_2: 'Gene 2', | ||
STATUS: 'Status', | ||
ANNOTATION: 'Annotation', | ||
VARIANT_CLASS: 'Variant Class', | ||
EVENT_INFO: 'Event Info', | ||
CONNECTION_TYPE: 'Connection Type', | ||
}; | ||
|
||
describe('namespace columns in structural variant tables', function() { | ||
describe('patient view', () => { | ||
const patientViewUrl = `${CBIOPORTAL_URL}/patient?studyId=study_es_0&caseId=TCGA-A2-A04P`; | ||
const patientStructVarTable = 'patientview-structural-variant-table'; | ||
|
||
it('shows default columns when property is not set', () => { | ||
goToUrlAndSetLocalStorageWithProperty(patientViewUrl, true, {}); | ||
waitForTable(patientStructVarTable); | ||
|
||
assert(defaultColumnsAreDisplayed()); | ||
}); | ||
|
||
it('shows selected columns when property is set', () => { | ||
goToUrlAndSetLocalStorageWithProperty(patientViewUrl, true, { | ||
skin_patient_view_structural_variant_table_columns_show_on_init: | ||
'Gene 1,Annotation,Breakpoint Type', | ||
}); | ||
waitForTable(patientStructVarTable); | ||
assert(columnIsDisplayed(DEFAULT_COLS.GENE_1)); | ||
assert(columnIsNotDisplayed(DEFAULT_COLS.GENE_2)); | ||
assert(columnIsNotDisplayed(DEFAULT_COLS.STATUS)); | ||
assert(columnIsDisplayed(DEFAULT_COLS.ANNOTATION)); | ||
assert(columnIsNotDisplayed(DEFAULT_COLS.VARIANT_CLASS)); | ||
assert(columnIsNotDisplayed(DEFAULT_COLS.EVENT_INFO)); | ||
assert(columnIsNotDisplayed(DEFAULT_COLS.CONNECTION_TYPE)); | ||
assert(columnIsDisplayed('Breakpoint Type')); | ||
}); | ||
}); | ||
}); | ||
|
||
defaultColumnsAreDisplayed = () => { | ||
return ( | ||
$("//span[text() = '" + DEFAULT_COLS.GENE_1 + "']").waitForDisplayed({ | ||
timeout: 10000, | ||
}) && | ||
$("//span[text() = '" + DEFAULT_COLS.GENE_2 + "']").isDisplayed() && | ||
$("//span[text() = '" + DEFAULT_COLS.STATUS + "']").isDisplayed() && | ||
$("//span[text() = '" + DEFAULT_COLS.ANNOTATION + "']").isDisplayed() && | ||
$( | ||
"//span[text() = '" + DEFAULT_COLS.VARIANT_CLASS + "']" | ||
).isDisplayed() && | ||
$("//span[text() = '" + DEFAULT_COLS.EVENT_INFO + "']").isDisplayed() && | ||
$( | ||
"//span[text() = '" + DEFAULT_COLS.CONNECTION_TYPE + "']" | ||
).isDisplayed() && | ||
!$("//span[text() = 'Breakpoint Type']").isDisplayed() | ||
); | ||
}; | ||
|
||
function columnIsDisplayed(column) { | ||
return $("//span[text() = '" + column + "']").isDisplayed(); | ||
} | ||
|
||
function columnIsNotDisplayed(column) { | ||
return !$("//span[text() = '" + column + "']").isDisplayed(); | ||
} |