@playwright/test
Advanced tools
Comparing version 0.9.17 to 0.9.18
@@ -24,3 +24,3 @@ /** | ||
slowMo: number; | ||
trace: boolean; | ||
video: boolean; | ||
}; | ||
@@ -30,3 +30,3 @@ declare type PlaywrightWorkerFixtures = { | ||
browserType: BrowserType<Browser>; | ||
defaultBrowserOptions: LaunchOptions; | ||
browserOptions: LaunchOptions; | ||
browser: Browser; | ||
@@ -41,3 +41,3 @@ isChromium: boolean; | ||
declare type PlaywrightTestFixtures = { | ||
defaultContextOptions: BrowserContextOptions; | ||
contextOptions: BrowserContextOptions; | ||
contextFactory: (options?: BrowserContextOptions) => Promise<BrowserContext>; | ||
@@ -47,8 +47,8 @@ context: BrowserContext; | ||
}; | ||
export declare const folio: import("folio").Fixtures<{ | ||
testWorkerIndex: number; | ||
} & PlaywrightWorkerFixtures, { | ||
export declare const folio: import("folio").Folio<{ | ||
testInfo: import("folio").TestInfo; | ||
testParametersPathSegment: string; | ||
} & PlaywrightTestFixtures, PlaywrightParameters>; | ||
} & PlaywrightTestFixtures, { | ||
testWorkerIndex: number; | ||
} & PlaywrightWorkerFixtures, PlaywrightParameters>; | ||
export declare const it: { | ||
@@ -181,10 +181,2 @@ (name: string, inner: (fixtures: PlaywrightParameters & { | ||
}; | ||
export declare const fdescribe: { | ||
(name: string, inner: () => void): void; | ||
(name: string, modifierFn: (modifier: import("folio/out/testModifier").TestModifier, parameters: PlaywrightParameters) => any, inner: () => void): void; | ||
}; | ||
export declare const xdescribe: { | ||
(name: string, inner: () => void): void; | ||
(name: string, modifierFn: (modifier: import("folio/out/testModifier").TestModifier, parameters: PlaywrightParameters) => any, inner: () => void): void; | ||
}; | ||
export declare const beforeEach: (inner: (fixtures: PlaywrightParameters & { | ||
@@ -191,0 +183,0 @@ testWorkerIndex: number; |
@@ -17,25 +17,5 @@ "use strict"; | ||
*/ | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.afterAll = exports.beforeAll = exports.afterEach = exports.beforeEach = exports.xdescribe = exports.fdescribe = exports.describe = exports.test = exports.xit = exports.fit = exports.it = exports.folio = exports.config = exports.expect = void 0; | ||
exports.afterAll = exports.beforeAll = exports.afterEach = exports.beforeEach = exports.describe = exports.test = exports.xit = exports.fit = exports.it = exports.folio = exports.config = exports.expect = void 0; | ||
const folio_1 = require("folio"); | ||
const path = __importStar(require("path")); | ||
var folio_2 = require("folio"); | ||
@@ -52,4 +32,4 @@ Object.defineProperty(exports, "expect", { enumerable: true, get: function () { return folio_2.expect; } }); | ||
fixtures.slowMo.initParameter('Slows down Playwright operations by the specified amount of milliseconds', 0); | ||
fixtures.trace.initParameter('Whether to record the execution trace', !!process.env.TRACING); | ||
fixtures.defaultBrowserOptions.init(async ({ headful, slowMo }, run) => { | ||
fixtures.video.initParameter('Record videos while running tests', false); | ||
fixtures.browserOptions.init(async ({ headful, slowMo }, run) => { | ||
await run({ | ||
@@ -69,4 +49,4 @@ handleSIGINT: false, | ||
}, { scope: 'worker' }); | ||
fixtures.browser.init(async ({ browserType, defaultBrowserOptions }, run) => { | ||
const browser = await browserType.launch(defaultBrowserOptions); | ||
fixtures.browser.init(async ({ browserType, browserOptions }, run) => { | ||
const browser = await browserType.launch(browserOptions); | ||
await run(browser); | ||
@@ -93,7 +73,5 @@ await browser.close(); | ||
}, { scope: 'worker' }); | ||
fixtures.defaultContextOptions.init(async ({ trace, testInfo }, run) => { | ||
if (trace || testInfo.retry) { | ||
fixtures.contextOptions.init(async ({ video, testInfo }, run) => { | ||
if (video) { | ||
await run({ | ||
_traceResourcesPath: path.join(folio_1.config.outputDir, 'trace-resources'), | ||
_tracePath: testInfo.outputPath('playwright.trace'), | ||
videosPath: testInfo.outputPath(''), | ||
@@ -106,6 +84,6 @@ }); | ||
}); | ||
fixtures.contextFactory.init(async ({ browser, defaultContextOptions, testInfo, screenshotOnFailure }, run) => { | ||
fixtures.contextFactory.init(async ({ browser, contextOptions, testInfo, screenshotOnFailure }, run) => { | ||
const contexts = []; | ||
async function contextFactory(options = {}) { | ||
const context = await browser.newContext({ ...defaultContextOptions, ...options }); | ||
const context = await browser.newContext({ ...contextOptions, ...options }); | ||
contexts.push(context); | ||
@@ -145,4 +123,2 @@ return context; | ||
exports.describe = exports.folio.describe; | ||
exports.fdescribe = exports.folio.fdescribe; | ||
exports.xdescribe = exports.folio.xdescribe; | ||
exports.beforeEach = exports.folio.beforeEach; | ||
@@ -149,0 +125,0 @@ exports.afterEach = exports.folio.afterEach; |
{ | ||
"name": "@playwright/test", | ||
"version": "0.9.17", | ||
"version": "0.9.18", | ||
"license": "Apache-2.0", | ||
@@ -21,4 +21,4 @@ "author": { | ||
"dependencies": { | ||
"folio": "=0.3.10", | ||
"playwright": "1.4.0-next.1601161680085", | ||
"folio": "=0.3.11", | ||
"playwright": "=1.5.0", | ||
"rimraf": "^3.0.2" | ||
@@ -25,0 +25,0 @@ }, |
@@ -1,2 +0,2 @@ | ||
# 🎭 End-to-end web tests with Playwright [![npm version](https://img.shields.io/npm/v/@playwright/test.svg?style=flat)](https://www.npmjs.com/package/@playwright/test) | ||
# 🎭 End-to-end tests with Playwright [![npm version](https://img.shields.io/npm/v/@playwright/test.svg?style=flat)](https://www.npmjs.com/package/@playwright/test) | ||
@@ -32,12 +32,11 @@ 🚧 This project is under active development and is not ready for serious use. | ||
Create `foo.spec.ts` (or `foo.spec.js`) to define your test. Playwright provides a [`page`](https://playwright.dev/#path=docs%2Fapi.md&q=class-page) argument to the test function. | ||
Create `foo.spec.ts` to define your test. The test function uses the [`page`](https://playwright.dev/#path=docs%2Fapi.md&q=class-page) argument for browser automation. | ||
```js | ||
// tests/foo.spec.ts | ||
const { it, expect } = require('@playwright/test'); | ||
import { it, expect } from '@playwright/test'; | ||
it('is a basic test with the page', async ({ page }) => { | ||
await page.goto('https://playwright.dev/'); | ||
const home = await page.waitForSelector('home-navigation'); | ||
expect(await home.innerText()).toBe('🎭 Playwright'); | ||
const name = await page.innerText('.home-navigation'); | ||
expect(name).toBe('🎭 Playwright'); | ||
}); | ||
@@ -56,3 +55,3 @@ ``` | ||
#### Spec syntax | ||
#### Specs and assertions | ||
@@ -67,3 +66,2 @@ Use `it` and `describe` to write test functions. | ||
// Test function | ||
// ... | ||
}) | ||
@@ -75,4 +73,2 @@ }); | ||
#### Assertions | ||
The test runner provides the [expect](https://www.npmjs.com/package/expect) package for assertions. See [expect API reference](https://jestjs.io/docs/en/expect). | ||
@@ -94,3 +90,3 @@ | ||
# Take screenshots on failure | ||
# Save screenshots on failure in test-results directory | ||
npx folio --param screenshotOnFailure | ||
@@ -104,3 +100,14 @@ | ||
#### Configure NPM scripts | ||
Save the run command as an NPM script. | ||
```json | ||
{ | ||
"scripts": { | ||
"test": "npx folio --param screenshotOnFailure" | ||
} | ||
} | ||
``` | ||
----------- | ||
@@ -107,0 +114,0 @@ |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
166
5
31906
317
- Removed@types/node@22.10.1(transitive)
- Removed@types/yauzl@2.10.3(transitive)
- Removedagent-base@6.0.2(transitive)
- Removedbuffer-crc32@0.2.13(transitive)
- Removeddebug@4.3.7(transitive)
- Removedend-of-stream@1.4.4(transitive)
- Removedextract-zip@2.0.1(transitive)
- Removedfd-slicer@1.1.0(transitive)
- Removedget-stream@5.2.0(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedhttps-proxy-agent@5.0.1(transitive)
- Removedjpeg-js@0.4.4(transitive)
- Removedmime@2.6.0(transitive)
- Removedms@2.1.3(transitive)
- Removedpend@1.2.0(transitive)
- Removedplaywright@1.4.0-next.1601161680085(transitive)
- Removedpngjs@5.0.0(transitive)
- Removedprogress@2.0.3(transitive)
- Removedproper-lockfile@4.1.2(transitive)
- Removedproxy-from-env@1.1.0(transitive)
- Removedpump@3.0.2(transitive)
- Removedretry@0.12.0(transitive)
- Removedsignal-exit@3.0.7(transitive)
- Removedundici-types@6.20.0(transitive)
- Removedws@7.5.10(transitive)
- Removedyauzl@2.10.0(transitive)
Updatedfolio@=0.3.11
Updatedplaywright@=1.5.0