1- //try to see if code runs without any protection rule
21import { test , expect , type Page } from '@playwright/test' ;
32
43test . beforeEach ( async ( { page } ) => {
@@ -14,6 +13,9 @@ const TODO_ITEMS = [
1413
1514test . describe ( 'New Todo' , ( ) => {
1615 test ( 'should allow me to add todo items' , async ( { page } ) => {
16+ // This was your first visual assertion
17+ // await expect(page).toHaveScreenshot('initial-empty-state.png'); // Capture initial state
18+
1719 // create a new todo locator
1820 const newTodo = page . getByPlaceholder ( 'What needs to be done?' ) ;
1921
@@ -91,6 +93,9 @@ test.describe('Mark all as completed', () => {
9193 // Ensure all todos have 'completed' class.
9294 await expect ( page . getByTestId ( 'todo-item' ) ) . toHaveClass ( [ 'completed' , 'completed' , 'completed' ] ) ;
9395 await checkNumberOfCompletedTodosInLocalStorage ( page , 3 ) ;
96+
97+ // ⭐ ADDED THIS LINE HERE ⭐
98+ await expect ( page ) . toHaveScreenshot ( 'all-items-completed.png' ) ; // Capture state after marking all as complete
9499 } ) ;
95100
96101 test ( 'should allow me to clear the complete state of all items' , async ( { page } ) => {
@@ -369,7 +374,7 @@ test.describe('Routing', () => {
369374 await page . getByRole ( 'link' , { name : 'Active' } ) . click ( ) ;
370375 } ) ;
371376
372- await test . step ( 'Showing completed items' , async ( ) => {
377+ await test . step ( 'Showing completed items' , async ( { page } ) => { // This was the previous change
373378 await page . getByRole ( 'link' , { name : 'Completed' } ) . click ( ) ;
374379 } ) ;
375380
0 commit comments