Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(Bundles): tablet cells e2e test [YTFRONT-3772] #916

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import {BasePage} from '../../../utils/BasePage';
import {replaceInnerHtml} from '../../../utils/dom';

const ID_PLACEHOLDER = 'X-XXX-XXXXX-XXXXXXXX';

class Bundles extends BasePage {
async replaceDefaultColumns() {
await replaceInnerHtml(this.page, {
Expand Down Expand Up @@ -37,6 +39,48 @@

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((placeholder) => {
const title = document.querySelector<HTMLDivElement>('.elements-modal__header span');
if (!title) return;

const id = title.textContent?.trim();
if (!id) return;

title.innerHTML = placeholder;

const spans = document.querySelectorAll<HTMLSpanElement>('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"';
}
if (text === `"${id}"`) {
span.innerHTML = placeholder;
}
});
}, ID_PLACEHOLDER);
}
}

const bundles = (page: Page) => new Bundles({page});
Expand Down Expand Up @@ -65,6 +109,29 @@
await expect(page).toHaveScreenshot();
});

test('Bundles - List - Tablet cells', async ({page}) => {
await page.goto(
makeClusterUrl(`tablet_cell_bundles/tablet_cells?sortBy=column-bundle,order-undefined-asc`),
);
await page.waitForSelector('.cells-table');
await bundles(page).replaceTabletCells();

await expect(page).toHaveScreenshot();

Check failure on line 119 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:112:5 › Bundles - List - Tablet cells

1) [chromium] › pages/bundles/bundles.base.screen.ts:112:5 › Bundles - List - Tablet cells ─────── Error: Screenshot comparison failed: 148 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 - 148 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 - 148 pixels (ratio 0.01 of all image pixels) are different. 117 | await bundles(page).replaceTabletCells(); 118 | > 119 | await expect(page).toHaveScreenshot(); | ^ 120 | 121 | await page.click('input[placeholder="Enter bundle name..."]'); 122 | await page.waitForSelector('.g-popup_open'); at /actions-runner/_work/ytsaurus-ui/ytsaurus-ui/packages/ui/tests/screenshots/pages/bundles/bundles.base.screen.ts:119:24

Check failure on line 119 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:112:5 › Bundles - List - Tablet cells

1) [chromium] › pages/bundles/bundles.base.screen.ts:112:5 › Bundles - List - Tablet cells ─────── Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: Screenshot comparison failed: 148 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 - 148 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 - 148 pixels (ratio 0.01 of all image pixels) are different. 117 | await bundles(page).replaceTabletCells(); 118 | > 119 | await expect(page).toHaveScreenshot(); | ^ 120 | 121 | await page.click('input[placeholder="Enter bundle name..."]'); 122 | await page.waitForSelector('.g-popup_open'); at /actions-runner/_work/ytsaurus-ui/ytsaurus-ui/packages/ui/tests/screenshots/pages/bundles/bundles.base.screen.ts:119:24

Check failure on line 119 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:112:5 › Bundles - List - Tablet cells

1) [chromium] › pages/bundles/bundles.base.screen.ts:112:5 › Bundles - List - Tablet cells ─────── Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: Screenshot comparison failed: 148 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 - 148 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 - 148 pixels (ratio 0.01 of all image pixels) are different. 117 | await bundles(page).replaceTabletCells(); 118 | > 119 | await expect(page).toHaveScreenshot(); | ^ 120 | 121 | await page.click('input[placeholder="Enter bundle name..."]'); 122 | await page.waitForSelector('.g-popup_open'); at /actions-runner/_work/ytsaurus-ui/ytsaurus-ui/packages/ui/tests/screenshots/pages/bundles/bundles.base.screen.ts:119:24

await page.click('input[placeholder="Enter bundle name..."]');
await page.waitForSelector('.g-popup_open');
await page.click('.suggest__item[title="default"]');
await page.mouse.move(0, 0);

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.
Loading