-
-
Notifications
You must be signed in to change notification settings - Fork 130
/
Copy pathcreate.spec.ts
20 lines (14 loc) · 975 Bytes
/
create.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { test as baseTest, expect } from '@playwright/test';
import { locatorFixtures as fixtures } from '@playwright-testing-library/test/fixture.js';
import type { LocatorFixtures as TestingLibraryFixtures } from '@playwright-testing-library/test/fixture.js';
const test = baseTest.extend<TestingLibraryFixtures>(fixtures)
test('resource create', async ({ page, queries: { getByLabelText, getByRole, getByText, queryByRole, queryByText } }) => {
await page.goto('http://localhost:3000/books/create');
await expect(queryByText('Loading...')).not.toBeVisible();
await expect(queryByRole('heading', { level: 1 })).toHaveText(/^\s*Create Book/);
await expect(getByLabelText('isbn')).toBeEditable();
await expect(getByLabelText('description')).toBeEditable();
await expect(getByText('reviews')).toBeVisible();
await expect(getByRole('button', { name: 'Submit' })).toBeVisible();
await expect(getByRole('link', { name: /Back to list/ })).toBeVisible();
});