Skip to content

Commit

Permalink
chore(e2e): add input-tag.spec.ts (#6427)
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode authored Jan 11, 2024
1 parent 289ccdd commit 4ee1b09
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 80 deletions.
80 changes: 0 additions & 80 deletions projects/demo-cypress/cypress/tests/kit/input-tag/input-tag.cy.ts

This file was deleted.

59 changes: 59 additions & 0 deletions projects/demo-playwright/tests/kit/input-tag/input-tag.spec.ts
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');
});
});
});

0 comments on commit 4ee1b09

Please sign in to comment.