diff --git a/.github/workflows/pr-playwright-report.yml b/.github/workflows/pr-playwright-report.yml index 5cbeb78..8716a05 100644 --- a/.github/workflows/pr-playwright-report.yml +++ b/.github/workflows/pr-playwright-report.yml @@ -27,7 +27,7 @@ jobs: AWS_SECRET_ACCESS_KEY: ${{ secrets.STORYBOOK_S3_SECRET_KEY }} AWS_DEFAULT_REGION: ru-central1 AWS_EC2_METADATA_DISABLED: true - run: aws s3 cp playwright-report s3://playwright-reports/page-constructor/pulls/${{ steps.pr.outputs.id }}/ --endpoint-url=https://storage.yandexcloud.net --recursive + run: aws s3 cp playwright-report s3://playwright-reports/blog-constructor/pulls/${{ steps.pr.outputs.id }}/ --endpoint-url=https://storage.yandexcloud.net --recursive shell: bash - name: Create Comment uses: marocchino/sticky-pull-request-comment@v2 @@ -35,4 +35,4 @@ jobs: GITHUB_TOKEN: ${{ secrets.GRAVITY_UI_BOT_GITHUB_TOKEN }} number: ${{ steps.pr.outputs.id }} header: playwright test - message: '[Playwright Test Component](https://storage.yandexcloud.net/playwright-reports/page-constructor/pulls/${{ steps.pr.outputs.id }}/index.html) is ready.' + message: '[Playwright Test Component](https://storage.yandexcloud.net/playwright-reports/blog-constructor/pulls/${{ steps.pr.outputs.id }}/index.html) is ready.' diff --git a/playwright/core/expectScreenshotFixture.ts b/playwright/core/expectScreenshotFixture.ts index 320ea9b..f81ee55 100644 --- a/playwright/core/expectScreenshotFixture.ts +++ b/playwright/core/expectScreenshotFixture.ts @@ -1,6 +1,5 @@ import {expect} from '@playwright/experimental-ct-react'; -import type {JSHandle, Locator, PageScreenshotOptions} from '@playwright/test'; -import {isFunction} from 'lodash'; +import type {Locator, PageScreenshotOptions} from '@playwright/test'; import {DEFAULT_MOUNT_TEST_DELAY} from './constants'; import type {PlaywrightFixture} from './types'; @@ -8,7 +7,6 @@ import type {PlaywrightFixture} from './types'; interface CaptureScreenshotParams extends PageScreenshotOptions { screenshotName?: string; component?: Locator; - waitingFunction?: JSHandle; skipTheme?: 'light' | 'dark'; } @@ -24,11 +22,10 @@ export const expectScreenshotFixture: PlaywrightFixture const expectScreenshot: ExpectScreenshotFixture = async ({ component, screenshotName, - waitingFunction, skipTheme, ...pageScreenshotOptions } = {}) => { - const captureScreenshot = async (waitingFunctionLocal?: JSHandle) => { + const captureScreenshot = async () => { const locators = await page.locator('//img').all(); const promises = locators.map((locator) => locator.evaluate( @@ -39,10 +36,6 @@ export const expectScreenshotFixture: PlaywrightFixture ); await Promise.all(promises); - if (waitingFunctionLocal && isFunction(waitingFunctionLocal)) { - await waitingFunctionLocal(); - } - return (component || page.locator('.playwright-wrapper-test')).screenshot({ animations: 'disabled', ...pageScreenshotOptions, @@ -52,7 +45,7 @@ export const expectScreenshotFixture: PlaywrightFixture const nameScreenshot = testInfo.titlePath.slice(1).join(' '); if (skipTheme !== 'light') { - expect(await captureScreenshot(waitingFunction)).toMatchSnapshot({ + expect(await captureScreenshot()).toMatchSnapshot({ name: `${screenshotName || nameScreenshot} light.png`, }); } @@ -62,7 +55,7 @@ export const expectScreenshotFixture: PlaywrightFixture await page.waitForTimeout(DEFAULT_MOUNT_TEST_DELAY); - expect(await captureScreenshot(waitingFunction)).toMatchSnapshot({ + expect(await captureScreenshot()).toMatchSnapshot({ name: `${screenshotName || nameScreenshot} dark.png`, }); } diff --git a/scripts/playwright-docker.sh b/scripts/playwright-docker.sh index ec48bbf..e8ee741 100755 --- a/scripts/playwright-docker.sh +++ b/scripts/playwright-docker.sh @@ -5,7 +5,7 @@ set -euo pipefail IMAGE_NAME="mcr.microsoft.com/playwright" IMAGE_TAG="v1.45.3-jammy" # This version have to be synchronized with playwright version from package.json -NODE_MODULES_CACHE_DIR="$HOME/.cache/page-constructor-playwright-docker-node-modules" +NODE_MODULES_CACHE_DIR="$HOME/.cache/blog-constructor-playwright-docker-node-modules" command_exists() { command -v "$1" >/dev/null 2>&1