Skip to content

Commit

Permalink
chore: Remove local override to enable scrollbars in integration tests (
Browse files Browse the repository at this point in the history
  • Loading branch information
jperals authored Jan 17, 2025
1 parent e51dbde commit e62a074
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 99 deletions.
4 changes: 4 additions & 0 deletions src/__integ__/scrollbars.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

export const scrollbarThickness = 15;
86 changes: 0 additions & 86 deletions src/__integ__/use-browser-with-scrollbars.ts

This file was deleted.

3 changes: 2 additions & 1 deletion src/app-layout/__integ__/app-layout-drawers.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { BasePageObject } from '@cloudscape-design/browser-test-tools/page-objects';
import useBrowser from '@cloudscape-design/browser-test-tools/use-browser';

import createWrapper from '../../../lib/components/test-utils/selectors';
import useBrowser, { scrollbarThickness } from '../../__integ__/use-browser-with-scrollbars';
import { scrollbarThickness } from '../../__integ__/scrollbars';
import { viewports } from './constants';
import { testIf } from './utils';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { BasePageObject } from '@cloudscape-design/browser-test-tools/page-objects';
import useBrowser from '@cloudscape-design/browser-test-tools/use-browser';

import createWrapper from '../../../lib/components/test-utils/selectors';
import useBrowser, { scrollbarThickness } from '../../__integ__/use-browser-with-scrollbars';
import { scrollbarThickness } from '../../__integ__/scrollbars';
import { viewports } from './constants';
import { getUrlParams, Theme } from './utils';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import useBrowser from '@cloudscape-design/browser-test-tools/use-browser';

import createWrapper from '../../../lib/components/test-utils/selectors';
import useBrowser from '../../__integ__/use-browser-with-scrollbars';
import { scrollbarThickness } from '../../__integ__/scrollbars';
import { viewports } from './constants';
import { AppLayoutSplitViewPage } from './utils';

Expand Down Expand Up @@ -42,8 +44,6 @@ describe('Split panel forced position', () => {
'refresh-toolbar': 907,
};

const scrollbarThickness = 15;

const narrow = splitPanelBreakpoints[theme];

// Account 2 times for scrollbarThickness:
Expand Down
4 changes: 3 additions & 1 deletion src/app-layout/__integ__/app-layout-split-panel.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import useBrowser from '@cloudscape-design/browser-test-tools/use-browser';

import createWrapper from '../../../lib/components/test-utils/selectors';
import useBrowser, { scrollbarThickness } from '../../__integ__/use-browser-with-scrollbars';
import { scrollbarThickness } from '../../__integ__/scrollbars';
import { viewports } from './constants';
import { AppLayoutSplitViewPage } from './utils';

Expand Down
2 changes: 1 addition & 1 deletion src/app-layout/__integ__/mobile.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { BasePageObject } from '@cloudscape-design/browser-test-tools/page-objects';
import useBrowser from '@cloudscape-design/browser-test-tools/use-browser';

import createWrapper from '../../../lib/components/test-utils/selectors';
import useBrowser from '../../__integ__/use-browser-with-scrollbars';
import { viewports } from './constants';
import { testIf } from './utils';

Expand Down
4 changes: 2 additions & 2 deletions src/app-layout/__integ__/navigation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
// SPDX-License-Identifier: Apache-2.0

import { BasePageObject } from '@cloudscape-design/browser-test-tools/page-objects';
import useBrowser from '@cloudscape-design/browser-test-tools/use-browser';

import createWrapper from '../../../lib/components/test-utils/selectors';
import useBrowserWithScrollbars from '../../__integ__/use-browser-with-scrollbars';
import { getUrlParams, Theme } from './utils';

const wrapper = createWrapper().findAppLayout().findNavigation();

function setupTest(testFn: (page: BasePageObject) => Promise<void>, theme: Theme) {
return useBrowserWithScrollbars(async browser => {
return useBrowser(async browser => {
const page = new BasePageObject(browser);
const params = getUrlParams(theme);
await browser.url(`#/light/app-layout/navigation-with-scrollbar?${params}`);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { BasePageObject } from '@cloudscape-design/browser-test-tools/page-objects';
import useBrowser from '@cloudscape-design/browser-test-tools/use-browser';

import createWrapper from '../../../lib/components/test-utils/selectors';
import useBrowser from '../../__integ__/use-browser-with-scrollbars';
import { getUrlParams, Theme } from './utils';

const wrapper = createWrapper().findAppLayout();
Expand Down
2 changes: 1 addition & 1 deletion src/app-layout/__integ__/runtime-drawers.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { BasePageObject } from '@cloudscape-design/browser-test-tools/page-objects';
import useBrowser from '@cloudscape-design/browser-test-tools/use-browser';

import createWrapper, { AppLayoutWrapper } from '../../../lib/components/test-utils/selectors';
import useBrowser from '../../__integ__/use-browser-with-scrollbars';
import { viewports } from './constants';
import { getUrlParams, Theme } from './utils';

Expand Down
2 changes: 1 addition & 1 deletion src/cards/__integ__/responsive.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { BasePageObject } from '@cloudscape-design/browser-test-tools/page-objects';
import useBrowser from '@cloudscape-design/browser-test-tools/use-browser';

import createWrapper, { CardsWrapper } from '../../../lib/components/test-utils/selectors';
import useBrowser from '../../__integ__/use-browser-with-scrollbars';

class CardsPage extends BasePageObject {
wrapper = new CardsWrapper(createWrapper('body').find(`.${CardsWrapper.rootSelector}`).getElement());
Expand Down
3 changes: 2 additions & 1 deletion src/date-picker/__integ__/fit-dropdown.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
// SPDX-License-Identifier: Apache-2.0
import { strict as assert } from 'assert';

import useBrowser from '@cloudscape-design/browser-test-tools/use-browser';

import createWrapper from '../../../lib/components/test-utils/selectors';
import useBrowser from '../../__integ__/use-browser-with-scrollbars';
import DatePickerPage from './page-objects/date-picker-page';

class DatePickerDropdownTestPage extends DatePickerPage {
Expand Down

0 comments on commit e62a074

Please sign in to comment.