Skip to content

Commit

Permalink
Add session cookie example
Browse files Browse the repository at this point in the history
  • Loading branch information
inancgumus committed Aug 25, 2023
1 parent dd6b459 commit 6b7066c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions examples/fillform.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ export default async function() {
check(page, {
'header': page.locator('h2').textContent() == 'Welcome, admin!',
});

// Check whether we receive cookies from the logged site.
check(context.cookies(), {
'session cookie is set': cookies => {
const sessionID = cookies.find(c => c.name == 'sid')
return typeof sessionID !== 'undefined'
}
})
} finally {
page.close();
}
Expand Down

0 comments on commit 6b7066c

Please sign in to comment.