Rayrun
← Back to Discord Forum

Sharing fixtures

yevhen_spilnykposted in #help-playwright
Open in Discord
yevhen_spilnyk
yevhen_spilnyk

Hello guys.

Help me with sharing fixtures in my case. Please look at the pictures and help me to figure out why my fixtures are not shared between the backend and the homepage. It looks like it's stuck on the backend page and not sharing with homePage

// Do not pass test('Login via API @api', async ({ backend, homePage }) => { await backend.login(process.env.EMAIL, process.env.PASSWORD) await homePage.open() })

// works well test('Login via UI @regression', async ({ homePage, sighInPage }) => { await sighInPage.open() await sighInPage.loginAsUser(process.env.EMAIL, process.env.PASSWORD)

await homePage.pageIsPresent()

})

add_cookies.png
backend_file.png
fixtures_folder.png
login_test.png
pw_fixtures.png

This thread is trying to answer question "Why are my fixtures not shared between the backend and the homepage?"

1 reply
yevhen_spilnyk
yevhen_spilnyk

I've also tried this approach.

export class ApiSupport { constructor(public page: Page, public request: APIRequestContext, public context: BrowserContext) { }

await this.context.addCookies([ { "name": "sessionid", "value": sessionIdMatch, "domain": process.env.BASE_URL, "path": "/", "httpOnly": true, "secure": true, "sameSite": "None" } ])

context.png

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].