diff --git a/page-objects/MyAccountPage.js b/page-objects/MyAccountPage.js index 0671fd1..d729722 100644 --- a/page-objects/MyAccountPage.js +++ b/page-objects/MyAccountPage.js @@ -1,9 +1,14 @@ export class MyAccountPage { constructor(page) { this.page = page + this.myAccountHeader = page.getByRole('heading', { name: 'My Account' }) } visit = async () => { await this.page.goto("/my-account") } + + checkForLogin = async () => { + await this.myAccountHeader.waitFor() + } } \ No newline at end of file diff --git a/tests/my_account.spec.js b/tests/my_account.spec.js index 37b6bb7..ef86421 100644 --- a/tests/my_account.spec.js +++ b/tests/my_account.spec.js @@ -10,5 +10,10 @@ test.only("My Account using cookie injection", async ({page}) => { const myAccount = new MyAccountPage(page) await myAccount.visit() - await page.pause() + + await page.evaluate(([loginTokenInjected]) => { + document.cookie = "token=" + loginTokenInjected + }, [loginToken]) + await myAccount.visit() + await myAccount.checkForLogin() }) \ No newline at end of file