diff --git a/packages/ui/tests/screenshots/pages/bundles/bundles.base.screen.ts b/packages/ui/tests/screenshots/pages/bundles/bundles.base.screen.ts index 04bc1a34d..390de1fb7 100644 --- a/packages/ui/tests/screenshots/pages/bundles/bundles.base.screen.ts +++ b/packages/ui/tests/screenshots/pages/bundles/bundles.base.screen.ts @@ -37,6 +37,37 @@ class Bundles extends BasePage { await this.waitForTableSyncedWidth('.cells-table', {useResizeEvent: true}); } + + async replaceTabletCells() { + await replaceInnerHtml(this.page, { + '.cells-table__id-id': '1-XXXX-XXXXX-XXXXXXXXX', + '.cells-table__td_col_tablets .cells-table__wrapped': '7', + '.cells-table__td_col_memory .cells-table__wrapped': '0 B', + '.cells-table__td_col_uncompressed .cells-table__wrapped': '000 KiB', + '.cells-table__td_col_compressed .cells-table__wrapped': '000 KiB', + '.cells-table__td_col_peeraddress .g-link': 'local:00', + }); + await this.waitForTableSyncedWidth('.data-table', {useResizeEvent: true}); + } + + async replaceAttributesTime() { + await this.page.waitForSelector('pre.unipika span.string'); + await this.page.evaluate(() => { + const spans = document.querySelectorAll('pre.unipika span.string'); + const isoTimeRegex = new RegExp(/^"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{6}Z"$/); + const hostRegex = new RegExp(/^"localhost:\d+"$/); + spans.forEach((span) => { + const text = span.textContent?.trim(); + if (!text) return; + if (text.match(isoTimeRegex)) { + span.innerHTML = '"1970-01-01T00:00:00.000Z"'; + } + if (text.match(hostRegex)) { + span.innerHTML = '"localhost:00"'; + } + }); + }); + } } const bundles = (page: Page) => new Bundles({page}); @@ -65,6 +96,28 @@ test('Bundles - List - Tablets memory', async ({page}) => { await expect(page).toHaveScreenshot(); }); +test('Bundles - List - Tablet cells', async ({page}) => { + await page.goto( + makeClusterUrl(`tablet_cell_bundles/tablet_cells?sortBy=column-id,order-asc-undefined`), + ); + await page.waitForSelector('.cells-table'); + await bundles(page).replaceTabletCells(); + + await expect(page).toHaveScreenshot(); + + await page.click('input[placeholder="Enter bundle name..."]'); + await page.waitForSelector('.g-popup_open'); + await page.click('.suggest__item[title="default"]'); + + await expect(page).toHaveScreenshot(); + + await page.click('.cells-table__actions button'); + await page.waitForSelector('pre.unipika'); + await bundles(page).replaceAttributesTime(); + + await expect(page).toHaveScreenshot(); +}); + test('Bundles - Active bundle', async ({page}) => { await page.goto(makeClusterUrl(`tablet_cell_bundles/tablet_cells?activeBundle=e2e-bundle`)); diff --git a/packages/ui/tests/screenshots/pages/bundles/bundles.base.screen.ts-snapshots/Bundles---List---Tablet-cells-1-chromium-linux.png b/packages/ui/tests/screenshots/pages/bundles/bundles.base.screen.ts-snapshots/Bundles---List---Tablet-cells-1-chromium-linux.png new file mode 100644 index 000000000..85018f41f Binary files /dev/null and b/packages/ui/tests/screenshots/pages/bundles/bundles.base.screen.ts-snapshots/Bundles---List---Tablet-cells-1-chromium-linux.png differ diff --git a/packages/ui/tests/screenshots/pages/bundles/bundles.base.screen.ts-snapshots/Bundles---List---Tablet-cells-2-chromium-linux.png b/packages/ui/tests/screenshots/pages/bundles/bundles.base.screen.ts-snapshots/Bundles---List---Tablet-cells-2-chromium-linux.png new file mode 100644 index 000000000..ef54d834a Binary files /dev/null and b/packages/ui/tests/screenshots/pages/bundles/bundles.base.screen.ts-snapshots/Bundles---List---Tablet-cells-2-chromium-linux.png differ diff --git a/packages/ui/tests/screenshots/pages/bundles/bundles.base.screen.ts-snapshots/Bundles---List---Tablet-cells-3-chromium-linux.png b/packages/ui/tests/screenshots/pages/bundles/bundles.base.screen.ts-snapshots/Bundles---List---Tablet-cells-3-chromium-linux.png new file mode 100644 index 000000000..5c5a35374 Binary files /dev/null and b/packages/ui/tests/screenshots/pages/bundles/bundles.base.screen.ts-snapshots/Bundles---List---Tablet-cells-3-chromium-linux.png differ