-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
InputDate
click any day after Until today
selected
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import {TuiDocumentationPagePO, tuiGoto} from '@demo-playwright/utils'; | ||
Check failure on line 1 in projects/demo-playwright/tests/kit/input-date/input-date.spec.ts GitHub Actions / playwright / (3 of 4)[chromium] › tests/kit/input-date/input-date.spec.ts:27:13 › InputDate › API › Click any day after `Until today` was selected
Check failure on line 1 in projects/demo-playwright/tests/kit/input-date/input-date.spec.ts GitHub Actions / playwright / (3 of 4)[chromium] › tests/kit/input-date/input-date.spec.ts:27:13 › InputDate › API › Click any day after `Until today` was selected
|
||
import type {Locator} from '@playwright/test'; | ||
import {expect, test} from '@playwright/test'; | ||
|
||
import {TuiInputDatePO} from '../../../utils'; | ||
|
||
test.describe('InputDate', () => { | ||
test.describe('API', () => { | ||
let example: Locator; | ||
let inputDate!: TuiInputDatePO; | ||
let documentationPage: TuiDocumentationPagePO; | ||
|
||
test.use({ | ||
viewport: { | ||
width: 600, | ||
height: 800, | ||
}, | ||
}); | ||
|
||
test.beforeEach(({page}) => { | ||
documentationPage = new TuiDocumentationPagePO(page); | ||
example = documentationPage.apiPageExample; | ||
|
||
inputDate = new TuiInputDatePO(example.locator('tui-input-date')); | ||
}); | ||
|
||
test('Click any day after `Until today` was selected', async ({page}) => { | ||
await tuiGoto(page, 'components/input-date/API?items$=1'); | ||
|
||
await inputDate.textfield.click(); | ||
await inputDate.clickItemButton(); | ||
|
||
await inputDate.textfield.click(); | ||
await inputDate.clickOnCalendarDay(1); | ||
|
||
await expect(inputDate.textfield).toHaveScreenshot('01-input-date.png'); | ||
}); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import {Locator} from '@playwright/test'; | ||
|
||
import {TuiCalendarPO} from './calendar.po'; | ||
|
||
export class TuiInputDatePO { | ||
readonly textfield: Locator = this.host.locator( | ||
'[automation-id="tui-primitive-textfield__native-input"]', | ||
); | ||
|
||
constructor(private readonly host: Locator) {} | ||
|
||
async clickItemButton(): Promise<void> { | ||
const itemButton = this.host | ||
.page() | ||
.locator('[automation-id="tui-input-date__button"]'); | ||
|
||
await itemButton.click(); | ||
Check failure on line 17 in projects/demo-playwright/utils/page-objects/input-date.po.ts GitHub Actions / playwright / (3 of 4)[chromium] › tests/kit/input-date/input-date.spec.ts:27:13 › InputDate › API › Click any day after `Until today` was selected
Check failure on line 17 in projects/demo-playwright/utils/page-objects/input-date.po.ts GitHub Actions / playwright / (3 of 4)[chromium] › tests/kit/input-date/input-date.spec.ts:27:13 › InputDate › API › Click any day after `Until today` was selected
|
||
} | ||
|
||
async clickOnCalendarDay(day: number): Promise<void> { | ||
const calendar = new TuiCalendarPO(this.host.page().locator('tui-calendar')); | ||
|
||
await calendar.clickOnCalendarDay(day); | ||
} | ||
} |