Skip to content

Commit 7d83a86

Browse files
committed
fix: use stable element in example of toMatchScreenshot assertions
1 parent 825fee5 commit 7d83a86

6 files changed

Lines changed: 14 additions & 6 deletions

File tree

2.71 KB
Loading
-2.35 KB
Binary file not shown.
-2.8 KB
Binary file not shown.

autotests/pageObjects/pages/E2edReportExample/E2edReportExample.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
} from 'autotests/actions';
55
import {setPageCookies, setPageRequestHeaders} from 'autotests/context';
66
import {E2edReportExample as E2edReportExampleRoute} from 'autotests/routes/pageRoutes';
7-
import {locator} from 'autotests/selectors';
7+
import {createSelector, locator} from 'autotests/selectors';
88
import {Page} from 'e2ed';
99
import {setReadonlyProperty} from 'e2ed/utils';
1010

@@ -20,6 +20,11 @@ type CustomPageParams =
2020
* The e2ed report example page.
2121
*/
2222
export class E2edReportExample extends Page<CustomPageParams> {
23+
/**
24+
* Page header.
25+
*/
26+
readonly header: Selector = createSelector('.header');
27+
2328
/**
2429
* Navigation bar with test retries.
2530
*/
@@ -36,6 +41,9 @@ export class E2edReportExample extends Page<CustomPageParams> {
3641
readonly navigationRetriesButtonSelected: Selector =
3742
this.navigationRetriesButton.filterByLocatorParameter('selected', 'true');
3843

44+
/**
45+
* Page navigation timeout.
46+
*/
3947
override readonly navigationTimeout = 5_000;
4048

4149
/**

autotests/tests/e2edReportExample/toMatchScreenshot.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import {navigateToPage} from 'e2ed/actions';
66
test('correctly check screenshots via toMatchScreenshot', {meta: {testId: '20'}}, async () => {
77
const reportPage = await navigateToPage(E2edReportExample);
88

9-
await expect(
10-
reportPage.navigationRetries,
11-
'toMatchScreenshot check screenshot',
12-
).toMatchScreenshot('j7YZV5CFWu', {mask: []});
9+
await expect(reportPage.header, 'toMatchScreenshot check screenshot').toMatchScreenshot(
10+
'Nzq9MAYNp1',
11+
{mask: []},
12+
);
1313
});

src/utils/report/render/renderNavigation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type Props = Readonly<{retries: readonly RetryProps[]}>;
1515
export const renderNavigation = ({
1616
retries,
1717
}: Props): SafeHtml => sanitizeHtml`<nav class="nav" ${locator('Navigation')}>
18-
<header class="header">
18+
<header class="header" ${locator('header')}>
1919
${renderLogo()}
2020
</header>
2121
${renderRetriesButtons({retries})}

0 commit comments

Comments
 (0)