diff --git a/end-to-end-test/remote/screenshots/reference/no_session_mutation_tab_element_chrome_1600x1000.png b/end-to-end-test/remote/screenshots/reference/no_session_mutation_tab_element_chrome_1600x1000.png index 3edff5d684e..a1659cebbf9 100644 Binary files a/end-to-end-test/remote/screenshots/reference/no_session_mutation_tab_element_chrome_1600x1000.png and b/end-to-end-test/remote/screenshots/reference/no_session_mutation_tab_element_chrome_1600x1000.png differ diff --git a/end-to-end-test/remote/screenshots/reference/session_mutation_tab_element_chrome_1600x1000.png b/end-to-end-test/remote/screenshots/reference/session_mutation_tab_element_chrome_1600x1000.png index 3edff5d684e..a1659cebbf9 100644 Binary files a/end-to-end-test/remote/screenshots/reference/session_mutation_tab_element_chrome_1600x1000.png and b/end-to-end-test/remote/screenshots/reference/session_mutation_tab_element_chrome_1600x1000.png differ diff --git a/end-to-end-test/remote/specs/core/results.logic.spec.js b/end-to-end-test/remote/specs/core/results.logic.spec.js index 1de9afe9878..fa969244176 100644 --- a/end-to-end-test/remote/specs/core/results.logic.spec.js +++ b/end-to-end-test/remote/specs/core/results.logic.spec.js @@ -90,12 +90,11 @@ describe('single study query', function() { $('a.tabAnchor_mutations').waitForExist(10000); $('a.tabAnchor_mutations').click(); - $('[data-test="germlineMutationRate"]').waitForExist(60000); - var text = browser.getText('[data-test="germlineMutationRate"]') + $('[data-test="mutation-rate-summary"]').waitForExist(60000); + var text = browser.getText('[data-test="mutation-rate-summary"]'); // check germline mutation rate assert(text.search('8.2%') > -1); // check somatic mutation - var text = browser.getText('[data-test="somaticMutationRate"]') assert(text.search('3.5%') > -1); }); diff --git a/src/pages/resultsView/mutation/MutationRateSummary.tsx b/src/pages/resultsView/mutation/MutationRateSummary.tsx index 5694554f9e9..b9d1365ba6d 100644 --- a/src/pages/resultsView/mutation/MutationRateSummary.tsx +++ b/src/pages/resultsView/mutation/MutationRateSummary.tsx @@ -57,22 +57,24 @@ export default class MutationRateSummary extends React.Component 0 ? { - title: "Germline Mutation Frequency", - description: `Percentage of samples with a germline mutation in ${this.props.hugoGeneSymbol}` - }: undefined} - /> + + 0 ? { + title: "Germline Mutation Frequency", + description: `Percentage of samples with a germline mutation in ${this.props.hugoGeneSymbol}` + }: undefined} + /> + ); } } diff --git a/src/shared/components/annotation/oncokb/OncoKB.spec.tsx b/src/shared/components/annotation/oncokb/OncoKB.spec.tsx deleted file mode 100644 index ddc6af7890a..00000000000 --- a/src/shared/components/annotation/oncokb/OncoKB.spec.tsx +++ /dev/null @@ -1,251 +0,0 @@ -// TODO move this test into react-mutation-mapper repo! - -import {OncoKB, IOncoKbProps, oncoKbAnnotationSortValue} from "react-mutation-mapper"; - -import {initQueryIndicator} from "test/OncoKbMockUtils"; -import {lazyMobXTableSort} from "shared/components/lazyMobXTable/LazyMobXTable"; -import {IndicatorQueryResp} from "public-lib/api/generated/OncoKbAPI"; - -import React from 'react'; -import { assert } from 'chai'; -import {mount, ReactWrapper} from 'enzyme'; -import {Circle} from "better-react-spinkit"; - -describe('OncoKB', () => { - const props = { - indicator: undefined, - status: "pending" - } as IOncoKbProps; - - let component: ReactWrapper; - - before(() => { - component = mount(); - }); - - it('displays a load spinner when there is no indicator data', () => { - const spinner = component.find(".fa-spinner"); - - assert.isTrue(spinner.exists(), - "Spinner component should exist"); - }); - - it('properly calculates OncoKB sort values', () => { - - let queryA = initQueryIndicator({ - oncogenic: 'Oncogenic' - }); - - let queryB = initQueryIndicator({ - oncogenic: 'Oncogenic' - }); - - let array:IndicatorQueryResp[] = [queryA, queryB]; - - let sortedArray:IndicatorQueryResp[]; - - assert.deepEqual( - oncoKbAnnotationSortValue(queryA), oncoKbAnnotationSortValue(queryB), - 'Equal Oncogenicity'); - - queryA.oncogenic = 'Oncogenic'; - queryB.oncogenic = 'Inconclusive'; - array = [queryB, queryA]; - sortedArray = lazyMobXTableSort(array, oncoKbAnnotationSortValue, true); - assert.isAbove( - sortedArray.indexOf(queryA), sortedArray.indexOf(queryB), - 'Oncogenicity test 2'); - - queryA.oncogenic = 'Oncogenic'; - queryB.oncogenic = 'Unknown'; - array = [queryB, queryA]; - sortedArray = lazyMobXTableSort(array, oncoKbAnnotationSortValue, true); - assert.isAbove( - sortedArray.indexOf(queryA), sortedArray.indexOf(queryB), - 'Oncogenicity test 3'); - - queryA.oncogenic = 'Oncogenic'; - queryB.oncogenic = 'Likely Neutral'; - array = [queryB, queryA]; - sortedArray = lazyMobXTableSort(array, oncoKbAnnotationSortValue, true); - assert.isAbove( - sortedArray.indexOf(queryA), sortedArray.indexOf(queryB), - 'Oncogenicity test 4'); - - queryA.oncogenic = 'Inconclusive'; - queryB.oncogenic = 'Unknown'; - array = [queryB, queryA]; - sortedArray = lazyMobXTableSort(array, oncoKbAnnotationSortValue, true); - assert.isAbove( - sortedArray.indexOf(queryA), sortedArray.indexOf(queryB), - 'Oncogenicity test 5'); - - queryA.oncogenic = 'Likely Neutral'; - queryB.oncogenic = 'Inconclusive'; - array = [queryB, queryA]; - sortedArray = lazyMobXTableSort(array, oncoKbAnnotationSortValue, true); - assert.isAbove( - sortedArray.indexOf(queryA), sortedArray.indexOf(queryB), - 'Oncogenicity test 6'); - - queryA = initQueryIndicator({ - oncogenic: 'Unknown', - vus: true - }); - queryB = initQueryIndicator({ - oncogenic: 'Unknown', - vus: false - }); - array = [queryB, queryA]; - sortedArray = lazyMobXTableSort(array, oncoKbAnnotationSortValue, true); - assert.isAbove( - sortedArray.indexOf(queryA), sortedArray.indexOf(queryB), - 'A is VUS, which should have higher score.'); - - queryA = initQueryIndicator({ - oncogenic: 'Oncogenic', - highestSensitiveLevel: 'LEVEL_1' - }); - queryB = initQueryIndicator({ - oncogenic: 'Oncogenic', - highestSensitiveLevel: 'LEVEL_2A' - }); - array = [queryB, queryA]; - sortedArray = lazyMobXTableSort(array, oncoKbAnnotationSortValue, true); - assert.isAbove( - sortedArray.indexOf(queryA), sortedArray.indexOf(queryB), - 'A(LEVEL_1) should be higher than B(LEVEL_2A)'); - - queryA = initQueryIndicator({ - oncogenic: 'Oncogenic', - highestResistanceLevel: 'LEVEL_R1' - }); - queryB = initQueryIndicator({ - oncogenic: 'Oncogenic', - highestResistanceLevel: 'LEVEL_R2' - }); - array = [queryB, queryA]; - sortedArray = lazyMobXTableSort(array, oncoKbAnnotationSortValue, true); - assert.isAbove( - sortedArray.indexOf(queryA), sortedArray.indexOf(queryB), - 'A(LEVEL_R1) should be higher than B(LEVEL_R2)'); - - queryA = initQueryIndicator({ - oncogenic: 'Oncogenic', - highestSensitiveLevel: 'LEVEL_2A', - highestResistanceLevel: '' - }); - queryB = initQueryIndicator({ - oncogenic: 'Oncogenic', - highestSensitiveLevel: '', - highestResistanceLevel: 'LEVEL_R1' - }); - array = [queryB, queryA]; - sortedArray = lazyMobXTableSort(array, oncoKbAnnotationSortValue, true); - assert.isAbove( - sortedArray.indexOf(queryA), sortedArray.indexOf(queryB), - 'A(LEVEL_2A) should be higher than B(LEVEL_R1)'); - - queryA = initQueryIndicator({ - oncogenic: 'Oncogenic' - }); - queryB = initQueryIndicator({ - oncogenic: 'Unknown', - highestSensitiveLevel: 'LEVEL_2A' - }); - array = [queryB, queryA]; - sortedArray = lazyMobXTableSort(array, oncoKbAnnotationSortValue, true); - assert.isAbove( - sortedArray.indexOf(queryA), sortedArray.indexOf(queryB), - 'The score for Oncogenic variant(A) should always higher than other categories(B) even B has treatments.'); - - // GeneExist tests - queryA = initQueryIndicator({ - geneExist: true - }); - queryB = initQueryIndicator({ - geneExist: false - }); - array = [queryB, queryA]; - sortedArray = lazyMobXTableSort(array, oncoKbAnnotationSortValue, true); - assert.isAbove( - sortedArray.indexOf(queryA), sortedArray.indexOf(queryB), - 'A should be higher than B.'); - - // GeneExist tests - queryA = initQueryIndicator({ - geneExist: false, - oncogenic: 'Oncogenic' - }); - queryB = initQueryIndicator({ - geneExist: true - }); - array = [queryB, queryA]; - sortedArray = lazyMobXTableSort(array, oncoKbAnnotationSortValue, true); - assert.isAbove( - sortedArray.indexOf(queryA), sortedArray.indexOf(queryB), - 'A should be higher than B even A gene does not exist. Because A has higher oncogenicity.'); - - // VariantExist does not have any impact any more - queryA = initQueryIndicator({ - variantExist: false - }); - queryB = initQueryIndicator({ - variantExist: true, - highestSensitiveLevel: 'LEVEL_2A' - }); - array = [queryB, queryA]; - sortedArray = lazyMobXTableSort(array, oncoKbAnnotationSortValue, true); - assert.isBelow( - sortedArray.indexOf(queryA), sortedArray.indexOf(queryB), - 'A should be lower than B.'); - - queryA = initQueryIndicator({ - variantExist: true - }); - queryB = initQueryIndicator({ - variantExist: false, - highestSensitiveLevel: 'LEVEL_2A' - }); - array = [queryB, queryA]; - sortedArray = lazyMobXTableSort(array, oncoKbAnnotationSortValue, true); - assert.isBelow( - sortedArray.indexOf(queryA), sortedArray.indexOf(queryB), - 'A should be lower than B[LEVEL_2A] even B variant does not exist.'); - - // Is Hotspot does not have any impact any more - queryA = initQueryIndicator({ - oncogenic: 'Oncogenic', - hotspot: false - }); - queryB = initQueryIndicator({ - oncogenic: 'Oncogenic', - hotspot: true, - highestSensitiveLevel: 'LEVEL_2A' - }); - array = [queryB, queryA]; - sortedArray = lazyMobXTableSort(array, oncoKbAnnotationSortValue, true); - assert.isBelow( - sortedArray.indexOf(queryA), sortedArray.indexOf(queryB), - 'A should be lower than B.'); - - queryA = initQueryIndicator({ - oncogenic: 'Oncogenic', - hotspot: true - }); - queryB = initQueryIndicator({ - oncogenic: 'Oncogenic', - hotspot: false, - highestSensitiveLevel: 'LEVEL_2A' - }); - array = [queryB, queryA]; - sortedArray = lazyMobXTableSort(array, oncoKbAnnotationSortValue, true); - assert.isBelow( - sortedArray.indexOf(queryA), sortedArray.indexOf(queryB), - 'A should be lower than B[LEVEL_2A] even A is hotspot.'); - }); - - after(() => { - - }); -}); diff --git a/src/test/OncoKbMockUtils.ts b/src/test/OncoKbMockUtils.ts deleted file mode 100644 index b1fab5a00c5..00000000000 --- a/src/test/OncoKbMockUtils.ts +++ /dev/null @@ -1,57 +0,0 @@ -import {IndicatorQueryResp} from "public-lib/api/generated/OncoKbAPI"; -import * as _ from 'lodash'; - -export function emptyQueryIndicator(): IndicatorQueryResp -{ - return { - alleleExist: false, - dataVersion: "", - geneExist: false, - geneSummary: "", - highestResistanceLevel: "LEVEL_R3", - highestSensitiveLevel: "LEVEL_4", - highestDiagnosticImplicationLevel: "LEVEL_Dx1", - highestPrognosticImplicationLevel: "LEVEL_Px1", - hotspot: false, - lastUpdate: "", - mutationEffect: { - description: "", - knownEffect: "", - citations: { - abstracts: [], - pmids: [] - } - }, - oncogenic: "", - otherSignificantResistanceLevels: [], - otherSignificantSensitiveLevels: [], - query: { - alteration: "", - alterationType: "", - consequence: "", - entrezGeneId: -1, - hugoSymbol: "", - id: "", - proteinEnd: -1, - proteinStart: -1, - tumorType: "", - type: "web", - hgvs: "", - svType: "DELETION" // TODO: hack because svType is not optional - }, - treatments: [], - diagnosticImplications: [], - prognosticImplications: [], - tumorTypeSummary: "", - diagnosticSummary: "", - prognosticSummary: "", - variantExist: false, - variantSummary: "", - vus: false - }; -} - -export function initQueryIndicator(props:{[key:string]: any}): IndicatorQueryResp -{ - return _.merge(emptyQueryIndicator(), props); -}