Skip to content

Commit

Permalink
fix horizontal bars issues and add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryan Lai committed Jan 21, 2025
1 parent 3441ed0 commit a9f5d3d
Show file tree
Hide file tree
Showing 13 changed files with 91 additions and 3 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
84 changes: 82 additions & 2 deletions end-to-end-test/remote/specs/core/plots.screenshot.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,19 +189,51 @@ describe('plots tab screenshot tests', function() {
});
await waitForAndCheckPlotsTab();
});
it('plots tab clinical vs clinical stacked bar plot sort by number of samples', async () => {
await browser.execute(() => {
resultsViewPlotsTab.handleSortByChange({
value: 'SortByTotalSum',
});
});
await waitForAndCheckPlotsTab();
});
it('plots tab clinical vs clinical stacked bar plot sort by category', async () => {
await browser.execute(() => {
resultsViewPlotsTab.handleSortByChange({
value: 'Stage I',
});
});
await waitForAndCheckPlotsTab();
});
//commenting this for now because of https://github.com/zinserjan/wdio-screenshot/issues/87
/* it("plots tab clinical vs clinical grouped bar plot", () => {
await browser.execute(() => { resultsViewPlotsTab.onDiscreteVsDiscretePlotTypeSelect({ value: "Bar" }); });
await waitForAndCheckPlotsTab();
}); */
it('plots tab clinical vs clinical percentage stacked bar plot', async () => {
it('plots tab clinical vs clinical percentage stacked bar plot sort by category', async () => {
await browser.execute(() => {
resultsViewPlotsTab.onDiscreteVsDiscretePlotTypeSelect({
value: 'PercentageStackedBar',
});
});
await waitForAndCheckPlotsTab();
});
it('plots tab clinical vs clinical percentage stacked bar plot sort by number of samples', async () => {
await browser.execute(() => {
resultsViewPlotsTab.handleSortByChange({
value: 'SortByTotalSum',
});
});
await waitForAndCheckPlotsTab();
});
it('plots tab clinical vs clinical percentage stacked bar plot', async () => {
await browser.execute(() => {
resultsViewPlotsTab.handleSortByChange({
value: 'alphabetically',
});
});
await waitForAndCheckPlotsTab();
});
it('plots tab clinical vs clinical horizontal stacked bar plot', async () => {
await browser.execute(() => {
resultsViewPlotsTab.onDiscreteVsDiscretePlotTypeSelect({
Expand All @@ -214,14 +246,46 @@ describe('plots tab screenshot tests', function() {
await clickElement('input[data-test="horizontalBars"]');
await waitForAndCheckPlotsTab();
});
it('plots tab clinical vs clinical horizontal grouped bar plot', async () => {
it('plots tab clinical vs clinical horizontal stacked bar plot sort by number of samples', async () => {
await browser.execute(() => {
resultsViewPlotsTab.handleSortByChange({
value: 'SortByTotalSum',
});
});
await waitForAndCheckPlotsTab();
});
it('plots tab clinical vs clinical horizontal stacked bar plot sort by category', async () => {
await browser.execute(() => {
resultsViewPlotsTab.handleSortByChange({
value: 'T2',
});
});
await waitForAndCheckPlotsTab();
});
it('plots tab clinical vs clinical horizontal grouped bar plot sort by category', async () => {
await browser.execute(() => {
resultsViewPlotsTab.onDiscreteVsDiscretePlotTypeSelect({
value: 'Bar',
});
});
await waitForAndCheckPlotsTab();
});
it('plots tab clinical vs clinical horizontal grouped bar plot sort by number of samples', async () => {
await browser.execute(() => {
resultsViewPlotsTab.handleSortByChange({
value: 'SortByTotalSum',
});
});
await waitForAndCheckPlotsTab();
});
it('plots tab clinical vs clinical horizontal grouped bar plot', async () => {
await browser.execute(() => {
resultsViewPlotsTab.handleSortByChange({
value: 'alphabetically',
});
});
await waitForAndCheckPlotsTab();
});
it('plots tab clinical vs clinical horizontal percentage stacked bar plot', async () => {
await browser.execute(() => {
resultsViewPlotsTab.onDiscreteVsDiscretePlotTypeSelect({
Expand All @@ -230,6 +294,22 @@ describe('plots tab screenshot tests', function() {
});
await waitForAndCheckPlotsTab();
});
it('plots tab clinical vs clinical horizontal percentage stacked bar plot sort by number of samples', async () => {
await browser.execute(() => {
resultsViewPlotsTab.handleSortByChange({
value: 'SortByTotalSum',
});
});
await waitForAndCheckPlotsTab();
});
it('plots tab clinical vs clinical horizontal percentage stacked bar plot sort by category', async () => {
await browser.execute(() => {
resultsViewPlotsTab.handleSortByChange({
value: 'T2',
});
});
await waitForAndCheckPlotsTab();
});
it('plots tab clinical vs clinical table plot', async () => {
await (
await getElement('input[data-test="horizontalBars"]')
Expand Down
6 changes: 5 additions & 1 deletion src/shared/components/plots/MultipleCategoryBarPlot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -944,8 +944,12 @@ export default class MultipleCategoryBarPlot extends React.Component<
}
}

componentDidUpdate() {
componentDidUpdate(prevProps: IMultipleCategoryBarPlotProps) {
this.updateLegendWidth();

if (this.props.horizontalBars !== prevProps.horizontalBars) {
this.setInitialSelectedOption();
}
}

render() {
Expand Down
4 changes: 4 additions & 0 deletions src/shared/components/plots/PlotsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1782,6 +1782,10 @@ export default class PlotsTab extends React.Component<IPlotsTabProps, {}> {
break;
case EventKey.utilities_horizontalBars:
this.horizontalBars = !this.horizontalBars;
this.handleSortByChange({
value: SortByOptions.Alphabetically,
label: 'Alphabetically',
});
break;
case EventKey.utilities_viewLimitValues:
this.viewLimitValues = !this.viewLimitValues;
Expand Down

0 comments on commit a9f5d3d

Please sign in to comment.