-
Notifications
You must be signed in to change notification settings - Fork 478
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(e2e): add
input-files.spec.ts
(#6436)
- Loading branch information
Showing
4 changed files
with
61 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 0 additions & 61 deletions
61
projects/demo-cypress/cypress/tests/kit/input-files/input-files.cy.ts
This file was deleted.
Oops, something went wrong.
50 changes: 50 additions & 0 deletions
50
projects/demo-playwright/tests/kit/input-files/input-files.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import {TuiDocumentationApiPagePO, tuiGoto} from '@demo-playwright/utils'; | ||
import {expect, Locator, test} from '@playwright/test'; | ||
import {join} from 'path'; | ||
|
||
test.describe('InputFiles', () => { | ||
let example: Locator; | ||
|
||
test.beforeEach(({page}) => { | ||
example = new TuiDocumentationApiPagePO(page).apiPageExample; | ||
}); | ||
|
||
['english', 'dutch', 'russian'].forEach(language => | ||
test(`Wrong file type (i18n: ${language})`, async ({page}) => { | ||
await tuiGoto(page, '/components/input-files/API?accept=application/pdf', { | ||
language, | ||
}); | ||
|
||
await example | ||
.locator('[tuiInputFiles]') | ||
.setInputFiles(join(__dirname, '../../../stubs/web-api.svg')); | ||
await expect(example).toHaveScreenshot(`01-${language}-input-files.png`); | ||
}), | ||
); | ||
|
||
['english', 'dutch', 'russian'].forEach(language => | ||
test(`File is too large (i18n: ${language})`, async ({page}) => { | ||
await tuiGoto( | ||
page, | ||
'/components/input-files/API?accept=image/*&maxFileSize=2000', | ||
{language}, | ||
); | ||
await example | ||
.locator('[tuiInputFiles]') | ||
.setInputFiles(join(__dirname, '../../../stubs/web-api.svg')); | ||
await expect(example).toHaveScreenshot(`02-${language}-input-files.png`); | ||
}), | ||
); | ||
|
||
test('Link text is too long', async ({page}) => { | ||
await page.setViewportSize({width: 550, height: 500}); | ||
await tuiGoto( | ||
page, | ||
'/components/input-files/API?link=Select%20a%20file%20with%20a%20too%20long%20name.%20Long%20filename.%20Very%20long%20filename', | ||
); | ||
await example | ||
.locator('[tuiInputFiles]') | ||
.setInputFiles(join(__dirname, '../../../stubs/web-api.svg')); | ||
await expect(example).toHaveScreenshot('03-input-files.png'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters