Skip to content

Commit

Permalink
add compare button tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryan Lai committed Jan 28, 2025
1 parent 4931a0c commit 0e43169
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
2 changes: 1 addition & 1 deletion end-to-end-test/local/specs/web-tour.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ describe('Group Comparison Tour', function() {
!tourModal.$(NEXT_STEP_BTN).isDisplayed();

// There should be a compare button [data-tour="mutated-genes-table-compare-btn"]
const compareBtn = $('[data-tour="mutated-genes-table-compare-btn"]');
const compareBtn = $('[data-test="mutated-genes-table-compare-btn"]');
compareBtn.waitForDisplayed();

// Click the compare button, the tour should go to the next step
Expand Down
42 changes: 42 additions & 0 deletions end-to-end-test/remote/specs/core/studyview.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -984,6 +984,24 @@ describe('study view treatments table', () => {
assertScreenShotMatch(res);
});

it('compare button appears when selecting multiple rows in sample treatments', async () => {
const sampleTreatmentsFirstCheckbox =
'[data-test="SAMPLE_TREATMENTS-table"] .ReactVirtualized__Table__row:nth-child(1) input';
const sampleTreatmentsSecondCheckbox =
'[data-test="SAMPLE_TREATMENTS-table"] .ReactVirtualized__Table__row:nth-child(2) input';
const sampleTreatmentsCompareButton = '[data-test="table-compare-btn"]';
const url = `${CBIOPORTAL_URL}/study/summary?id=lgg_ucsf_2014`;
await goToUrlAndSetLocalStorage(url);

await (await getElement(sampleTreatmentsFirstCheckbox)).waitForExist();
await clickElement(sampleTreatmentsFirstCheckbox);
await (await getElement(sampleTreatmentsSecondCheckbox)).waitForExist();
await clickElement(sampleTreatmentsSecondCheckbox);
assert(
await (await getElement(sampleTreatmentsCompareButton)).isExisting()
);
});

it('can filter a study by patient treatments', async () => {
const url = `${CBIOPORTAL_URL}/study/summary?id=lgg_ucsf_2014`;
await goToUrlAndSetLocalStorage(url);
Expand All @@ -1004,6 +1022,30 @@ describe('study view treatments table', () => {
const res = await checkElementWithMouseDisabled('#mainColumn');
assertScreenShotMatch(res);
});

it('compare button appears when selecting multiple rows in patient treatments', async () => {
const url = `${CBIOPORTAL_URL}/study/summary?id=lgg_ucsf_2014`;
await goToUrlAndSetLocalStorage(url);

const patientTreatmentsFirstCheckbox =
'[data-test="PATIENT_TREATMENTS-table"] .ReactVirtualized__Table__row:nth-child(1) input';
const patientTreatmentsSecondCheckbox =
'[data-test="PATIENT_TREATMENTS-table"] .ReactVirtualized__Table__row:nth-child(2) input';
const patientTreatmentsCompareButton =
'[data-test="table-compare-btn"]';

await (await getElement(patientTreatmentsFirstCheckbox)).waitForExist();
await clickElement(patientTreatmentsFirstCheckbox);
await (
await getElement(patientTreatmentsSecondCheckbox)
).waitForExist();
await clickElement(patientTreatmentsSecondCheckbox);
assert(
await (
await getElement(patientTreatmentsCompareButton)
).isExisting()
);
});
});

describe('study view mutations table', () => {
Expand Down
1 change: 1 addition & 0 deletions src/pages/studyView/charts/ChartContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ export class ChartContainer extends React.Component<IChartContainerProps, {}> {
content: (
<div
data-tour="mutated-genes-table-compare-btn"
data-test="table-compare-btn"
style={{ display: 'flex', alignItems: 'center' }}
>
<ComparisonVsIcon
Expand Down

0 comments on commit 0e43169

Please sign in to comment.