Skip to content

Commit

Permalink
chore(Bundles): tablet cells e2e test [YTFRONT-3772]
Browse files Browse the repository at this point in the history
  • Loading branch information
SimbiozizV committed Dec 13, 2024
1 parent 6710c0b commit 002942b
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions packages/ui/tests/screenshots/pages/bundles/bundles.base.screen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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});
Expand Down Expand Up @@ -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();

Check failure on line 106 in packages/ui/tests/screenshots/pages/bundles/bundles.base.screen.ts

View workflow job for this annotation

GitHub Actions / E2E-screenshots for 'Local'

[chromium] › pages/bundles/bundles.base.screen.ts:99:5 › Bundles - List - Tablet cells

1) [chromium] › pages/bundles/bundles.base.screen.ts:99:5 › Bundles - List - Tablet cells ──────── Error: Screenshot comparison failed: 434 pixels (ratio 0.01 of all image pixels) are different. Expected: /actions-runner/_work/ytsaurus-ui/ytsaurus-ui/packages/ui/tests/screenshots/pages/bundles/bundles.base.screen.ts-snapshots/Bundles---List---Tablet-cells-1-chromium-linux.png Received: /actions-runner/_work/ytsaurus-ui/ytsaurus-ui/packages/ui/tests/test-results/pages-bundles-bundles.base-00500-ndles---List---Tablet-cells-chromium/Bundles---List---Tablet-cells-1-actual.png Diff: /actions-runner/_work/ytsaurus-ui/ytsaurus-ui/packages/ui/tests/test-results/pages-bundles-bundles.base-00500-ndles---List---Tablet-cells-chromium/Bundles---List---Tablet-cells-1-diff.png Call log: - expect.toHaveScreenshot with timeout 5000ms - verifying given screenshot expectation - taking page screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - 434 pixels (ratio 0.01 of all image pixels) are different. - waiting 100ms before taking screenshot - taking page screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - captured a stable screenshot - 434 pixels (ratio 0.01 of all image pixels) are different. 104 | await bundles(page).replaceTabletCells(); 105 | > 106 | await expect(page).toHaveScreenshot(); | ^ 107 | 108 | await page.click('input[placeholder="Enter bundle name..."]'); 109 | await page.waitForSelector('.g-popup_open'); at /actions-runner/_work/ytsaurus-ui/ytsaurus-ui/packages/ui/tests/screenshots/pages/bundles/bundles.base.screen.ts:106:24

Check failure on line 106 in packages/ui/tests/screenshots/pages/bundles/bundles.base.screen.ts

View workflow job for this annotation

GitHub Actions / E2E-screenshots for 'Local'

[chromium] › pages/bundles/bundles.base.screen.ts:99:5 › Bundles - List - Tablet cells

1) [chromium] › pages/bundles/bundles.base.screen.ts:99:5 › Bundles - List - Tablet cells ──────── Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: Screenshot comparison failed: 434 pixels (ratio 0.01 of all image pixels) are different. Expected: /actions-runner/_work/ytsaurus-ui/ytsaurus-ui/packages/ui/tests/screenshots/pages/bundles/bundles.base.screen.ts-snapshots/Bundles---List---Tablet-cells-1-chromium-linux.png Received: /actions-runner/_work/ytsaurus-ui/ytsaurus-ui/packages/ui/tests/test-results/pages-bundles-bundles.base-00500-ndles---List---Tablet-cells-chromium-retry1/Bundles---List---Tablet-cells-1-actual.png Diff: /actions-runner/_work/ytsaurus-ui/ytsaurus-ui/packages/ui/tests/test-results/pages-bundles-bundles.base-00500-ndles---List---Tablet-cells-chromium-retry1/Bundles---List---Tablet-cells-1-diff.png Call log: - expect.toHaveScreenshot with timeout 5000ms - verifying given screenshot expectation - taking page screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - 434 pixels (ratio 0.01 of all image pixels) are different. - waiting 100ms before taking screenshot - taking page screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - captured a stable screenshot - 434 pixels (ratio 0.01 of all image pixels) are different. 104 | await bundles(page).replaceTabletCells(); 105 | > 106 | await expect(page).toHaveScreenshot(); | ^ 107 | 108 | await page.click('input[placeholder="Enter bundle name..."]'); 109 | await page.waitForSelector('.g-popup_open'); at /actions-runner/_work/ytsaurus-ui/ytsaurus-ui/packages/ui/tests/screenshots/pages/bundles/bundles.base.screen.ts:106:24

Check failure on line 106 in packages/ui/tests/screenshots/pages/bundles/bundles.base.screen.ts

View workflow job for this annotation

GitHub Actions / E2E-screenshots for 'Local'

[chromium] › pages/bundles/bundles.base.screen.ts:99:5 › Bundles - List - Tablet cells

1) [chromium] › pages/bundles/bundles.base.screen.ts:99:5 › Bundles - List - Tablet cells ──────── Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: Screenshot comparison failed: 434 pixels (ratio 0.01 of all image pixels) are different. Expected: /actions-runner/_work/ytsaurus-ui/ytsaurus-ui/packages/ui/tests/screenshots/pages/bundles/bundles.base.screen.ts-snapshots/Bundles---List---Tablet-cells-1-chromium-linux.png Received: /actions-runner/_work/ytsaurus-ui/ytsaurus-ui/packages/ui/tests/test-results/pages-bundles-bundles.base-00500-ndles---List---Tablet-cells-chromium-retry2/Bundles---List---Tablet-cells-1-actual.png Diff: /actions-runner/_work/ytsaurus-ui/ytsaurus-ui/packages/ui/tests/test-results/pages-bundles-bundles.base-00500-ndles---List---Tablet-cells-chromium-retry2/Bundles---List---Tablet-cells-1-diff.png Call log: - expect.toHaveScreenshot with timeout 5000ms - verifying given screenshot expectation - taking page screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - 434 pixels (ratio 0.01 of all image pixels) are different. - waiting 100ms before taking screenshot - taking page screenshot - disabled all CSS animations - waiting for fonts to load... - fonts loaded - captured a stable screenshot - 434 pixels (ratio 0.01 of all image pixels) are different. 104 | await bundles(page).replaceTabletCells(); 105 | > 106 | await expect(page).toHaveScreenshot(); | ^ 107 | 108 | await page.click('input[placeholder="Enter bundle name..."]'); 109 | await page.waitForSelector('.g-popup_open'); at /actions-runner/_work/ytsaurus-ui/ytsaurus-ui/packages/ui/tests/screenshots/pages/bundles/bundles.base.screen.ts:106:24

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`));

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 002942b

Please sign in to comment.