Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to connect to Browser stack if cookies are also sent in the test files #30

Open
PriyankaSoni1210 opened this issue Jul 6, 2022 · 3 comments

Comments

@PriyankaSoni1210
Copy link

Hello,

Our project is using page objects and we are able to connect to browserstack automate using fixtures as in the sample.

However, for the tests that require cookies to be sent, we are not able to connect to browserstack and tests end up running locally on disk.

This appears mainly due to:

  1. for setting up cookies we need to pass: await browserContext.addCookies(cookies);
  2. Browserstack fixtures are overriding the default 'page' fixture - await use(vPage); we tried to customize a bit by just overriding the 'context' and using that to add cookies and create new page in test itself.

The above is not working for us. We would also like to use geolocation which again required browserContext.

Is there any recommended way to achiever the same?

@PriyankaSoni1210 PriyankaSoni1210 changed the title Sending cookies in page object model Unable to connect to Browser stack if cookies are also sent in the test files Jul 6, 2022
@asambstack
Copy link
Contributor

Hey @PriyankaSoni1210
Have you tried overriding the "context" fixture and using the same?
You can reach out to [email protected] for faster resolutions.

@PriyankaSoni1210
Copy link
Author

Hello, Thanks for your response!! Yes the above approach worked, however, when just overriding the context in the fixtures, I am unable to take advantage of the below snippet in my fixtures to update the test run status, and execution are showing as unmarked in browserstack. Appreciate all suggestions on this :)

  await vPage.evaluate(() => {},
  `browserstack_executor: ${JSON.stringify(testResult)}`);

@duartmig
Copy link

Hello, I am facing the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants