@serenity-js/playwright-test
Advanced tools
Comparing version 3.10.4 to 3.11.0
@@ -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 @@ |
@@ -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 |
{ | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
217548
3547
7
+ Added@serenity-js/rest@3.11.0
+ Added@noble/hashes@1.6.0(transitive)
+ Added@serenity-js/assertions@3.11.0(transitive)
+ Added@serenity-js/core@3.11.0(transitive)
+ Added@serenity-js/playwright@3.11.0(transitive)
+ Added@serenity-js/rest@3.11.0(transitive)
+ Added@serenity-js/web@3.11.0(transitive)
+ Addedagent-base@7.1.1(transitive)
+ Addedasynckit@0.4.0(transitive)
+ Addedaxios@1.7.7(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addeddebug@4.3.7(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedfollow-redirects@1.15.9(transitive)
+ Addedform-data@4.0.1(transitive)
+ Addedhttp-proxy-agent@7.0.2(transitive)
+ Addedhttps-proxy-agent@7.0.5(transitive)
+ Addedlru-cache@10.4.3(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedms@2.1.3(transitive)
+ Addedproxy-from-env@1.1.0(transitive)
- Removed@noble/hashes@1.6.1(transitive)
- Removed@serenity-js/assertions@3.10.4(transitive)
- Removed@serenity-js/core@3.10.4(transitive)
- Removed@serenity-js/playwright@3.10.4(transitive)
- Removed@serenity-js/web@3.10.4(transitive)
Updated@serenity-js/core@3.11.0
Updated@serenity-js/web@3.11.0