-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathtrello.spec.ts
38 lines (31 loc) · 1.43 KB
/
trello.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { test, expect } from './fixtures/trello-test';
test.describe('Trello-like board', () => {
let boardName: string;
const listName = 'TODO';
test.beforeEach(async ({ request, myBoardsPage }) => {
const randomNumber = Math.trunc(Math.random() * 1000000);
boardName = 'Chores ' + `${randomNumber}`;
await request.post('http://localhost:3000/api/boards', {data: {name: boardName}});
await myBoardsPage.load();
await myBoardsPage.openBoard(boardName);
});
test('should display the new board', async ({ boardPage }) => {
await boardPage.expectNewBoardLoaded(boardName);
});
test('should create the first list in a board', async ({ boardPage }) => {
await boardPage.addList(listName);
await expect(boardPage.listName).toHaveValue(listName);
});
test('should create a list with multiple cards', async ({ boardPage }) => {
await boardPage.addList(listName);
await boardPage.addCardToList(0, 'Buy groceries');
await boardPage.addCardToList(0, 'Mow the lawn');
await boardPage.addCardToList(0, 'Walk the dog');
await expect(boardPage.cardTexts).toHaveText(
['Buy groceries', 'Mow the lawn', 'Walk the dog']);
});
test('should navigate home from a board', async ({ boardPage, myBoardsPage }) => {
await boardPage.goHome();
await myBoardsPage.expectLoaded([boardName]);
});
});