diff --git a/projects/demo-playwright/tests/legacy/input-phone-international/input-phone-international.pw.spec.ts b/projects/demo-playwright/tests/legacy/input-phone-international/input-phone-international.pw.spec.ts index f86bf8ca3113..e1dcce935938 100644 --- a/projects/demo-playwright/tests/legacy/input-phone-international/input-phone-international.pw.spec.ts +++ b/projects/demo-playwright/tests/legacy/input-phone-international/input-phone-international.pw.spec.ts @@ -1,18 +1,24 @@ import {DemoRoute} from '@demo/routes'; -import {TuiDocumentationPagePO, tuiGoto} from '@demo-playwright/utils'; +import { + TuiDocumentationPagePO, + tuiGoto, + TuiInputPhoneInternationalPO, +} from '@demo-playwright/utils'; import type {Locator} from '@playwright/test'; import {expect, test} from '@playwright/test'; test.describe('InputPhoneInternational', () => { test.describe('API page', () => { let example: Locator; - let select!: Locator; let dropdown!: Locator; + let inputPhoneInternational!: TuiInputPhoneInternationalPO; test.beforeEach(({page}) => { example = new TuiDocumentationPagePO(page).apiPageExample; - select = example.locator('tui-textfield .t-ipi-select'); dropdown = page.locator('tui-dropdown'); + inputPhoneInternational = new TuiInputPhoneInternationalPO( + example.locator('tui-textfield'), + ); }); test('Open dropdown if readonly=false', async ({page}) => { @@ -23,7 +29,7 @@ test.describe('InputPhoneInternational', () => { await expect(dropdown).not.toBeAttached(); - await select.click(); + await inputPhoneInternational.select.click(); await expect(dropdown).toBeAttached(); }); @@ -33,7 +39,9 @@ test.describe('InputPhoneInternational', () => { await expect(dropdown).not.toBeAttached(); - await select.click(); + await expect(async () => { + await inputPhoneInternational.select.click(); + }).rejects.toThrow(); await expect(dropdown).not.toBeAttached(); }); diff --git a/projects/demo-playwright/utils/page-objects/index.ts b/projects/demo-playwright/utils/page-objects/index.ts index 89273f67557c..478c42399d06 100644 --- a/projects/demo-playwright/utils/page-objects/index.ts +++ b/projects/demo-playwright/utils/page-objects/index.ts @@ -12,6 +12,7 @@ export * from './input-date-time.po'; export * from './input-month.po'; export * from './input-month-range.po'; export * from './input-phone.po'; +export * from './input-phone-international.po'; export * from './input-range.po'; export * from './input-slider.po'; export * from './input-tag.po'; diff --git a/projects/demo-playwright/utils/page-objects/input-phone-international.po.ts b/projects/demo-playwright/utils/page-objects/input-phone-international.po.ts new file mode 100644 index 000000000000..e955eb8f3c4d --- /dev/null +++ b/projects/demo-playwright/utils/page-objects/input-phone-international.po.ts @@ -0,0 +1,7 @@ +import type {Locator} from '@playwright/test'; + +import {TuiTextfieldWithDataListPO} from './textfield-with-data-list.po'; + +export class TuiInputPhoneInternationalPO extends TuiTextfieldWithDataListPO { + public select: Locator = this.host.locator('.t-ipi-select'); +} diff --git a/projects/experimental/components/input-phone-international/input-phone-international.template.html b/projects/experimental/components/input-phone-international/input-phone-international.template.html index dc9be8416ad4..3ff7d65e932f 100644 --- a/projects/experimental/components/input-phone-international/input-phone-international.template.html +++ b/projects/experimental/components/input-phone-international/input-phone-international.template.html @@ -32,7 +32,9 @@ [tuiTextfieldSize]="size() === 's' ? 's' : 'm'" >