Skip to content

Commit

Permalink
refactor: remove url parameter from disableAnimations
Browse files Browse the repository at this point in the history
  • Loading branch information
rshen91 committed Dec 6, 2020
1 parent 02a2555 commit 5bdb611
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
6 changes: 3 additions & 3 deletions integration/page_objects/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ class CommonPage {
options?: Omit<ScreenshotElementAtUrlOptions, 'action'>,
) {
const action = async () => {
await this.disableAnimations('http://localhost:9001/?path=/story/legend--right');
await this.disableAnimations();
await this.clickMouseRelativeToDOMElement({ top: 242, left: 910 }, this.chartSelector);
// eslint-disable-next-line no-restricted-syntax
for (const actions of keyboardEvents) {
Expand Down Expand Up @@ -440,8 +440,8 @@ class CommonPage {
});
}

async disableAnimations(url: string) {
await this.loadElementFromURL(url, '#story-root');
async disableAnimations() {
// await this.loadElementFromURL(url, '#story-root');
await page.evaluate(() => {
document.querySelector('#story-root')!.classList.add('disable-animations');
});
Expand Down
10 changes: 4 additions & 6 deletions integration/tests/area_stories.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,8 @@ describe('Area series stories', () => {

it('shows only positive values when hiding negative one', async () => {
const action = async () => {
await common.disableAnimations(
'http://localhost:9001/?path=/story/area-chart--with-negative-and-positive&knob-Y scale=log',
);
await common.disableAnimations();
// 'http://localhost:9001/?path=/story/area-chart--with-negative-and-positive&knob-Y scale=log',
await page.click('.echLegendItem:nth-child(2) .echLegendItem__label');
};
await common.expectChartAtUrlToMatchScreenshot(
Expand All @@ -90,9 +89,8 @@ describe('Area series stories', () => {

it('shows only negative values when hiding positive one', async () => {
const action = async () => {
await common.disableAnimations(
'http://localhost:9001/?path=/story/area-chart--with-negative-and-positive&knob-Y scale=log',
);
await common.disableAnimations();
// 'http://localhost:9001/?path=/story/area-chart--with-negative-and-positive&knob-Y scale=log',
await page.click('.echLegendItem:nth-child(1) .echLegendItem__label');
};
await common.expectChartAtUrlToMatchScreenshot(
Expand Down
3 changes: 0 additions & 3 deletions integration/tests/legend_stories.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ describe('Legend stories', () => {
});
});
describe('keyboard navigation', () => {
beforeEach(async () => {
await common.disableAnimations('http://localhost:9001/?path=/story/legend--right');
});
// eslint-disable-next-line jest/expect-expect
it('should navigate to legend item with tab', async () => {
await common.expectChartWithKeyboardEventsAtUrlToMatchScreenshot(
Expand Down

0 comments on commit 5bdb611

Please sign in to comment.