Annotations: The playwright test supports test annotations to deal with failures, flakiness, skip, focus, etc.
test.describe(): declares a group of tests.
only: if you want to execute specific tests. declares a focused test, if there are some tests focused or suites, all of them will be run, but nothing less. test.only() or describe.only()
Skip: if you want to skip the tests. Mark this test as irrelevant. playwright test does not run such tests.
test.fixme(): declares a test to to fixed, similary to test(), this test will not be run.
test.slow(): Mark this test as slow and triple the test timeout.
test.setTimeout (): changes the timeout for the currently running test; zero means no timeout.
Hooks: to reduce duplicate code. beforeAll afterAll beforeEach afterEach
let page;
test.beforeEach(async ({browser})=>{
page = new browser.newPage()
//login functionlity
})
test.afterEach(async ()=>{
//logout functionlity
})
test(test"",async ()=>{
//code
})