-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4424 from BasLee/custom-ns-columns-struct-var
[RFC 66] Display custom namespace columns in struct var table
- Loading branch information
Showing
6 changed files
with
142 additions
and
51 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
55 changes: 55 additions & 0 deletions
55
end-to-end-test/local/specs/namespace-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,55 @@ | ||
const assert = require('assert'); | ||
const { | ||
goToUrlAndSetLocalStorageWithProperty, | ||
} = require('../../shared/specUtils'); | ||
const { | ||
namespaceColumnsAreNotDisplayed, | ||
waitForTable, | ||
clickColumnSelectionButton, | ||
selectColumn, | ||
namespaceColumnsAreDisplayed, | ||
getRowByGene, | ||
} = require('./namespace-columns-utils'); | ||
|
||
const CBIOPORTAL_URL = process.env.CBIOPORTAL_URL.replace(/\/$/, ''); | ||
|
||
describe('namespace columns in struct var tables', function() { | ||
describe('patient view', () => { | ||
const patientViewUrl = `${CBIOPORTAL_URL}/patient?studyId=study_es_0&caseId=TCGA-A2-A04P`; | ||
const namespaceColumn1 = 'StructVarNs Column1'; | ||
const namespaceValue1 = 'value1'; | ||
const namespaceColumn2 = 'StructVarNs Column2'; | ||
const namespaceValue2 = 'value2'; | ||
const namespaceColumns = [namespaceColumn1, namespaceColumn2]; | ||
const patientStructVarTable = 'patientview-structural-variant-table'; | ||
const geneWithCustomNamespaceData = 'KIAA1549'; | ||
|
||
it('hides namespace columns when no property set', () => { | ||
goToUrlAndSetLocalStorageWithProperty(patientViewUrl, true, {}); | ||
waitForTable(patientStructVarTable); | ||
assert(namespaceColumnsAreNotDisplayed(namespaceColumns)); | ||
}); | ||
|
||
it('shows columns when column menu is used', () => { | ||
clickColumnSelectionButton(patientStructVarTable); | ||
selectColumn(namespaceColumn1); | ||
selectColumn(namespaceColumn2); | ||
clickColumnSelectionButton(patientStructVarTable); | ||
assert(namespaceColumnsAreDisplayed(namespaceColumns)); | ||
}); | ||
|
||
/** | ||
* Expected custom namespace columns to be shown | ||
*/ | ||
it('displays custom namespace data', () => { | ||
const rowWithNamespaceData = getRowByGene( | ||
patientStructVarTable, | ||
geneWithCustomNamespaceData | ||
); | ||
assert(!!rowWithNamespaceData); | ||
const text = rowWithNamespaceData.getText(); | ||
assert(text.includes(namespaceValue1)); | ||
assert(text.includes(namespaceValue2)); | ||
}); | ||
}); | ||
}); |
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,40 @@ | ||
function clickColumnSelectionButton(patientCnaTable) { | ||
$(`[data-test=${patientCnaTable}]`) | ||
.$('button*=Columns') | ||
.click(); | ||
} | ||
|
||
function selectColumn(namespaceColumn1) { | ||
$(`[data-id="${namespaceColumn1}"]`).click(); | ||
} | ||
|
||
waitForTable = table => { | ||
$(`[data-test=${table}]`).waitForDisplayed(); | ||
}; | ||
|
||
namespaceColumnsAreDisplayed = columns => { | ||
for (const column of columns) { | ||
if (!$(`//span[text()='${column}']`).isDisplayed()) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
}; | ||
|
||
namespaceColumnsAreNotDisplayed = columns => { | ||
return !namespaceColumnsAreDisplayed(columns); | ||
}; | ||
|
||
getRowByGene = (tableName, gene) => { | ||
const tableRows = $$(`[data-test="${tableName}"] tr`); | ||
return tableRows.find(r => r.$('td=' + gene).isExisting()); | ||
}; | ||
|
||
module.exports = { | ||
getRowByGene, | ||
namespaceColumnsAreNotDisplayed, | ||
namespaceColumnsAreDisplayed, | ||
waitForTable, | ||
selectColumn, | ||
clickColumnSelectionButton, | ||
}; |
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