browserstack / node-js-playwright-browserstack Goto Github PK
View Code? Open in Web Editor NEWCreating a sample repo for different Playwright languages and runners
Creating a sample repo for different Playwright languages and runners
When I am trying to run the sample-test
script with an Android device, I am getting the error:
Error: browserType.launch: Browser has been closed
.
For Windows it works perfectly fine.
Steps to reproduce:
git clone https://github.com/browserstack/node-js-playwright-browserstack.git
Checkout to sdk
branch.
Update the configuration file.
browserstack.yml
platforms:
- deviceName: Samsung Galaxy S22 Ultra
browserName: chrome # Try 'samsung' for Samsung browser
osVersion: 12.0
package.json
"devDependencies": {
"@playwright/test": "^1.35.0",
"browserstack-node-sdk": "latest"
}
With version 1.39.0, browserstack throws the error "Error: browserType.connect: Error: deviceDescriptors: expected array, got undefined", likely because 1.39.0 is not available yet with Browserstack.
Same, when using 1.37.1 version, browserstack is automatically picking 1.38.0 (even when mentioned explicitly "client.playwrightVersion": "1.37.1"), and throwing errors.
Ideally, "client.playwrightVersion": should be able to work with the exact specified playwright version so to avoid such breaking changes.
Hello Support,
I’m following the steps and get error on Step 4:
https://www.browserstack.com/docs/automate/playwright/getting-started/nodejs#MacOS_or_Linux
[playwright-webkit@latest:OSX Ventura] › sample_test.js:4:1 › BstackDemo Add to cart ==========
browserType.launch: Browser has been closed
at Object.playwrightFixtures.browser.scope [as fn] ([/Users/kaushikchavda/Projects/node-js-playwright-browserstack/node_modules/@playwright/test/lib/index.js:180:51](mailto:/Users/kaushikchavda/Projects/node-js-playwright-browserstack/node_modules/@playwright/test/lib/index.js:180:51))
at [/Users/kaushikchavda/Projects/node-js-playwright-browserstack/node_modules/@playwright/test/lib/fixtures.js:95:81](mailto:/Users/kaushikchavda/Projects/node-js-playwright-browserstack/node_modules/@playwright/test/lib/fixtures.js:95:81)
[chrome@latest:Windows 11] › sample_test.js:4:1 › BstackDemo Add to cart ======================
browserType.launch: Browser has been closed
at Object.playwrightFixtures.browser.scope [as fn] ([/Users/kaushikchavda/Projects/node-js-playwright-browserstack/node_modules/@playwright/test/lib/index.js:180:51](mailto:/Users/kaushikchavda/Projects/node-js-playwright-browserstack/node_modules/@playwright/test/lib/index.js:180:51))
at [/Users/kaushikchavda/Projects/node-js-playwright-browserstack/node_modules/@playwright/test/lib/fixtures.js:95:81](mailto:/Users/kaushikchavda/Projects/node-js-playwright-browserstack/node_modules/@playwright/test/lib/fixtures.js:95:81)
browserType.launch: Browser has been closed
at Object.playwrightFixtures.browser.scope [as fn] ([/Users/kaushikchavda/Projects/node-js-playwright-browserstack/node_modules/@playwright/test/lib/index.js:180:51](mailto:/Users/kaushikchavda/Projects/node-js-playwright-browserstack/node_modules/@playwright/test/lib/index.js:180:51))
at [/Users/kaushikchavda/Projects/node-js-playwright-browserstack/node_modules/@playwright/test/lib/fixtures.js:95:81](mailto:/Users/kaushikchavda/Projects/node-js-playwright-browserstack/node_modules/@playwright/test/lib/fixtures.js:95:81)
3 failed
[chrome@latest:Windows 11] › sample_test.js:4:1 › BstackDemo Add to cart =======================
[playwright-webkit@latest:OSX Ventura] › sample_test.js:4:1 › BstackDemo Add to cart ===========
[playwright-firefox:Windows 11] › sample_test.js:4:1 › BstackDemo Add to cart ==================
Need example for integration with Percy Visual Testing + Docker.
I am able to get the code base working in the Jammy playwright image using HTTPS_PROXY, HTTP_PROXY env variables.
But the snapshot upload fails with network connection failure.
There is very less information available to fix the issue with it.
When i trying "Legacy Integration" with my tests wrote on "NodeJS/Playwright", when i trying connect via wssEndpoint getting such issue "Error: browserType.connect: Target page, context or browser has been closed".
test('Authentication Test', async ({}) => {
const caps = {
osVersion: "13.0",
deviceName: "Samsung Galaxy S23", // "Samsung Galaxy S22 Ultra", "Google Pixel 7 Pro", "OnePlus 9", etc.
browserName: "chrome",
realMobile: "true",
name: "My android playwright test",
build: "playwright-build-1",
"browserstack.username": "userName",
"browserstack.accessKey": "password",
"browserstack.local": true,
}
let vBrowser = await playwright.chromium.connect({
wsEndpoint:
`wss://cdp.browserstack.com/playwright?caps=` +
`${encodeURIComponent(JSON.stringify(caps))}`,
});
let vContext = await vBrowser.newContext();
const page = await vContext.newPage();
await test.step("Login Test", async () => {
await Login(page, config);
})
Please add throw(e);
to line 37 in sample_test.js and to line 19 in local_test.js
The issue is the status of the local tests is not the same as the status of the test in browserstack because we're consuming the error in the test.
Hi, do you have a typescript version of this repo to use on BrowserStack Automate SDK with browserstack.yml file ?
The sdk
branch appears to use framework: playwright
, and this is GitHub repository is linked to in the setup documentation for Playwright and BrowserStack.
In the sdk
branch, when you set retries: 3
in the playwright configuration file for re-running test failures and then run npm run sample-test
command, (with your own user/access key) it marks the tests in BrowserStack as passed, but throws these errors in the console and the SDK marks the tests as failed, leading to it retrying over and over.
Running 4 tests using 2 workers
1) [playwright-firefox@latest:Windows 11@browserstack] › tests\bstack_test_add_to_cart.js:3:1 › BStackDemo test add to cart
Error: : expected object, got undefined
Retry #1 ───────────────────────────────────────────────────────────────────────────────────────
Error: : expected object, got undefined
Retry #2 ───────────────────────────────────────────────────────────────────────────────────────
Error: : expected object, got undefined
Retry #3 ───────────────────────────────────────────────────────────────────────────────────────
Error: : expected object, got undefined
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.