Skip to content

Commit

Permalink
chore(demo-playwright): InputDate add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mdlufy committed Oct 31, 2024
1 parent 13661b5 commit 08cd8a4
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion projects/demo-playwright/tests/kit/input-date/input-date.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,49 @@ test.describe('InputDate', () => {
await expect(inputDate.textfield).toHaveScreenshot('01-input-date.png');
});

test('Click `Until today`', async ({page}) => {
test('Click `Until today`, calendar not switched to large date', async ({
page,
}) => {
await tuiGoto(page, 'components/input-date/API?items$=1');

await inputDate.textfield.click();
await calendar.itemButton.click();

await inputDate.textfield.click();

await expect(inputDate.textfield).toHaveValue('Until today');
await expect(inputDate.calendar).toHaveScreenshot(
'02-input-date-calendar.png',
);
});

test('Press backspace to remove `Until today`, textfield is empty', async ({
page,
}) => {
await tuiGoto(page, 'components/input-date/API?items$=1');

await inputDate.textfield.click();
await calendar.itemButton.click();

await inputDate.textfield.focus();
await inputDate.textfield.press('Backspace');

await expect(inputDate.textfield).toHaveValue('');

Check failure on line 73 in projects/demo-playwright/tests/kit/input-date/input-date.spec.ts

View workflow job for this annotation

GitHub Actions / playwright / (3 of 4)

[chromium] › tests/kit/input-date/input-date.spec.ts:62:13 › InputDate › API › Press backspace to remove `Until today`

1) [chromium] › tests/kit/input-date/input-date.spec.ts:62:13 › InputDate › API › Press backspace to remove `Until today`, textfield is empty Error: Timed out 5000ms waiting for expect(locator).toHaveValue(expected) Locator: locator('#demo-content').locator('tui-input-date').getByRole('textbox') Expected string: "" Received string: "01.01.0000" Call log: - expect.toHaveValue with timeout 5000ms - waiting for locator('#demo-content').locator('tui-input-date').getByRole('textbox') - locator resolved to <input tabindex="0" tuimaskaccessor="" aria-invalid="false" _ngcontent-tui-demo-c171="" id="tui_interactive_561601061540000" class="t-input ng-untouched ng-valid ng-dirty" automation-id="tui-primitive-textfield__native-input"/> - unexpected value "01.01.0000" - locator resolved to <input tabindex="0" tuimaskaccessor="" aria-invalid="false" _ngcontent-tui-demo-c171="" id="tui_interactive_561601061540000" class="t-input ng-untouched ng-valid ng-dirty" automation-id="tui-primitive-textfield__native-input"/> - unexpected value "01.01.0000" - locator resolved to <input tabindex="0" tuimaskaccessor="" aria-invalid="false" _ngcontent-tui-demo-c171="" id="tui_interactive_561601061540000" class="t-input ng-untouched ng-valid ng-dirty" automation-id="tui-primitive-textfield__native-input"/> - unexpected value "01.01.0000" - locator resolved to <input tabindex="0" tuimaskaccessor="" aria-invalid="false" _ngcontent-tui-demo-c171="" id="tui_interactive_561601061540000" class="t-input ng-untouched ng-valid ng-dirty" automation-id="tui-primitive-textfield__native-input"/> - unexpected value "01.01.0000" - locator resolved to <input tabindex="0" tuimaskaccessor="" aria-invalid="false" _ngcontent-tui-demo-c171="" id="tui_interactive_561601061540000" class="t-input ng-untouched ng-valid ng-dirty" automation-id="tui-primitive-textfield__native-input"/> - unexpected value "01.01.0000" - locator resolved to <input tabindex="0" tuimaskaccessor="" aria-invalid="false" _ngcontent-tui-demo-c171="" id="tui_interactive_561601061540000" class="t-input ng-untouched ng-valid ng-dirty" automation-id="tui-primitive-textfield__native-input"/> - unexpected value "01.01.0000" - locator resolved to <input tabindex="0" tuimaskaccessor="" aria-invalid="false" _ngcontent-tui-demo-c171="" id="tui_interactive_561601061540000" class="t-input ng-untouched ng-valid ng-dirty" automation-id="tui-primitive-textfield__native-input"/> - unexpected value "01.01.0000" - locator resolved to <input tabindex="0" tuimaskaccessor="" aria-invalid="false" _ngcontent-tui-demo-c171="" id="tui_interactive_561601061540000" class="t-input ng-untouched ng-valid ng-dirty" automation-id="tui-primitive-textfield__native-input"/> - unexpected value "01.01.0000" - locator resolved to <input tabindex="0" tuimaskaccessor="" aria-invalid="false" _ngcontent-tui-demo-c171="" id="tui_interactive_561601061540000" class="t-input ng-untouched ng-valid ng-dirty" automation-id="tui-primitive-textfield__native-input"/> - unexpected value "01.01.0000" 71 | await inputDate.textfield.press('Backspace'); 72 | > 73 | await expect(inputDate.textfield).toHaveValue(''); | ^ 74 | await expect(inputDate.textfield).toHaveScreenshot( 75 | '03-input-date-textfield-empty.png', 76 | ); at /home/runner/work/taiga-ui/taiga-ui/projects/demo-playwright/tests/kit/input-date/input-date.spec.ts:73:47

Check failure on line 73 in projects/demo-playwright/tests/kit/input-date/input-date.spec.ts

View workflow job for this annotation

GitHub Actions / playwright / (3 of 4)

[chromium] › tests/kit/input-date/input-date.spec.ts:62:13 › InputDate › API › Press backspace to remove `Until today`

1) [chromium] › tests/kit/input-date/input-date.spec.ts:62:13 › InputDate › API › Press backspace to remove `Until today`, textfield is empty Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: Timed out 5000ms waiting for expect(locator).toHaveValue(expected) Locator: locator('#demo-content').locator('tui-input-date').getByRole('textbox') Expected string: "" Received string: "01.01.0000" Call log: - expect.toHaveValue with timeout 5000ms - waiting for locator('#demo-content').locator('tui-input-date').getByRole('textbox') - locator resolved to <input tabindex="0" tuimaskaccessor="" aria-invalid="false" _ngcontent-tui-demo-c171="" id="tui_interactive_561601061540000" class="t-input ng-untouched ng-valid ng-dirty" automation-id="tui-primitive-textfield__native-input"/> - unexpected value "01.01.0000" - locator resolved to <input tabindex="0" tuimaskaccessor="" aria-invalid="false" _ngcontent-tui-demo-c171="" id="tui_interactive_561601061540000" class="t-input ng-untouched ng-valid ng-dirty" automation-id="tui-primitive-textfield__native-input"/> - unexpected value "01.01.0000" - locator resolved to <input tabindex="0" tuimaskaccessor="" aria-invalid="false" _ngcontent-tui-demo-c171="" id="tui_interactive_561601061540000" class="t-input ng-untouched ng-valid ng-dirty" automation-id="tui-primitive-textfield__native-input"/> - unexpected value "01.01.0000" - locator resolved to <input tabindex="0" tuimaskaccessor="" aria-invalid="false" _ngcontent-tui-demo-c171="" id="tui_interactive_561601061540000" class="t-input ng-untouched ng-valid ng-dirty" automation-id="tui-primitive-textfield__native-input"/> - unexpected value "01.01.0000" - locator resolved to <input tabindex="0" tuimaskaccessor="" aria-invalid="false" _ngcontent-tui-demo-c171="" id="tui_interactive_561601061540000" class="t-input ng-untouched ng-valid ng-dirty" automation-id="tui-primitive-textfield__native-input"/> - unexpected value "01.01.0000" - locator resolved to <input tabindex="0" tuimaskaccessor="" aria-invalid="false" _ngcontent-tui-demo-c171="" id="tui_interactive_561601061540000" class="t-input ng-untouched ng-valid ng-dirty" automation-id="tui-primitive-textfield__native-input"/> - unexpected value "01.01.0000" - locator resolved to <input tabindex="0" tuimaskaccessor="" aria-invalid="false" _ngcontent-tui-demo-c171="" id="tui_interactive_561601061540000" class="t-input ng-untouched ng-valid ng-dirty" automation-id="tui-primitive-textfield__native-input"/> - unexpected value "01.01.0000" - locator resolved to <input tabindex="0" tuimaskaccessor="" aria-invalid="false" _ngcontent-tui-demo-c171="" id="tui_interactive_561601061540000" class="t-input ng-untouched ng-valid ng-dirty" automation-id="tui-primitive-textfield__native-input"/> - unexpected value "01.01.0000" - locator resolved to <input tabindex="0" tuimaskaccessor="" aria-invalid="false" _ngcontent-tui-demo-c171="" id="tui_interactive_561601061540000" class="t-input ng-untouched ng-valid ng-dirty" automation-id="tui-primitive-textfield__native-input"/> - unexpected value "01.01.0000" 71 | await inputDate.textfield.press('Backspace'); 72 | > 73 | await expect(inputDate.textfield).toHaveValue(''); | ^ 74 | await expect(inputDate.textfield).toHaveScreenshot( 75 | '03-input-date-textfield-empty.png', 76 | ); at /home/runner/work/taiga-ui/taiga-ui/projects/demo-playwright/tests/kit/input-date/input-date.spec.ts:73:47
await expect(inputDate.textfield).toHaveScreenshot(
'03-input-date-textfield-empty.png',
);
});

test('Enter item date, it converts to item date name', async ({page}) => {
await tuiGoto(page, 'components/input-date/API?items$=1');

await inputDate.textfield.focus();
await inputDate.textfield.fill('31.12.9998');

await expect(inputDate.textfield).toHaveValue('Until today');
await expect(inputDate.textfield).toHaveScreenshot(
'04-input-date-item-name.png',
);
});
});
});

0 comments on commit 08cd8a4

Please sign in to comment.