Skip to content

Commit 6e68c6f

Browse files
Updated with the latest playwright version
Removed few capabilities Added latest Playwright version
1 parent 408b8cc commit 6e68c6f

File tree

6 files changed

+27
-48
lines changed

6 files changed

+27
-48
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ node_modules
22
playwright-report
33
local.log
44
local.log
5+
package-lock.json
6+
local.log

fixture.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ exports.test = base.test.extend({
9090
delete caps.osVersion;
9191
delete caps.deviceName;
9292
delete caps.realMobile;
93-
delete caps.os_version;
93+
//delete caps.os_version;
9494

9595
const vBrowser = await playwright.chromium.connect({
9696
wsEndpoint:

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
"scripts": {
77
"sample-local-test": "BROWSERSTACK_LOCAL=true npx playwright test tests/local_test.js",
88
"sample-test": "npx playwright test tests/sample_test.js",
9-
"mobile-test": "npx playwright test tests/sample_test.js --project='chrome@Samsung Galaxy S22:13@browserstack'"
9+
"mobile-test": "npx playwright test tests/sample_test.js --project='chrome@Samsung Galaxy S23:13@browserstack'"
1010
},
1111
"keywords": [],
1212
"author": "",
1313
"license": "ISC",
1414
"devDependencies": {
15-
"@playwright/test": "^1.29.1",
15+
"@playwright/test": "^1.34.3",
1616
"browserstack-local": "^1.5.1",
17-
"playwright": "1.29.1",
17+
"playwright": "1.34.3",
1818
"prettier": "2.8.8"
1919
}
2020
}

playwright.config.js

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// @ts-check
22
const { devices } = require("@playwright/test");
33

4-
54
/**
65
* Read environment variables from file.
76
* https://github.com/motdotla/dotenv
@@ -19,7 +18,7 @@ const config = {
1918
// Use globalSetup & globalTearedown only if browserstack.local = true
2019
globalSetup: require.resolve("./global-setup"),
2120
globalTeardown: require.resolve("./global-teardown"),
22-
21+
2322
/* Maximum time one test can run for. */
2423
timeout: 90 * 1000,
2524
expect: {
@@ -52,44 +51,22 @@ const config = {
5251

5352
/* Configure projects for major browsers */
5453
projects: [
55-
56-
{
57-
name: 'chrome@latest:Windows 10@browserstack',
58-
use: {
59-
browserName: 'chromium',
60-
channel: 'chrome'
61-
},
62-
},
6354
{
64-
name: 'chrome@latest-beta:OSX Big Sur@browserstack',
55+
name: "chrome@latest:Windows 11@browserstack",
6556
use: {
66-
browserName: 'chromium',
67-
channel: 'chrome',
68-
},
69-
},
70-
{
71-
name: 'edge@90:Windows 10@browserstack',
72-
use: {
73-
browserName: 'chromium'
74-
},
75-
},
76-
{
77-
name: 'playwright-firefox@latest:OSX Catalina@browserstack',
78-
use: {
79-
browserName: 'firefox',
80-
ignoreHTTPSErrors: true
57+
browserName: "chromium",
58+
channel: "chrome",
8159
},
8260
},
8361
{
84-
name: 'playwright-webkit@latest:OSX Big Sur@browserstack',
62+
name: "chrome@latest-beta:OSX Ventura@browserstack",
8563
use: {
86-
browserName: 'webkit',
87-
// Config to use playwright emulated devices.
88-
// ...devices['iPhone 12 Pro Max'],
64+
browserName: "chromium",
65+
channel: "chrome",
8966
},
9067
},
9168
{
92-
name: "chrome@Samsung Galaxy S22:13@browserstack",
69+
name: "chrome@Samsung Galaxy S23:13@browserstack",
9370
use: {
9471
baseURL: "https://www.bstackdemo.com/",
9572
browserName: "chromium",

tests/local_test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ const { expect } = require("@playwright/test");
44

55
test("Local Testing", async ({ page }, testInfo) => {
66
try {
7-
await page.evaluate((_) => { },
8-
`browserstack_executor: ${JSON.stringify({ action: "setSessionName", arguments: { name: testInfo.project.name } })}`);
7+
await page.evaluate((_) => {},
8+
`browserstack_executor: ${JSON.stringify({ action: "setSessionName", arguments: { name: testInfo.project.name } })}`);
99

1010
await page.waitForTimeout(5000);
1111

1212
await page.goto("http://localhost:5500/");
1313

14-
await page.evaluate((_) => { },
15-
`browserstack_executor: ${JSON.stringify({ action: "setSessionStatus", arguments: { status: "passed", reason: "Local success" } })}`);
14+
await page.evaluate((_) => {},
15+
`browserstack_executor: ${JSON.stringify({ action: "setSessionStatus", arguments: { status: "passed", reason: "Local success" } })}`);
1616
} catch (e) {
1717
console.log(e);
18-
await page.evaluate((_) => { },
19-
`browserstack_executor: ${JSON.stringify({ action: "setSessionStatus", arguments: { status: "failed", reason: "Local fail" } })}`);
18+
await page.evaluate((_) => {},
19+
`browserstack_executor: ${JSON.stringify({ action: "setSessionStatus", arguments: { status: "failed", reason: "Local fail" } })}`);
2020
}
2121
});

tests/sample_test.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ const { expect } = require("@playwright/test");
44

55
test("BstackDemo Add to cart", async ({ page }, testInfo) => {
66
try {
7-
await page.evaluate((_) => { },
8-
`browserstack_executor: ${JSON.stringify({ action: "setSessionName", arguments: { name: testInfo.project.name } })}`);
7+
await page.evaluate((_) => {},
8+
`browserstack_executor: ${JSON.stringify({ action: "setSessionName", arguments: { name: testInfo.project.name } })}`);
99
await page.waitForTimeout(5000);
1010

1111
await page.goto("https://www.bstackdemo.com/", {
@@ -15,7 +15,7 @@ test("BstackDemo Add to cart", async ({ page }, testInfo) => {
1515
await page.getByText("Checkout").click();
1616
await page.locator("#username svg").click();
1717
await page.locator("#react-select-2-option-0-0").click({ force: true });
18-
await page.locator("#password svg").click();
18+
await page.locator("#password svg").click({ force: true });
1919
await page.locator("#react-select-3-option-0-0").click({ force: true });
2020
await page.getByRole("button", { name: "Log In" }).click();
2121
await page.getByLabel("First Name").click();
@@ -31,11 +31,11 @@ test("BstackDemo Add to cart", async ({ page }, testInfo) => {
3131
await page.getByRole("button", { name: "Submit" }).click();
3232
await page.getByRole("button", { name: "Continue Shopping »" }).click();
3333

34-
await page.evaluate((_) => { },
35-
`browserstack_executor: ${JSON.stringify({ action: "setSessionStatus", arguments: { status: "passed", reason: "Product added to cart" } })}`);
34+
await page.evaluate((_) => {},
35+
`browserstack_executor: ${JSON.stringify({ action: "setSessionStatus", arguments: { status: "passed", reason: "Product added to cart" } })}`);
3636
} catch (e) {
3737
console.log(e);
38-
await page.evaluate((_) => { },
39-
`browserstack_executor: ${JSON.stringify({ action: "setSessionStatus", arguments: { status: "failed", reason: "Test failed" } })}`);
38+
await page.evaluate((_) => {},
39+
`browserstack_executor: ${JSON.stringify({ action: "setSessionStatus", arguments: { status: "failed", reason: "Test failed" } })}`);
4040
}
4141
});

0 commit comments

Comments
 (0)