Skip to content
This repository was archived by the owner on Jan 28, 2026. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions tests/demo-todo-app.spec.ts
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[prettier] reported by reviewdog 🐶

await expect(page.getByText('3 items left')).toBeVisible();
await expect(todoCount).toHaveText('3 items left');
await expect(todoCount).toContainText('3');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[prettier] reported by reviewdog 🐶

test('should allow me to clear the complete state of all items', async ({ page }) => {
const toggleAll = page.getByLabel('Mark all as complete');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[prettier] reported by reviewdog 🐶

await test.step('Showing active items', async () => {
await page.getByRole('link', { name: 'Active' }).click();

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

test.describe('New Todo', () => {
test('should allow me to add todo items', async ({ page }) => {
Comment on lines 14 to 15
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[prettier] reported by reviewdog 🐶

Suggested change
test.describe('New Todo', () => {
test('should allow me to add todo items', async ({ page }) => {
test.describe("New Todo", () => {
test("should allow me to add todo items", async ({ page }) => {

// This was your first visual assertion
// await expect(page).toHaveScreenshot('initial-empty-state.png'); // Capture initial state

// create a new todo locator
const newTodo = page.getByPlaceholder('What needs to be done?');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[prettier] reported by reviewdog 🐶

Suggested change
const newTodo = page.getByPlaceholder('What needs to be done?');
const newTodo = page.getByPlaceholder("What needs to be done?");


Expand Down Expand Up @@ -56,8 +59,11 @@
await createDefaultTodos(page);

// create a todo count locator
const todoCount = page.getByTestId('todo-count')

Check warning on line 62 in tests/demo-todo-app.spec.ts

View workflow job for this annotation

GitHub Actions / build-test

[prettier] reported by reviewdog 🐶 Raw Output: tests/demo-todo-app.spec.ts:62:- const todoCount = page.getByTestId('todo-count') tests/demo-todo-app.spec.ts:63:- tests/demo-todo-app.spec.ts:63:+ const todoCount = page.getByTestId("todo-count"); tests/demo-todo-app.spec.ts:64:+


Comment on lines 62 to +63
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[prettier] reported by reviewdog 🐶

Suggested change
const todoCount = page.getByTestId('todo-count')
const todoCount = page.getByTestId("todo-count");

// This is a purely cosmetic change to trigger a workflow run.
// You can remove this comment after verifying the auto-refresh.

// Check test using different methods.
await expect(page.getByText('3 items left')).toBeVisible();
await expect(todoCount).toHaveText('3 items left');
Expand Down Expand Up @@ -87,6 +93,9 @@
// Ensure all todos have 'completed' class.
await expect(page.getByTestId('todo-item')).toHaveClass(['completed', 'completed', 'completed']);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[prettier] reported by reviewdog 🐶

Suggested change
await expect(page.getByTestId('todo-item')).toHaveClass(['completed', 'completed', 'completed']);
await expect(page.getByTestId("todo-item")).toHaveClass([
"completed",
"completed",
"completed",
]);

await checkNumberOfCompletedTodosInLocalStorage(page, 3);

// ⭐ ADDED THIS LINE HERE ⭐
await expect(page).toHaveScreenshot('all-items-completed.png'); // Capture state after marking all as complete

Check warning on line 98 in tests/demo-todo-app.spec.ts

View workflow job for this annotation

GitHub Actions / build-test

[prettier] reported by reviewdog 🐶 Raw Output: tests/demo-todo-app.spec.ts:98:- await expect(page).toHaveScreenshot('all-items-completed.png'); // Capture state after marking all as complete tests/demo-todo-app.spec.ts:103:+ await expect(page).toHaveScreenshot("all-items-completed.png"); // Capture state after marking all as complete
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[prettier] reported by reviewdog 🐶

Suggested change
await expect(page).toHaveScreenshot('all-items-completed.png'); // Capture state after marking all as complete
await expect(page).toHaveScreenshot("all-items-completed.png"); // Capture state after marking all as complete

});

test('should allow me to clear the complete state of all items', async ({ page }) => {
Expand Down Expand Up @@ -350,8 +359,8 @@
await expect(todoItem).toHaveText([TODO_ITEMS[0], TODO_ITEMS[2]]);
});

test('should respect the back button', async ({ page }) => {

Check warning on line 362 in tests/demo-todo-app.spec.ts

View workflow job for this annotation

GitHub Actions / build-test

[prettier] reported by reviewdog 🐶 Raw Output: tests/demo-todo-app.spec.ts:362:- test('should respect the back button', async ({ page }) => { tests/demo-todo-app.spec.ts:363:- const todoItem = page.getByTestId('todo-item'); tests/demo-todo-app.spec.ts:364:- await page.getByTestId('todo-item').nth(1).getByRole('checkbox').check(); tests/demo-todo-app.spec.ts:402:+ test("should respect the back button", async ({ page }) => { tests/demo-todo-app.spec.ts:403:+ const todoItem = page.getByTestId("todo-item"); tests/demo-todo-app.spec.ts:404:+ await page.getByTestId("todo-item").nth(1).getByRole("checkbox").check();
const todoItem = page.getByTestId('todo-item');
const todoItem = page.getByTestId('todo-item');
await page.getByTestId('todo-item').nth(1).getByRole('checkbox').check();
Comment on lines 362 to 364
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[prettier] reported by reviewdog 🐶

Suggested change
test('should respect the back button', async ({ page }) => {
const todoItem = page.getByTestId('todo-item');
const todoItem = page.getByTestId('todo-item');
await page.getByTestId('todo-item').nth(1).getByRole('checkbox').check();
test("should respect the back button", async ({ page }) => {
const todoItem = page.getByTestId("todo-item");
await page.getByTestId("todo-item").nth(1).getByRole("checkbox").check();


await checkNumberOfCompletedTodosInLocalStorage(page, 1);
Expand All @@ -365,7 +374,7 @@
await page.getByRole('link', { name: 'Active' }).click();
});

await test.step('Showing completed items', async () => {
await test.step('Showing completed items', async ({ page }) => { // This was the previous change

Check warning on line 377 in tests/demo-todo-app.spec.ts

View workflow job for this annotation

GitHub Actions / build-test

[prettier] reported by reviewdog 🐶 Raw Output: tests/demo-todo-app.spec.ts:377:- await test.step('Showing completed items', async ({ page }) => { // This was the previous change tests/demo-todo-app.spec.ts:378:- await page.getByRole('link', { name: 'Completed' }).click(); tests/demo-todo-app.spec.ts:417:+ await test.step("Showing completed items", async ({ page }) => { tests/demo-todo-app.spec.ts:418:+ // This was the previous change tests/demo-todo-app.spec.ts:419:+ await page.getByRole("link", { name: "Completed" }).click();
await page.getByRole('link', { name: 'Completed' }).click();
Comment on lines +377 to 378
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[prettier] reported by reviewdog 🐶

Suggested change
await test.step('Showing completed items', async ({ page }) => { // This was the previous change
await page.getByRole('link', { name: 'Completed' }).click();
await test.step("Showing completed items", async ({ page }) => {
// This was the previous change
await page.getByRole("link", { name: "Completed" }).click();

});

Expand Down Expand Up @@ -435,4 +444,4 @@
return await page.waitForFunction(t => {
return JSON.parse(localStorage['react-todos']).map((todo: any) => todo.title).includes(t);
Comment on lines 444 to 445
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[prettier] reported by reviewdog 🐶

Suggested change
return await page.waitForFunction(t => {
return JSON.parse(localStorage['react-todos']).map((todo: any) => todo.title).includes(t);
return await page.waitForFunction((t) => {
return JSON.parse(localStorage["react-todos"])
.map((todo: any) => todo.title)
.includes(t);

}, title);
}
}