From 7944f201bdfd9a2beb6b30a7db8e04932cc27e56 Mon Sep 17 00:00:00 2001 From: Atharv Chandratre Date: Thu, 30 Nov 2023 13:09:15 -0600 Subject: [PATCH] chore(demo-playwright): tests for `field-error` (#6133) Co-authored-by: Vidhi Rambhia <39163240+VidhiRambhia@users.noreply.github.com> --- .../tests/kit/field-error/field-error.cy.ts | 15 ---------- .../tests/kit/field-error/field-error.spec.ts | 28 +++++++++++++++++++ 2 files changed, 28 insertions(+), 15 deletions(-) delete mode 100644 projects/demo-cypress/cypress/tests/kit/field-error/field-error.cy.ts create mode 100644 projects/demo-playwright/tests/kit/field-error/field-error.spec.ts diff --git a/projects/demo-cypress/cypress/tests/kit/field-error/field-error.cy.ts b/projects/demo-cypress/cypress/tests/kit/field-error/field-error.cy.ts deleted file mode 100644 index 56005da473e2..000000000000 --- a/projects/demo-cypress/cypress/tests/kit/field-error/field-error.cy.ts +++ /dev/null @@ -1,15 +0,0 @@ -describe(`TuiFieldError`, () => { - it(`Errors of invalid control are shown correctly`, () => { - cy.tuiVisit(`/pipes/field-error`); - - cy.get(`tui-field-error-pipe-example-1 input`) - .first() - .focus() - .wait(50) - .blur() - .tuiGetByExampleId() - .first() - .wait(300) - .matchImageSnapshot(`shows-error-under-field`); - }); -}); diff --git a/projects/demo-playwright/tests/kit/field-error/field-error.spec.ts b/projects/demo-playwright/tests/kit/field-error/field-error.spec.ts new file mode 100644 index 000000000000..c9cdbe886834 --- /dev/null +++ b/projects/demo-playwright/tests/kit/field-error/field-error.spec.ts @@ -0,0 +1,28 @@ +import {tuiGoto} from '@demo-playwright/utils'; +import {expect, test} from '@playwright/test'; + +const {describe} = test; + +describe(`TuiFieldError`, () => { + test(`Errors of invalid control are shown correctly`, async ({page}) => { + await tuiGoto(page, `/pipes/field-error`); + + const errorPipeInput = page + .locator(`tui-field-error-pipe-example-1 input`) + .first(); + + await errorPipeInput.focus(); + + await page.waitForTimeout(50); + + await errorPipeInput.blur(); + + const example = page + .locator(`tui-doc-example [automation-id="tui-doc-example"]`) + .first(); + + await expect(example).toHaveScreenshot(`shows-error-under-field.png`, { + animations: `allow`, + }); + }); +});