import{expect,testassetup}from'@playwright/test'importpathfrom'path'constauthFile=path.join(__dirname,'../.auth/zengdong.json')setup('authenticate',async({page})=>{// Perform authentication steps. Replace these actions with your own.
awaitpage.goto('/auth/login')awaitpage.getByPlaceholder('请输入邮箱地址').fill('xxxxxxxx')awaitpage.getByPlaceholder('请输入密码').fill('xxxxxx')awaitpage.getByRole('button',{name:'登 录'}).click()// Wait until the page receives the cookies.
awaitexpect(page.getByText('登录成功')).toBeVisible()// Alternatively, you can wait until the page reaches a state where all cookies are set.
awaitpage.waitForURL('http://xxxxxxxxxx',{waitUntil:'load',})// End of authentication steps.
awaitpage.context().storageState({path: authFile})})