Using token to inject into dom, logs in
This commit is contained in:
parent
8edcdd925d
commit
31e1f119e7
|
@ -1,9 +1,14 @@
|
||||||
export class MyAccountPage {
|
export class MyAccountPage {
|
||||||
constructor(page) {
|
constructor(page) {
|
||||||
this.page = page
|
this.page = page
|
||||||
|
this.myAccountHeader = page.getByRole('heading', { name: 'My Account' })
|
||||||
}
|
}
|
||||||
|
|
||||||
visit = async () => {
|
visit = async () => {
|
||||||
await this.page.goto("/my-account")
|
await this.page.goto("/my-account")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkForLogin = async () => {
|
||||||
|
await this.myAccountHeader.waitFor()
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -10,5 +10,10 @@ test.only("My Account using cookie injection", async ({page}) => {
|
||||||
|
|
||||||
const myAccount = new MyAccountPage(page)
|
const myAccount = new MyAccountPage(page)
|
||||||
await myAccount.visit()
|
await myAccount.visit()
|
||||||
await page.pause()
|
|
||||||
|
await page.evaluate(([loginTokenInjected]) => {
|
||||||
|
document.cookie = "token=" + loginTokenInjected
|
||||||
|
}, [loginToken])
|
||||||
|
await myAccount.visit()
|
||||||
|
await myAccount.checkForLogin()
|
||||||
})
|
})
|
Loading…
Reference in New Issue