Skip to content

Commit a1b168d

Browse files
committed
test: βœ… add user info fixture for e2e tests
1 parent e128db4 commit a1b168d

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { test as base } from '@playwright/test';
2+
3+
export const test = base.extend<Fixtures>({
4+
testUserInfo: async ({ request }, use) => {
5+
console.log('Creating user...');
6+
// const response = await request.post('/users', {
7+
// data: {
8+
// email: '[email protected]',
9+
// password: 'test',
10+
// },
11+
// });
12+
// const userInfo: UserInfo = await response.json();
13+
14+
const userInfo: UserInfo = {
15+
id: '1',
16+
17+
password: 'test',
18+
};
19+
20+
await use(userInfo);
21+
22+
console.log('Deleting user...');
23+
// await request.delete(`/users/${userInfo.id}`);
24+
},
25+
});
26+
27+
interface Fixtures {
28+
testUserInfo: UserInfo;
29+
}
30+
31+
interface UserInfo {
32+
id: string;
33+
email: string;
34+
password: string;
35+
}

β€Žapps/404-recipe-filter-material-starter/e2e/recipe-search.spec.tsβ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { test, expect } from '@playwright/test';
1+
import { expect } from '@playwright/test';
2+
import { test } from './fixtures';
23

34
test('has title', async ({ page }) => {
45
await page.goto('/');

0 commit comments

Comments
Β (0)