-
Notifications
You must be signed in to change notification settings - Fork 475
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-tag.spec.ts
(#6427)
- Loading branch information
Showing
2 changed files
with
59 additions
and
80 deletions.
There are no files selected for viewing
80 changes: 0 additions & 80 deletions
80
projects/demo-cypress/cypress/tests/kit/input-tag/input-tag.cy.ts
This file was deleted.
Oops, something went wrong.
59 changes: 59 additions & 0 deletions
59
projects/demo-playwright/tests/kit/input-tag/input-tag.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,59 @@ | ||
import { | ||
TuiDocumentationApiPagePO, | ||
TuiDocumentationPagePO, | ||
tuiGoto, | ||
} from '@demo-playwright/utils'; | ||
import {expect, test} from '@playwright/test'; | ||
|
||
test.describe('InputTag', () => { | ||
test.describe('Examples', () => { | ||
test.beforeEach(async ({page}) => tuiGoto(page, '/components/input-tag')); | ||
|
||
test('errors of invalid control are shown correctly', async ({page}) => { | ||
const example = new TuiDocumentationPagePO(page).getExample('#base'); | ||
const input = example.locator('[automation-id="tui-input-tag__native"]'); | ||
|
||
// cspell:disable-next-line | ||
await input.fill('Very looooooooooooooooooooooooong Text'); | ||
await page.keyboard.down('Enter'); | ||
await expect(example).toHaveScreenshot('01-input-tag.png'); | ||
await input.fill('1'); | ||
await page.keyboard.down('Enter'); | ||
await input.fill('2'); | ||
await page.keyboard.down('Enter'); | ||
await expect(example).toHaveScreenshot('02-input-tag.png'); | ||
}); | ||
|
||
test('switch theme mode', async ({page}) => { | ||
const example = new TuiDocumentationPagePO(page).getExample('#sizes'); | ||
|
||
await expect(example).toHaveScreenshot('03-input-tag.png'); | ||
await tuiGoto(page, '/components/input-tag', {enableNightMode: true}); | ||
await expect(example).toHaveScreenshot('04-input-tag.png'); | ||
}); | ||
|
||
test('allows to forbid spaces inside tags via property', async ({page}) => { | ||
const example = new TuiDocumentationPagePO(page).getExample( | ||
'#no-spaces-inside-tags', | ||
); | ||
const input = example.locator('[automation-id="tui-input-tag__native"]'); | ||
|
||
await input.fill(' taiga ui library '); | ||
await page.keyboard.down('Enter'); | ||
await expect(example).toHaveScreenshot('06-input-tag.png'); | ||
}); | ||
}); | ||
|
||
test.describe('API', () => { | ||
test('placeholder', async ({page}) => { | ||
await tuiGoto(page, '/components/input-tag/API?placeholder=placeholder'); | ||
|
||
const api = new TuiDocumentationApiPagePO(page); | ||
|
||
await api.apiPageExample.locator('tui-input-tag').click(); | ||
await expect(api.apiPageExample).toHaveScreenshot('07-input-tag.png'); | ||
await api.focusOnBody(); | ||
await expect(api.apiPageExample).toHaveScreenshot('08-input-tag.png'); | ||
}); | ||
}); | ||
}); |