Skip to content

Commit 5731bc5

Browse files
authored
Merge branch 'main' into dev-v3-philosr-file-token-group-fix
2 parents cfdc954 + fb474aa commit 5731bc5

File tree

3 files changed

+22
-34
lines changed

3 files changed

+22
-34
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"start:integ": "cross-env NODE_ENV=development webpack serve --config pages/webpack.config.integ.cjs",
2626
"start:react18": "npm-run-all --parallel start:watch start:react18:dev",
2727
"start:react18:dev": "cross-env NODE_ENV=development REACT_VERSION=18 webpack serve --config pages/webpack.config.cjs",
28+
"postinstall": "prepare-package-lock",
2829
"prepare": "husky"
2930
},
3031
"dependencies": {
Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,35 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
3+
34
import { BasePageObject } from '@cloudscape-design/browser-test-tools/page-objects';
45
import useBrowser from '@cloudscape-design/browser-test-tools/use-browser';
56

6-
function setupTest(
7-
pageName: string,
8-
testFn: (parameters: {
9-
page: BasePageObject;
10-
getMarks: () => Promise<PerformanceMark[]>;
11-
getElementPerformanceMarkText: (id: string) => Promise<string>;
12-
}) => Promise<void>
13-
) {
14-
return useBrowser(async browser => {
15-
const page = new BasePageObject(browser);
16-
await browser.url(`#/light/button-dropdown/${pageName}`);
17-
const getMarks = async () => {
18-
await new Promise(r => setTimeout(r, 200));
19-
const marks = await browser.execute(() => performance.getEntriesByType('mark') as PerformanceMark[]);
20-
return marks.filter(m => m.detail?.source === 'awsui');
21-
};
22-
const getElementPerformanceMarkText = (id: string) => page.getText(`[data-analytics-performance-mark="${id}"]`);
23-
24-
await testFn({ page, getMarks, getElementPerformanceMarkText });
25-
});
7+
function getMarkSelector(mark: PerformanceMark) {
8+
return `[data-analytics-performance-mark="${mark.detail.instanceIdentifier}"]`;
269
}
2710

28-
describe('ButtonDropdown', () => {
29-
test(
30-
'Emits a single mark',
31-
setupTest('main-action', async ({ getMarks, getElementPerformanceMarkText }) => {
32-
const marks = await getMarks();
11+
test(
12+
'ButtonDropdown emits a single mark',
13+
useBrowser(async browser => {
14+
const page = new BasePageObject(browser);
15+
await browser.url('#/light/button-dropdown/main-action');
16+
await new Promise(r => setTimeout(r, 200));
17+
18+
await page.waitForAssertion(async () => {
19+
const allMarks = await browser.execute(() => performance.getEntriesByType('mark') as PerformanceMark[]);
20+
const awsuiMarks = allMarks.filter(m => m.detail?.source === 'awsui');
3321

34-
expect(marks).toHaveLength(1);
35-
expect(marks[0].name).toBe('primaryButtonRendered');
36-
expect(marks[0].detail).toMatchObject({
22+
expect(awsuiMarks).toHaveLength(1);
23+
expect(awsuiMarks[0].name).toBe('primaryButtonRendered');
24+
expect(awsuiMarks[0].detail).toMatchObject({
3725
source: 'awsui',
3826
instanceIdentifier: expect.any(String),
3927
loading: false,
4028
disabled: false,
4129
inViewport: true,
4230
text: 'Launch instance',
4331
});
44-
45-
await expect(getElementPerformanceMarkText(marks[0].detail.instanceIdentifier)).resolves.toBe('Launch instance');
46-
})
47-
);
48-
});
32+
await expect(page.getText(getMarkSelector(awsuiMarks[0]))).resolves.toBe('Launch instance');
33+
});
34+
})
35+
);

src/flashbar/__integ__/collapsible.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ describe('Collapsible Flashbar', () => {
135135
await page.setWindowSize(windowDimensions);
136136
await page.toggleCollapsedState();
137137
expect(await page.getNotificationBarBottom()).toBeGreaterThan(windowDimensions.height);
138-
await page.windowScrollTo({ top: 1200 });
139138
await page.waitForAssertion(async () => {
139+
await page.windowScrollTo({ top: 1200 });
140140
await expect(page.getNotificationBarBottom()).resolves.toBeLessThan(windowDimensions.height);
141141
});
142142
})

0 commit comments

Comments
 (0)