Skip to content

Commit 90afa36

Browse files
authored
NTP: Expand screenshot tests (#2096)
* Default ?omnibar to true * Expand NTP screenshot tests * Add CPM snapshots * Use playwright projects instead of forEach * Disable omnibar in favorites int tests
1 parent ed9e49b commit 90afa36

File tree

86 files changed

+272
-163
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+272
-163
lines changed

special-pages/pages/new-tab/app/favorites/integration-tests/favorites.spec.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,16 @@ test.describe('newtab favorites', () => {
6969
const ntp = NewtabPage.create(page, workerInfo);
7070
const favorites = new FavoritesPage(ntp);
7171
await ntp.reducedMotion();
72-
await ntp.openPage();
72+
await ntp.openPage({ additional: { omnibar: 'false' } });
7373
await favorites.tabsThroughItems();
7474
});
7575
test('initial empty state', async ({ page }, workerInfo) => {
7676
const ntp = NewtabPage.create(page, workerInfo);
7777
const favorites = new FavoritesPage(ntp);
7878
await ntp.reducedMotion();
7979
// Use cpm: 'null' to enable new UI with InfoIcon for tab navigation test
80-
await ntp.openPage({ favorites: 0, additional: { cpm: 'null' } });
80+
// Use omnibar: 'false' to hide omnibar so tab order is predictable
81+
await ntp.openPage({ favorites: 0, additional: { cpm: 'null', omnibar: 'false' } });
8182
await favorites.tabsPastEmptyFavorites();
8283
});
8384
test('re-orders items', async ({ page }, workerInfo) => {

special-pages/pages/new-tab/app/mock-transport.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ export function initialSetup(url) {
585585
widgetsFromStorage.push({ id: 'protections' });
586586
widgetConfigFromStorage.push({ id: 'protections', visibility: 'visible' });
587587

588-
if (url.searchParams.has('omnibar')) {
588+
if (url.searchParams.get('omnibar') !== 'false') {
589589
const favoritesWidgetIndex = widgetsFromStorage.findIndex((widget) => widget.id === 'favorites') ?? 0;
590590
widgetsFromStorage.splice(favoritesWidgetIndex, 0, { id: 'omnibar' });
591591
const favoritesWidgetConfigIndex = widgetConfigFromStorage.findIndex((widget) => widget.id === 'favorites') ?? 0;

special-pages/pages/new-tab/integration-tests/new-tab.page.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,13 @@ export class NewtabPage {
123123
}
124124

125125
for (const [key, value] of Object.entries(additional || {})) {
126-
searchParams.set(key, value);
126+
if (Array.isArray(value)) {
127+
for (const item of value) {
128+
searchParams.append(key, item);
129+
}
130+
} else {
131+
searchParams.set(key, value);
132+
}
127133
}
128134

129135
// eslint-disable-next-line no-undef

special-pages/pages/new-tab/integration-tests/new-tab.screenshots.spec.js

Lines changed: 233 additions & 158 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)