Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@serenity-js/playwright-test

Package Overview
Dependencies
Maintainers
1
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@serenity-js/playwright-test - npm Package Compare versions

Comparing version 3.10.4 to 3.11.0

13

CHANGELOG.md

@@ -6,2 +6,15 @@ # Change Log

# [3.11.0](https://github.com/serenity-js/serenity-js/compare/v3.10.4...v3.11.0) (2023-10-03)
### Features
* **playwright-test:** enabled the ability to CallAnApi for all default actors ([436cde5](https://github.com/serenity-js/serenity-js/commit/436cde5283c14cea420000389d7c2c73e6122764)), closes [#1876](https://github.com/serenity-js/serenity-js/issues/1876)
* **playwright-test:** explicit proxy config will override env variables for REST interaction ([1c277d6](https://github.com/serenity-js/serenity-js/commit/1c277d6e45064fbb4ab3432c11d125f529268b5c)), closes [#1949](https://github.com/serenity-js/serenity-js/issues/1949)
* **web:** ability to CallAnApi is now available by default ([dfaf8e4](https://github.com/serenity-js/serenity-js/commit/dfaf8e4f4cb40f9be99624f0d616ebcf012c1fb0)), closes [#1876](https://github.com/serenity-js/serenity-js/issues/1876)
## [3.10.4](https://github.com/serenity-js/serenity-js/compare/v3.10.3...v3.10.4) (2023-09-22)

@@ -8,0 +21,0 @@

31

lib/api/test-api.js

@@ -32,2 +32,3 @@ "use strict";

const playwright_1 = require("@serenity-js/playwright");
const rest_1 = require("@serenity-js/rest");
const web_1 = require("@serenity-js/web");

@@ -42,4 +43,10 @@ const os = __importStar(require("os"));

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
async ({ contextOptions, page, serenity }, use) => {
await use(core_1.Cast.where(actor => actor.whoCan(playwright_1.BrowseTheWebWithPlaywright.usingPage(page, contextOptions), core_1.TakeNotes.usingAnEmptyNotepad())));
async ({ contextOptions, baseURL, extraHTTPHeaders, page, proxy }, use) => {
await use(core_1.Cast.where(actor => actor.whoCan(playwright_1.BrowseTheWebWithPlaywright.usingPage(page, contextOptions), core_1.TakeNotes.usingAnEmptyNotepad(), rest_1.CallAnApi.using({
baseURL: baseURL,
headers: extraHTTPHeaders,
proxy: proxy && proxy?.server
? asProxyConfig(proxy)
: undefined,
}))));
},

@@ -416,2 +423,22 @@ { option: true },

}
/**
* @private
* @param proxy
*/
function asProxyConfig(proxy) {
// Playwright defaults to http when proxy.server does not define the protocol
// See https://playwright.dev/docs/api/class-testoptions#test-options-proxy
const hasProtocol = /[\dA-Za-z]+:\/\//.test(proxy.server);
const proxyUrl = hasProtocol
? new URL(proxy.server)
: new URL(`http://${proxy.server}`);
const host = proxyUrl.hostname;
const port = proxyUrl.port
? Number(proxyUrl.port)
: undefined;
const auth = proxy.username
? { username: proxy.username, password: proxy.password || '' }
: undefined;
return { host, port, auth };
}
//# sourceMappingURL=test-api.js.map

13

package.json
{
"name": "@serenity-js/playwright-test",
"version": "3.10.4",
"version": "3.11.0",
"description": "Serenity/JS reporter and test APIs for Playwright Test",

@@ -48,5 +48,6 @@ "author": {

"@playwright/test": "^1.38.1",
"@serenity-js/core": "3.10.4",
"@serenity-js/playwright": "3.10.4",
"@serenity-js/web": "3.10.4",
"@serenity-js/core": "3.11.0",
"@serenity-js/playwright": "3.11.0",
"@serenity-js/rest": "3.11.0",
"@serenity-js/web": "3.11.0",
"deepmerge": "^4.3.1",

@@ -58,3 +59,3 @@ "tiny-types": "^1.20.0"

"@types/chai": "^4.3.6",
"@types/mocha": "^10.0.1",
"@types/mocha": "^10.0.2",
"c8": "8.0.1",

@@ -66,3 +67,3 @@ "mocha": "^10.2.0",

},
"gitHead": "28f12bd6029a9a6c1d8e492486138bf0c83916cd"
"gitHead": "4cd38cd3f6c8ea72e7e2776d76af9fa8a0672265"
}

@@ -15,2 +15,3 @@ import type {

import { BrowseTheWebWithPlaywright, SerenitySelectorEngines } from '@serenity-js/playwright';
import { CallAnApi } from '@serenity-js/rest';
import { Photographer, TakePhotosOfFailures } from '@serenity-js/web';

@@ -36,7 +37,14 @@ import * as os from 'os';

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
async ({ contextOptions, page, serenity }, use): Promise<void> => {
async ({ contextOptions, baseURL, extraHTTPHeaders, page, proxy }, use): Promise<void> => {
await use(Cast.where(actor => actor.whoCan(
BrowseTheWebWithPlaywright.usingPage(page, contextOptions),
TakeNotes.usingAnEmptyNotepad(),
)))
CallAnApi.using({
baseURL: baseURL,
headers: extraHTTPHeaders,
proxy: proxy && proxy?.server
? asProxyConfig(proxy)
: undefined,
}),
)));
},

@@ -199,10 +207,10 @@ { option: true },

},
beforeAll: baseTest.beforeAll,
beforeAll: baseTest.beforeAll,
beforeEach: baseTest.beforeEach,
afterEach: baseTest.afterEach,
afterAll: baseTest.afterAll,
describe: baseTest.describe,
expect: baseTest.expect,
it: baseTest,
test: baseTest,
afterEach: baseTest.afterEach,
afterAll: baseTest.afterAll,
describe: baseTest.describe,
expect: baseTest.expect,
it: baseTest,
test: baseTest,
};

@@ -501,1 +509,29 @@ }

}
/**
* @private
* @param proxy
*/
function asProxyConfig(proxy: PlaywrightTestOptions['proxy']): {
host: string,
port?: number,
auth?: { username: string, password: string }
} {
// Playwright defaults to http when proxy.server does not define the protocol
// See https://playwright.dev/docs/api/class-testoptions#test-options-proxy
const hasProtocol = /[\dA-Za-z]+:\/\//.test(proxy.server);
const proxyUrl = hasProtocol
? new URL(proxy.server)
: new URL(`http://${ proxy.server }`);
const host = proxyUrl.hostname;
const port = proxyUrl.port
? Number(proxyUrl.port)
: undefined;
const auth = proxy.username
? { username: proxy.username, password: proxy.password || '' }
: undefined;
return { host, port, auth };
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc