Skip to content
This repository was archived by the owner on Sep 11, 2025. It is now read-only.

Commit f16f93f

Browse files
authored
Merge pull request #24 from bytes-zone/area-project-task-subtask
refactor to area/project/task/subtask
2 parents 64defd0 + eb09b2a commit f16f93f

33 files changed

Lines changed: 646 additions & 285 deletions

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ bun.lockb
77

88
# Miscellaneous
99
/static/
10+
e2e/*-snapshots/*.yaml

bun.lock

Lines changed: 81 additions & 70 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

e2e/addArea.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { expect, test } from '@playwright/test';
2+
import { addArea, start } from './utils';
3+
4+
test('you can add an area and navigate to it', async ({ page }) => {
5+
await start(page);
6+
7+
// Add the area and make sure it shows up in the sidebar
8+
await addArea(page, 'Work');
9+
await expect(page.getByRole('navigation', { name: 'areas' }).getByRole('link')).toContainText(
10+
'Work',
11+
);
12+
13+
// Go to the area and check that the heading is correct
14+
await page.getByRole('link', { name: 'Work' }).click();
15+
await expect(page.getByRole('heading', { name: 'Work' })).toBeVisible();
16+
});
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import { expect, test } from '@playwright/test';
2+
import { goToInbox, quickAdd, start } from './utils';
23

34
test('quick-adding a task should send it to the inbox', async ({ page }) => {
4-
await page.goto('/');
5-
6-
await page.getByPlaceholder('What do you need to do?').fill('Buy milk');
7-
await page.getByRole('button', { name: 'Add' }).click();
8-
9-
await page.getByText('Inbox (1)').click();
5+
await start(page);
6+
await quickAdd(page, 'Buy milk');
7+
await goToInbox(page);
108

119
await expect(page.getByText('Buy milk', { exact: true })).toBeVisible();
1210
});
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import { expect, test } from '@playwright/test';
2+
import { goToInbox, quickAdd, start } from './utils';
23

34
test('you should be able to complete a task', async ({ page }) => {
4-
await page.goto('/');
5-
6-
await page.getByPlaceholder('What do you need to do?').fill('Buy milk');
7-
await page.getByRole('button', { name: 'Add' }).click();
8-
9-
await page.getByText('Inbox (1)').click();
5+
await start(page);
6+
await quickAdd(page, 'Buy milk');
7+
await goToInbox(page);
108

119
const complete = page.getByRole('checkbox', { name: 'Mark Buy milk complete' });
1210

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import { expect, test } from '@playwright/test';
2+
import { start, quickAdd, goToInbox } from './utils';
23

34
test('you should be able to edit dates for a task', async ({ page }) => {
4-
await page.goto('/');
5-
6-
await page.getByPlaceholder('What do you need to do?').fill('Buy milk');
7-
await page.getByRole('button', { name: 'Add' }).click();
8-
9-
await page.getByText('Inbox (1)').click();
5+
await start(page);
6+
await quickAdd(page, 'Buy milk');
7+
await goToInbox(page);
108

119
await page.getByRole('button', { name: 'Edit Buy milk', exact: true }).click();
1210

e2e/snapshots.test.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11
import { expect, test } from '@playwright/test';
2+
import { addArea, goToInbox, quickAdd, start } from './utils';
23

3-
test('inbox page snapshot should be accessible', async ({ page }) => {
4-
await page.goto('/');
4+
test('nav should be accessible', async ({ page }) => {
5+
await start(page);
6+
7+
await quickAdd(page, 'Buy milk due:in 2 days');
8+
await addArea(page, 'Home');
9+
await addArea(page, 'Work');
510

6-
await page.getByPlaceholder('What do you need to do?').fill('Buy milk due:in 2 days');
7-
await page.getByRole('button', { name: 'Add' }).click();
11+
await expect(page.getByRole('banner')).toMatchAriaSnapshot({ name: 'nav.aria.yaml' });
12+
});
13+
14+
test('inbox page snapshot should be accessible', async ({ page }) => {
15+
await start(page);
816

9-
await page.getByPlaceholder('What do you need to do?').fill('Wash the car blocks:2');
10-
await page.getByRole('button', { name: 'Add' }).click();
17+
await quickAdd(page, 'Buy milk due:in 2 days');
18+
await quickAdd(page, 'Wash the car blocks:2');
1119

12-
await page.getByText('Inbox (2)').click();
20+
await goToInbox(page);
1321

1422
await page.getByRole('button', { name: 'Edit Buy milk', exact: true }).click();
1523

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
- main:
2-
- list:
3-
- listitem:
4-
- text: Buy milk
5-
- checkbox "Mark Buy milk complete"
6-
- text: < 1 block planned due in 2 days
7-
- button "Edit Buy milk"
8-
- dialog:
9-
- text: Title
10-
- textbox "Title": Buy milk
11-
- checkbox "Mark Buy milk complete"
12-
- text: Planned Blocks
13-
- spinbutton "Planned Blocks"
14-
- text: Wait
15-
- textbox "Wait"
16-
- text: Due
17-
- textbox "Due": /\d+\/\d+\/\d+, \d+:\d+:\d+ [AP]M/
18-
- text: Notes
19-
- textbox "Notes"
20-
- listitem:
21-
- text: Wash the car
22-
- checkbox "Mark Wash the car complete"
23-
- text: 0 blocks completed / 2 blocks planned
24-
- button "Edit Wash the car"
2+
- list:
3+
- listitem:
4+
- text: Buy milk
5+
- checkbox "Mark Buy milk complete"
6+
- text: < 1 block planned due in 2 days
7+
- button "Edit Buy milk"
8+
- dialog:
9+
- text: Title
10+
- textbox "Title": Buy milk
11+
- checkbox "Mark Buy milk complete"
12+
- text: Planned Blocks
13+
- spinbutton "Planned Blocks"
14+
- text: Wait
15+
- textbox "Wait"
16+
- text: Due
17+
- textbox "Due": /\d+\/\d+\/\d+, \d+:\d+:\d+ [AP]M/
18+
- text: Notes
19+
- textbox "Notes"
20+
- listitem:
21+
- text: Wash the car
22+
- checkbox "Mark Wash the car complete"
23+
- text: 0 blocks completed / 2 blocks planned
24+
- button "Edit Wash the car"
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
- banner:
2+
- navigation "primary":
3+
- list:
4+
- listitem:
5+
- link "Home":
6+
- /url: /
7+
- listitem:
8+
- link "Inbox 1":
9+
- /url: /inbox
10+
- navigation "areas":
11+
- list:
12+
- listitem:
13+
- link "Home"
14+
- listitem:
15+
- link "Work"
16+
- button "Add item"
17+
- button "Add area"
18+
- text: Not signed in!

e2e/utils.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { Page } from 'playwright/test';
2+
3+
export async function start(page: Page) {
4+
await page.goto('/?demo=true');
5+
}
6+
7+
export async function goToInbox(page: Page) {
8+
await page.getByRole('navigation').getByText('Inbox').click();
9+
}
10+
11+
export async function quickAdd(page: Page, text: string) {
12+
await page.getByRole('button', { name: 'Add item' }).click();
13+
14+
await page.getByPlaceholder('What needs doing?').fill(text);
15+
await page.getByPlaceholder('What needs doing?').press('Enter');
16+
}
17+
18+
export async function addArea(page: Page, text: string) {
19+
await page.getByRole('button', { name: 'Add area' }).click();
20+
21+
await page.getByLabel('Title').fill(text);
22+
23+
await page.getByRole('button', { name: 'Create' }).click();
24+
}

0 commit comments

Comments
 (0)