Skip to content

Commit 6f6ac67

Browse files
Removing unwanted code and fixing ? error for lower node versions
1 parent 9a0e047 commit 6f6ac67

File tree

12 files changed

+5
-12
lines changed

12 files changed

+5
-12
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ If you are using Playwright Test Runner to run your Playwright tests, you can ru
106106
3. Install the dependencies using `npm install`
107107
4. Put in your credentials in the file `fixtures.js` in the caps part.
108108
5. If you are trying to run your own tests on BrowserStack, then you need to ensure that you have configured the `projects` correctly in `playwright.config.js` file.
109-
6. Run the sample test script using `npm run test` which runs all the tests inside tests directory across 5 browsers in BrowserStack.
109+
6. Run the sample test script using `npm test` which runs all the tests inside tests directory across 5 browsers in BrowserStack.
110110
7. Run the sample test script using `npm run test:local` and add `browserstack.local:true` in the file `fixture.js` in caps part which runs all the tests inside tests directory across 5 browsers in BrowserStack.
111111
8. If you want to run your tests locally, you just need to configure the `projects` without name `@browserstack` in `playwright.config.js` file.
112112

playwright-test/fixtures.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ const patchCaps = (name) => {
4040
caps.name = name;
4141
};
4242

43+
const isHash = (entity) => Boolean(entity && typeof(entity) === "object" && !Array.isArray(entity));
44+
const nestedKeyValue = (hash, keys) => keys.reduce((hash, key) => (isHash(hash) ? hash[key] : undefined), hash);
45+
4346
exports.test = base.test.extend({
4447
browser: async ({ playwright, browser }, use, workerInfo) => {
4548
if (workerInfo.project.name.match(/browserstack/)) {
@@ -62,7 +65,7 @@ exports.test = base.test.extend({
6265
action: 'setSessionStatus',
6366
arguments: {
6467
status: testInfo.status,
65-
reason: testInfo?.error?.message,
68+
reason: nestedKeyValue(testInfo, ['error', 'message'])
6669
},
6770
};
6871
await vPage.evaluate(() => {},

playwright-test/tests/test_1.spec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// example.spec.js
21
const { test } = require('../fixtures');
32
const { expect } = require('@playwright/test');
43
test.describe('feature foo', () => {

playwright-test/tests/test_10.spec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// example.spec.js
21
const { test } = require('../fixtures');
32
const { expect } = require('@playwright/test');
43
test.describe('feature foo', () => {

playwright-test/tests/test_2.spec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// example.spec.js
21
const { test } = require('../fixtures');
32
const { expect } = require('@playwright/test');
43
test.describe('feature foo', () => {

playwright-test/tests/test_3.spec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// example.spec.js
21
const { test } = require('../fixtures');
32
const { expect } = require('@playwright/test');
43
test.describe('feature foo', () => {

playwright-test/tests/test_4.spec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// example.spec.js
21
const { test } = require('../fixtures');
32
const { expect } = require('@playwright/test');
43
test.describe('feature foo', () => {

playwright-test/tests/test_5.spec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// example.spec.js
21
const { test } = require('../fixtures');
32
const { expect } = require('@playwright/test');
43
test.describe('feature foo', () => {

playwright-test/tests/test_6.spec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// example.spec.js
21
const { test } = require('../fixtures');
32
const { expect } = require('@playwright/test');
43
test.describe('feature foo', () => {

playwright-test/tests/test_7.spec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// example.spec.js
21
const { test } = require('../fixtures');
32
const { expect } = require('@playwright/test');
43
test.describe('feature foo', () => {

0 commit comments

Comments
 (0)