Initial boiler plate project
This commit is contained in:
18
node_modules/next/dist/experimental/testmode/playwright/index.d.ts
generated
vendored
Normal file
18
node_modules/next/dist/experimental/testmode/playwright/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
import * as base from '@playwright/test';
|
||||
import type { NextFixture } from './next-fixture';
|
||||
import type { NextOptions } from './next-options';
|
||||
import type { NextWorkerFixture } from './next-worker-fixture';
|
||||
export * from '@playwright/test';
|
||||
export type { NextFixture, NextOptions };
|
||||
export type { FetchHandlerResult } from '../proxy';
|
||||
export interface NextOptionsConfig {
|
||||
nextOptions?: NextOptions;
|
||||
}
|
||||
export declare function defineConfig<T extends NextOptionsConfig, W>(config: base.PlaywrightTestConfig<T, W>): base.PlaywrightTestConfig<T, W>;
|
||||
export declare const test: base.TestType<base.PlaywrightTestArgs & base.PlaywrightTestOptions & {
|
||||
next: NextFixture;
|
||||
nextOptions: NextOptions;
|
||||
}, base.PlaywrightWorkerArgs & base.PlaywrightWorkerOptions & {
|
||||
_nextWorker: NextWorkerFixture;
|
||||
}>;
|
||||
export default test;
|
||||
119
node_modules/next/dist/experimental/testmode/playwright/index.js
generated
vendored
Normal file
119
node_modules/next/dist/experimental/testmode/playwright/index.js
generated
vendored
Normal file
@ -0,0 +1,119 @@
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
default: null,
|
||||
defineConfig: null,
|
||||
test: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
default: function() {
|
||||
return _default;
|
||||
},
|
||||
defineConfig: function() {
|
||||
return defineConfig;
|
||||
},
|
||||
test: function() {
|
||||
return test;
|
||||
}
|
||||
});
|
||||
0 && __export(require("@playwright/test"));
|
||||
const _test = /*#__PURE__*/ _interop_require_wildcard(_export_star(require("@playwright/test"), exports));
|
||||
const _nextworkerfixture = require("./next-worker-fixture");
|
||||
const _nextfixture = require("./next-fixture");
|
||||
function _export_star(from, to) {
|
||||
Object.keys(from).forEach(function(k) {
|
||||
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
||||
Object.defineProperty(to, k, {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return from[k];
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return from;
|
||||
}
|
||||
function _getRequireWildcardCache(nodeInterop) {
|
||||
if (typeof WeakMap !== "function") return null;
|
||||
var cacheBabelInterop = new WeakMap();
|
||||
var cacheNodeInterop = new WeakMap();
|
||||
return (_getRequireWildcardCache = function(nodeInterop) {
|
||||
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
||||
})(nodeInterop);
|
||||
}
|
||||
function _interop_require_wildcard(obj, nodeInterop) {
|
||||
if (!nodeInterop && obj && obj.__esModule) {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
||||
return {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
var cache = _getRequireWildcardCache(nodeInterop);
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {
|
||||
__proto__: null
|
||||
};
|
||||
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for(var key in obj){
|
||||
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
||||
if (desc && (desc.get || desc.set)) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
function defineConfig(config) {
|
||||
return _test.defineConfig(config);
|
||||
}
|
||||
const test = _test.test.extend({
|
||||
nextOptions: [
|
||||
{
|
||||
fetchLoopback: false
|
||||
},
|
||||
{
|
||||
option: true
|
||||
}
|
||||
],
|
||||
_nextWorker: [
|
||||
// eslint-disable-next-line no-empty-pattern
|
||||
async ({}, use)=>{
|
||||
await (0, _nextworkerfixture.applyNextWorkerFixture)(use);
|
||||
},
|
||||
{
|
||||
scope: "worker",
|
||||
auto: true
|
||||
}
|
||||
],
|
||||
next: async ({ nextOptions, _nextWorker, page }, use, testInfo)=>{
|
||||
await (0, _nextfixture.applyNextFixture)(use, {
|
||||
testInfo,
|
||||
nextWorker: _nextWorker,
|
||||
page,
|
||||
nextOptions
|
||||
});
|
||||
}
|
||||
});
|
||||
const _default = test;
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/next/dist/experimental/testmode/playwright/index.js.map
generated
vendored
Normal file
1
node_modules/next/dist/experimental/testmode/playwright/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/experimental/testmode/playwright/index.ts"],"names":["defineConfig","test","config","base","extend","nextOptions","fetchLoopback","option","_nextWorker","use","applyNextWorkerFixture","scope","auto","next","page","testInfo","applyNextFixture","nextWorker"],"mappings":"AAAA,6DAA6D;;;;;;;;;;;;;;;;;IAmD7D,OAAmB;eAAnB;;IA9BgBA,YAAY;eAAZA;;IAMHC,IAAI;eAAJA;;;;2EA1BS;mCAIiB;6BACN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAe1B,SAASD,aACdE,MAAoC;IAEpC,OAAOC,MAAKH,YAAY,CAAIE;AAC9B;AAEO,MAAMD,OAAOE,MAAKF,IAAI,CAACG,MAAM,CAGlC;IACAC,aAAa;QAAC;YAAEC,eAAe;QAAM;QAAG;YAAEC,QAAQ;QAAK;KAAE;IAEzDC,aAAa;QACX,4CAA4C;QAC5C,OAAO,EAAE,EAAEC;YACT,MAAMC,IAAAA,yCAAsB,EAACD;QAC/B;QACA;YAAEE,OAAO;YAAUC,MAAM;QAAK;KAC/B;IAEDC,MAAM,OAAO,EAAER,WAAW,EAAEG,WAAW,EAAEM,IAAI,EAAE,EAAEL,KAAKM;QACpD,MAAMC,IAAAA,6BAAgB,EAACP,KAAK;YAC1BM;YACAE,YAAYT;YACZM;YACAT;QACF;IACF;AACF;MAEA,WAAeJ"}
|
||||
20
node_modules/next/dist/experimental/testmode/playwright/msw.d.ts
generated
vendored
Normal file
20
node_modules/next/dist/experimental/testmode/playwright/msw.d.ts
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
import { defineConfig } from './index';
|
||||
import type { NextFixture } from './next-fixture';
|
||||
import { type RequestHandler } from 'msw';
|
||||
export * from 'msw';
|
||||
export * from '@playwright/test';
|
||||
export type { NextFixture };
|
||||
export { defineConfig };
|
||||
export interface MswFixture {
|
||||
use: (...handlers: RequestHandler[]) => void;
|
||||
}
|
||||
export declare const test: import("@playwright/test").TestType<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & {
|
||||
next: NextFixture;
|
||||
nextOptions: import("./next-options").NextOptions;
|
||||
} & {
|
||||
msw: MswFixture;
|
||||
mswHandlers: RequestHandler[];
|
||||
}, import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & {
|
||||
_nextWorker: import("./next-worker-fixture").NextWorkerFixture;
|
||||
}>;
|
||||
export default test;
|
||||
121
node_modules/next/dist/experimental/testmode/playwright/msw.js
generated
vendored
Normal file
121
node_modules/next/dist/experimental/testmode/playwright/msw.js
generated
vendored
Normal file
@ -0,0 +1,121 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
default: null,
|
||||
defineConfig: null,
|
||||
test: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
default: function() {
|
||||
return _default;
|
||||
},
|
||||
defineConfig: function() {
|
||||
return _index.defineConfig;
|
||||
},
|
||||
test: function() {
|
||||
return test;
|
||||
}
|
||||
});
|
||||
0 && __export(require("msw")) && __export(require("@playwright/test"));
|
||||
const _index = require("./index");
|
||||
const _msw = _export_star(require("msw"), exports);
|
||||
const _stricteventemitter = require("strict-event-emitter");
|
||||
_export_star(require("@playwright/test"), exports);
|
||||
function _export_star(from, to) {
|
||||
Object.keys(from).forEach(function(k) {
|
||||
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
||||
Object.defineProperty(to, k, {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return from[k];
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return from;
|
||||
}
|
||||
const test = _index.test.extend({
|
||||
mswHandlers: [
|
||||
[],
|
||||
{
|
||||
option: true
|
||||
}
|
||||
],
|
||||
msw: [
|
||||
async ({ next, mswHandlers }, use)=>{
|
||||
const handlers = [
|
||||
...mswHandlers
|
||||
];
|
||||
const emitter = new _stricteventemitter.Emitter();
|
||||
next.onFetch(async (request)=>{
|
||||
const { body, method, headers, credentials, cache, redirect, integrity, keepalive, mode, destination, referrer, referrerPolicy } = request;
|
||||
const mockedRequest = new _msw.MockedRequest(new URL(request.url), {
|
||||
body: body ? await request.arrayBuffer() : undefined,
|
||||
method,
|
||||
headers: Object.fromEntries(headers),
|
||||
credentials,
|
||||
cache,
|
||||
redirect,
|
||||
integrity,
|
||||
keepalive,
|
||||
mode,
|
||||
destination,
|
||||
referrer,
|
||||
referrerPolicy
|
||||
});
|
||||
let isUnhandled = false;
|
||||
let isPassthrough = false;
|
||||
let mockedResponse;
|
||||
await (0, _msw.handleRequest)(mockedRequest, handlers.slice(0), {
|
||||
onUnhandledRequest: ()=>{
|
||||
isUnhandled = true;
|
||||
}
|
||||
}, emitter, {
|
||||
onPassthroughResponse: ()=>{
|
||||
isPassthrough = true;
|
||||
},
|
||||
onMockedResponse: (r)=>{
|
||||
mockedResponse = r;
|
||||
}
|
||||
});
|
||||
if (isUnhandled) {
|
||||
return undefined;
|
||||
}
|
||||
if (isPassthrough) {
|
||||
return "continue";
|
||||
}
|
||||
if (mockedResponse) {
|
||||
const { status, headers: responseHeaders, body: responseBody, delay } = mockedResponse;
|
||||
if (delay) {
|
||||
await new Promise((resolve)=>setTimeout(resolve, delay));
|
||||
}
|
||||
return new Response(responseBody, {
|
||||
status,
|
||||
headers: new Headers(responseHeaders)
|
||||
});
|
||||
}
|
||||
return "abort";
|
||||
});
|
||||
await use({
|
||||
use: (...newHandlers)=>{
|
||||
handlers.unshift(...newHandlers);
|
||||
}
|
||||
});
|
||||
handlers.length = 0;
|
||||
},
|
||||
{
|
||||
auto: true
|
||||
}
|
||||
]
|
||||
});
|
||||
const _default = test;
|
||||
|
||||
//# sourceMappingURL=msw.js.map
|
||||
1
node_modules/next/dist/experimental/testmode/playwright/msw.js.map
generated
vendored
Normal file
1
node_modules/next/dist/experimental/testmode/playwright/msw.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/experimental/testmode/playwright/msw.ts"],"names":["defineConfig","test","base","extend","mswHandlers","option","msw","next","use","handlers","emitter","Emitter","onFetch","request","body","method","headers","credentials","cache","redirect","integrity","keepalive","mode","destination","referrer","referrerPolicy","mockedRequest","MockedRequest","URL","url","arrayBuffer","undefined","Object","fromEntries","isUnhandled","isPassthrough","mockedResponse","handleRequest","slice","onUnhandledRequest","onPassthroughResponse","onMockedResponse","r","status","responseHeaders","responseBody","delay","Promise","resolve","setTimeout","Response","Headers","newHandlers","unshift","length","auto"],"mappings":";;;;;;;;;;;;;;;;IA2HA,OAAmB;eAAnB;;IA1GSA,YAAY;eAAZA,mBAAY;;IAMRC,IAAI;eAAJA;;;;uBAvB8B;kCAQpC;oCAEiB;qBAKV;;;;;;;;;;;;;;AA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ASF;oBACrD;oBACA,OAAO,IAAII,SAASL,cAAc;wBAChCF;wBACA3B,SAAS,IAAImC,QAAQP;oBACvB;gBACF;gBAEA,OAAO;YACT;YAEA,MAAMpC,IAAI;gBACRA,KAAK,CAAC,GAAG4C;oBACP3C,SAAS4C,OAAO,IAAID;gBACtB;YACF;YAEA3C,SAAS6C,MAAM,GAAG;QACpB;QACA;YAAEC,MAAM;QAAK;KACd;AACH;MAEA,WAAetD"}
|
||||
12
node_modules/next/dist/experimental/testmode/playwright/next-fixture.d.ts
generated
vendored
Normal file
12
node_modules/next/dist/experimental/testmode/playwright/next-fixture.d.ts
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
import type { Page, TestInfo } from '@playwright/test';
|
||||
import type { NextWorkerFixture, FetchHandler } from './next-worker-fixture';
|
||||
import type { NextOptions } from './next-options';
|
||||
export interface NextFixture {
|
||||
onFetch: (handler: FetchHandler) => void;
|
||||
}
|
||||
export declare function applyNextFixture(use: (fixture: NextFixture) => Promise<void>, { testInfo, nextOptions, nextWorker, page, }: {
|
||||
testInfo: TestInfo;
|
||||
nextOptions: NextOptions;
|
||||
nextWorker: NextWorkerFixture;
|
||||
page: Page;
|
||||
}): Promise<void>;
|
||||
56
node_modules/next/dist/experimental/testmode/playwright/next-fixture.js
generated
vendored
Normal file
56
node_modules/next/dist/experimental/testmode/playwright/next-fixture.js
generated
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "applyNextFixture", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return applyNextFixture;
|
||||
}
|
||||
});
|
||||
const _pageroute = require("./page-route");
|
||||
const _report = require("./report");
|
||||
class NextFixtureImpl {
|
||||
constructor(testInfo, options, worker, page){
|
||||
this.testInfo = testInfo;
|
||||
this.options = options;
|
||||
this.worker = worker;
|
||||
this.page = page;
|
||||
this.fetchHandlers = [];
|
||||
this.testId = testInfo.testId;
|
||||
const testHeaders = {
|
||||
"Next-Test-Proxy-Port": String(worker.proxyPort),
|
||||
"Next-Test-Data": this.testId
|
||||
};
|
||||
const handleFetch = this.handleFetch.bind(this);
|
||||
worker.onFetch(this.testId, handleFetch);
|
||||
this.page.context().route("**", (route)=>(0, _pageroute.handleRoute)(route, page, testHeaders, handleFetch));
|
||||
}
|
||||
teardown() {
|
||||
this.worker.cleanupTest(this.testId);
|
||||
}
|
||||
onFetch(handler) {
|
||||
this.fetchHandlers.push(handler);
|
||||
}
|
||||
async handleFetch(request) {
|
||||
return (0, _report.reportFetch)(this.testInfo, request, async (req)=>{
|
||||
for (const handler of this.fetchHandlers.slice().reverse()){
|
||||
const result = await handler(req.clone());
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
if (this.options.fetchLoopback) {
|
||||
return fetch(req.clone());
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
}
|
||||
}
|
||||
async function applyNextFixture(use, { testInfo, nextOptions, nextWorker, page }) {
|
||||
const fixture = new NextFixtureImpl(testInfo, nextOptions, nextWorker, page);
|
||||
await use(fixture);
|
||||
fixture.teardown();
|
||||
}
|
||||
|
||||
//# sourceMappingURL=next-fixture.js.map
|
||||
1
node_modules/next/dist/experimental/testmode/playwright/next-fixture.js.map
generated
vendored
Normal file
1
node_modules/next/dist/experimental/testmode/playwright/next-fixture.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/experimental/testmode/playwright/next-fixture.ts"],"names":["applyNextFixture","NextFixtureImpl","constructor","testInfo","options","worker","page","fetchHandlers","testId","testHeaders","String","proxyPort","handleFetch","bind","onFetch","context","route","handleRoute","teardown","cleanupTest","handler","push","request","reportFetch","req","slice","reverse","result","clone","fetchLoopback","fetch","undefined","use","nextOptions","nextWorker","fixture"],"mappings":";;;;+BA2DsBA;;;eAAAA;;;2BAvDM;wBACA;AAM5B,MAAMC;IAIJC,YACE,AAAQC,QAAkB,EA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AEvE,MAAM0B,IAAIG;IAEVA,QAAQjB,QAAQ;AAClB"}
|
||||
3
node_modules/next/dist/experimental/testmode/playwright/next-options.d.ts
generated
vendored
Normal file
3
node_modules/next/dist/experimental/testmode/playwright/next-options.d.ts
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
export interface NextOptions {
|
||||
fetchLoopback?: boolean;
|
||||
}
|
||||
6
node_modules/next/dist/experimental/testmode/playwright/next-options.js
generated
vendored
Normal file
6
node_modules/next/dist/experimental/testmode/playwright/next-options.js
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
//# sourceMappingURL=next-options.js.map
|
||||
1
node_modules/next/dist/experimental/testmode/playwright/next-options.js.map
generated
vendored
Normal file
1
node_modules/next/dist/experimental/testmode/playwright/next-options.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":[],"names":[],"mappings":""}
|
||||
8
node_modules/next/dist/experimental/testmode/playwright/next-worker-fixture.d.ts
generated
vendored
Normal file
8
node_modules/next/dist/experimental/testmode/playwright/next-worker-fixture.d.ts
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
import type { FetchHandlerResult } from '../proxy';
|
||||
export type FetchHandler = (request: Request) => FetchHandlerResult | Promise<FetchHandlerResult>;
|
||||
export interface NextWorkerFixture {
|
||||
proxyPort: number;
|
||||
onFetch: (testId: string, handler: FetchHandler) => void;
|
||||
cleanupTest: (testId: string) => void;
|
||||
}
|
||||
export declare function applyNextWorkerFixture(use: (fixture: NextWorkerFixture) => Promise<void>): Promise<void>;
|
||||
49
node_modules/next/dist/experimental/testmode/playwright/next-worker-fixture.js
generated
vendored
Normal file
49
node_modules/next/dist/experimental/testmode/playwright/next-worker-fixture.js
generated
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "applyNextWorkerFixture", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return applyNextWorkerFixture;
|
||||
}
|
||||
});
|
||||
const _proxy = require("../proxy");
|
||||
class NextWorkerFixtureImpl {
|
||||
async setup() {
|
||||
const server = await (0, _proxy.createProxyServer)({
|
||||
onFetch: this.handleProxyFetch.bind(this)
|
||||
});
|
||||
this.proxyPort = server.port;
|
||||
this.proxyServer = server;
|
||||
}
|
||||
teardown() {
|
||||
if (this.proxyServer) {
|
||||
this.proxyServer.close();
|
||||
this.proxyServer = null;
|
||||
}
|
||||
}
|
||||
cleanupTest(testId) {
|
||||
this.proxyFetchMap.delete(testId);
|
||||
}
|
||||
onFetch(testId, handler) {
|
||||
this.proxyFetchMap.set(testId, handler);
|
||||
}
|
||||
async handleProxyFetch(testId, request) {
|
||||
const handler = this.proxyFetchMap.get(testId);
|
||||
return handler == null ? void 0 : handler(request);
|
||||
}
|
||||
constructor(){
|
||||
this.proxyPort = 0;
|
||||
this.proxyServer = null;
|
||||
this.proxyFetchMap = new Map();
|
||||
}
|
||||
}
|
||||
async function applyNextWorkerFixture(use) {
|
||||
const fixture = new NextWorkerFixtureImpl();
|
||||
await fixture.setup();
|
||||
await use(fixture);
|
||||
fixture.teardown();
|
||||
}
|
||||
|
||||
//# sourceMappingURL=next-worker-fixture.js.map
|
||||
1
node_modules/next/dist/experimental/testmode/playwright/next-worker-fixture.js.map
generated
vendored
Normal file
1
node_modules/next/dist/experimental/testmode/playwright/next-worker-fixture.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/experimental/testmode/playwright/next-worker-fixture.ts"],"names":["applyNextWorkerFixture","NextWorkerFixtureImpl","setup","server","createProxyServer","onFetch","handleProxyFetch","bind","proxyPort","port","proxyServer","teardown","close","cleanupTest","testId","proxyFetchMap","delete","handler","set","request","get","Map","use","fixture"],"mappings":";;;;+BAmDsBA;;;eAAAA;;;uBAlDY;AAYlC,MAAMC;IAKJ,MAAMC,QAAuB;QAC3B,MAAMC,SAAS,MAAMC,IAAAA,wBAAiB,EAAC;YACrCC,SAAS,IAAI,CAACC,gBAAgB,CAACC,IAAI,CAAC,IAAI;QAC1C;QAEA,IAAI,CAACC,SAAS,GAAGL,OAAOM,IAAI;QAC5B,IAAI,CAACC,WAAW,GAAGP;IACrB;IAEAQ,WAAiB;QACf,IAAI,IAAI,CAACD,WAAW,EAAE;YACpB,IAAI,CAACA,WAAW,CAACE,KAAK;YACtB,IAAI,CAACF,WAAW,GAAG;QACrB;IACF;IAEAG,YAAYC,MAAc,EAAQ;QAChC,IAAI,CAACC,aAAa,CAACC,MAAM,CAACF;IAC5B;IAEAT,QAAQS,MAAc,EAAEG,OAAqB,EAAQ;QACnD,IAAI,CAACF,aAAa,CAACG,GAAG,CAACJ,QAAQG;IACjC;IAEA,MAAcX,iBACZQ,MAAc,EACdK,OAAgB,EACa;QAC7B,MAAMF,UAAU,IAAI,CAACF,aAAa,CAACK,GAAG,CAACN;QACvC,OAAOG,2BAAAA,QAAUE;IACnB;;aAlCOX,YAAoB;aACnBE,cAAkC;aAClCK,gBAAgB,IAAIM;;AAiC9B;AAEO,eAAerB,uBACpBsB,GAAkD;IAElD,MAAMC,UAAU,IAAItB;IACpB,MAAMsB,QAAQrB,KAAK;IACnB,MAAMoB,IAAIC;IACVA,QAAQZ,QAAQ;AAClB"}
|
||||
3
node_modules/next/dist/experimental/testmode/playwright/page-route.d.ts
generated
vendored
Normal file
3
node_modules/next/dist/experimental/testmode/playwright/page-route.d.ts
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
import type { Page, Route } from '@playwright/test';
|
||||
import type { FetchHandler } from './next-worker-fixture';
|
||||
export declare function handleRoute(route: Route, page: Page, testHeaders: Record<string, string>, fetchHandler: FetchHandler | null): Promise<void>;
|
||||
59
node_modules/next/dist/experimental/testmode/playwright/page-route.js
generated
vendored
Normal file
59
node_modules/next/dist/experimental/testmode/playwright/page-route.js
generated
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "handleRoute", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return handleRoute;
|
||||
}
|
||||
});
|
||||
function continueRoute(route, request, testHeaders) {
|
||||
return route.continue({
|
||||
headers: {
|
||||
...request.headers(),
|
||||
...testHeaders
|
||||
}
|
||||
});
|
||||
}
|
||||
async function handleRoute(route, page, testHeaders, fetchHandler) {
|
||||
const request = route.request();
|
||||
// Continue the navigation and non-fetch requests.
|
||||
if (request.isNavigationRequest() || request.resourceType() !== "fetch") {
|
||||
return continueRoute(route, request, testHeaders);
|
||||
}
|
||||
// Continue the local requests. The followup requests will be intercepted
|
||||
// on the server.
|
||||
const pageOrigin = new URL(page.url()).origin;
|
||||
const requestOrigin = new URL(request.url()).origin;
|
||||
if (pageOrigin === requestOrigin) {
|
||||
return continueRoute(route, request, testHeaders);
|
||||
}
|
||||
if (!fetchHandler) {
|
||||
return route.abort();
|
||||
}
|
||||
const postData = request.postDataBuffer();
|
||||
const fetchRequest = new Request(request.url(), {
|
||||
method: request.method(),
|
||||
headers: Object.fromEntries(Object.entries(request.headers()).filter(([name])=>!name.toLowerCase().startsWith("next-test-"))),
|
||||
body: postData ?? null
|
||||
});
|
||||
const proxyResponse = await fetchHandler(fetchRequest);
|
||||
if (!proxyResponse) {
|
||||
return route.abort();
|
||||
}
|
||||
if (proxyResponse === "abort") {
|
||||
return route.abort();
|
||||
}
|
||||
if (proxyResponse === "continue") {
|
||||
return continueRoute(route, request, testHeaders);
|
||||
}
|
||||
const { status, headers, body } = proxyResponse;
|
||||
return route.fulfill({
|
||||
status,
|
||||
headers: Object.fromEntries(headers),
|
||||
body: body ? Buffer.from(await proxyResponse.arrayBuffer()) : undefined
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=page-route.js.map
|
||||
1
node_modules/next/dist/experimental/testmode/playwright/page-route.js.map
generated
vendored
Normal file
1
node_modules/next/dist/experimental/testmode/playwright/page-route.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/experimental/testmode/playwright/page-route.ts"],"names":["handleRoute","continueRoute","route","request","testHeaders","continue","headers","page","fetchHandler","isNavigationRequest","resourceType","pageOrigin","URL","url","origin","requestOrigin","abort","postData","postDataBuffer","fetchRequest","Request","method","Object","fromEntries","entries","filter","name","toLowerCase","startsWith","body","proxyResponse","status","fulfill","Buffer","from","arrayBuffer","undefined"],"mappings":";;;;+BAoBsBA;;;eAAAA;;;AAbtB,SAASC,cACPC,KAAY,EACZC,OAA0B,EAC1BC,WAAmC;IAEnC,OAAOF,MAAMG,QAAQ,CAAC;QACpBC,SAAS;YACP,GAAGH,QAAQG,OAAO,EAAE;YACpB,GAAGF,WAAW;QAChB;IACF;AACF;AAEO,eAAeJ,YACpBE,KAAY,EACZK,IAAU,EACVH,WAAmC,EACnCI,YAAiC;IAEjC,MAAML,UAAUD,MAAMC,OAAO;IAE7B,kDAAkD;IAClD,IAAIA,QAAQM,mBAAmB,MAAMN,QAAQO,YAAY,OAAO,SAAS;QACvE,OAAOT,cAAcC,OAAOC,SAASC;IACvC;IAEA,yEAAyE;IACzE,iBAAiB;IACjB,MAAMO,aAAa,IAAIC,IAAIL,KAAKM,GAAG,IAAIC,MAAM;IAC7C,MAAMC,gBAAgB,IAAIH,IAAIT,QAAQU,GAAG,IAAIC,MAAM;IACnD,IAAIH,eAAeI,eAAe;QAChC,OAAOd,cAAcC,OAAOC,SAASC;IACvC;IAEA,IAAI,CAACI,cAAc;QACjB,OAAON,MAAMc,KAAK;IACpB;IAEA,MAAMC,WAAWd,QAAQe,cAAc;IACvC,MAAMC,eAAe,IAAIC,QAAQjB,QAAQU,GAAG,IAAI;QAC9CQ,QAAQlB,QAAQkB,MAAM;QACtBf,SAASgB,OAAOC,WAAW,CACzBD,OAAOE,OAAO,CAACrB,QAAQG,OAAO,IAAImB,MAAM,CACtC,CAAC,CAACC,KAAK,GAAK,CAACA,KAAKC,WAAW,GAAGC,UAAU,CAAC;QAG/CC,MAAMZ,YAAY;IACpB;IAEA,MAAMa,gBAAgB,MAAMtB,aAAaW;IACzC,IAAI,CAACW,eAAe;QAClB,OAAO5B,MAAMc,KAAK;IACpB;IACA,IAAIc,kBAAkB,SAAS;QAC7B,OAAO5B,MAAMc,KAAK;IACpB;IACA,IAAIc,kBAAkB,YAAY;QAChC,OAAO7B,cAAcC,OAAOC,SAASC;IACvC;IACA,MAAM,EAAE2B,MAAM,EAAEzB,OAAO,EAAEuB,IAAI,EAAE,GAAGC;IAClC,OAAO5B,MAAM8B,OAAO,CAAC;QACnBD;QACAzB,SAASgB,OAAOC,WAAW,CAACjB;QAC5BuB,MAAMA,OAAOI,OAAOC,IAAI,CAAC,MAAMJ,cAAcK,WAAW,MAAMC;IAChE;AACF"}
|
||||
3
node_modules/next/dist/experimental/testmode/playwright/report.d.ts
generated
vendored
Normal file
3
node_modules/next/dist/experimental/testmode/playwright/report.d.ts
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
import type { TestInfo } from '@playwright/test';
|
||||
import type { FetchHandler } from './next-worker-fixture';
|
||||
export declare function reportFetch(testInfo: TestInfo, req: Request, handler: FetchHandler): Promise<Awaited<ReturnType<FetchHandler>>>;
|
||||
127
node_modules/next/dist/experimental/testmode/playwright/report.js
generated
vendored
Normal file
127
node_modules/next/dist/experimental/testmode/playwright/report.js
generated
vendored
Normal file
@ -0,0 +1,127 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "reportFetch", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return reportFetch;
|
||||
}
|
||||
});
|
||||
const _step = require("./step");
|
||||
async function parseBody(r) {
|
||||
const contentType = r.headers.get("content-type");
|
||||
let error;
|
||||
let text;
|
||||
let json;
|
||||
let formData;
|
||||
let buffer;
|
||||
if (contentType == null ? void 0 : contentType.includes("text")) {
|
||||
try {
|
||||
text = await r.text();
|
||||
} catch (e) {
|
||||
error = "failed to parse text";
|
||||
}
|
||||
} else if (contentType == null ? void 0 : contentType.includes("json")) {
|
||||
try {
|
||||
json = await r.json();
|
||||
} catch (e) {
|
||||
error = "failed to parse json";
|
||||
}
|
||||
} else if (contentType == null ? void 0 : contentType.includes("form-data")) {
|
||||
try {
|
||||
formData = await r.formData();
|
||||
} catch (e) {
|
||||
error = "failed to parse formData";
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
buffer = await r.arrayBuffer();
|
||||
} catch (e) {
|
||||
error = "failed to parse arrayBuffer";
|
||||
}
|
||||
}
|
||||
return {
|
||||
...error ? {
|
||||
error
|
||||
} : null,
|
||||
...text ? {
|
||||
text
|
||||
} : null,
|
||||
...json ? {
|
||||
json: JSON.stringify(json)
|
||||
} : null,
|
||||
...formData ? {
|
||||
formData: JSON.stringify(Array.from(formData))
|
||||
} : null,
|
||||
...buffer && buffer.byteLength > 0 ? {
|
||||
buffer: `base64;${Buffer.from(buffer).toString("base64")}`
|
||||
} : null
|
||||
};
|
||||
}
|
||||
function parseHeaders(headers) {
|
||||
return Object.fromEntries(Array.from(headers).sort(([key1], [key2])=>key1.localeCompare(key2)).map(([key, value])=>{
|
||||
return [
|
||||
`header.${key}`,
|
||||
value
|
||||
];
|
||||
}));
|
||||
}
|
||||
async function reportFetch(testInfo, req, handler) {
|
||||
return (0, _step.step)(testInfo, {
|
||||
title: `next.onFetch: ${req.method} ${req.url}`,
|
||||
category: "next.onFetch",
|
||||
apiName: "next.onFetch",
|
||||
params: {
|
||||
method: req.method,
|
||||
url: req.url,
|
||||
...await parseBody(req.clone()),
|
||||
...parseHeaders(req.headers)
|
||||
}
|
||||
}, async (complete)=>{
|
||||
const res = await handler(req);
|
||||
if (res === undefined || res == null) {
|
||||
complete({
|
||||
error: {
|
||||
message: "unhandled"
|
||||
}
|
||||
});
|
||||
} else if (typeof res === "string" && res !== "continue") {
|
||||
complete({
|
||||
error: {
|
||||
message: res
|
||||
}
|
||||
});
|
||||
} else {
|
||||
let body;
|
||||
if (typeof res === "string") {
|
||||
body = {
|
||||
response: res
|
||||
};
|
||||
} else {
|
||||
const { status, statusText } = res;
|
||||
body = {
|
||||
status,
|
||||
...statusText ? {
|
||||
statusText
|
||||
} : null,
|
||||
...await parseBody(res.clone()),
|
||||
...parseHeaders(res.headers)
|
||||
};
|
||||
}
|
||||
await (0, _step.step)(testInfo, {
|
||||
title: `next.onFetch.fulfilled: ${req.method} ${req.url}`,
|
||||
category: "next.onFetch",
|
||||
apiName: "next.onFetch.fulfilled",
|
||||
params: {
|
||||
...body,
|
||||
"request.url": req.url,
|
||||
"request.method": req.method
|
||||
}
|
||||
}, async ()=>undefined).catch(()=>undefined);
|
||||
}
|
||||
return res;
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=report.js.map
|
||||
1
node_modules/next/dist/experimental/testmode/playwright/report.js.map
generated
vendored
Normal file
1
node_modules/next/dist/experimental/testmode/playwright/report.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/experimental/testmode/playwright/report.ts"],"names":["reportFetch","parseBody","r","contentType","headers","get","error","text","json","formData","buffer","includes","e","arrayBuffer","JSON","stringify","Array","from","byteLength","Buffer","toString","parseHeaders","Object","fromEntries","sort","key1","key2","localeCompare","map","key","value","testInfo","req","handler","step","title","method","url","category","apiName","params","clone","complete","res","undefined","message","body","response","status","statusText","catch"],"mappings":";;;;+BA2DsBA;;;eAAAA;;;sBAzDD;AAErB,eAAeC,UACbC,CAA0E;IAE1E,MAAMC,cAAcD,EAAEE,OAAO,CAACC,GAAG,CAAC;IAClC,IAAIC;IACJ,IAAIC;IACJ,IAAIC;IACJ,IAAIC;IACJ,IAAIC;IACJ,IAAIP,+BAAAA,YAAaQ,QAAQ,CAAC,SAAS;QACjC,IAAI;YACFJ,OAAO,MAAML,EAAEK,IAAI;QACrB,EAAE,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step.d.ts
generated
vendored
Normal file
12
node_modules/next/dist/experimental/testmode/playwright/step.d.ts
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
import type { TestInfo } from '@playwright/test';
|
||||
export interface StepProps {
|
||||
category: string;
|
||||
title: string;
|
||||
apiName?: string;
|
||||
params?: Record<string, string | number | boolean | null | undefined>;
|
||||
}
|
||||
type Complete = (result: {
|
||||
error?: any;
|
||||
}) => void;
|
||||
export declare function step<T>(testInfo: TestInfo, props: StepProps, handler: (complete: Complete) => Promise<Awaited<T>>): Promise<Awaited<T>>;
|
||||
export {};
|
||||
40
node_modules/next/dist/experimental/testmode/playwright/step.js
generated
vendored
Normal file
40
node_modules/next/dist/experimental/testmode/playwright/step.js
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "step", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return step;
|
||||
}
|
||||
});
|
||||
const _test = require("@playwright/test");
|
||||
function isWithRunAsStep(testInfo) {
|
||||
return "_runAsStep" in testInfo;
|
||||
}
|
||||
async function step(testInfo, props, handler) {
|
||||
if (isWithRunAsStep(testInfo)) {
|
||||
return testInfo._runAsStep(props, ({ complete })=>handler(complete));
|
||||
}
|
||||
// Fallback to the `test.step()`.
|
||||
let result;
|
||||
let reportedError;
|
||||
try {
|
||||
console.log(props.title, props);
|
||||
await _test.test.step(props.title, async ()=>{
|
||||
result = await handler(({ error })=>{
|
||||
reportedError = error;
|
||||
if (reportedError) {
|
||||
throw reportedError;
|
||||
}
|
||||
});
|
||||
});
|
||||
} catch (error) {
|
||||
if (error !== reportedError) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=step.js.map
|
||||
1
node_modules/next/dist/experimental/testmode/playwright/step.js.map
generated
vendored
Normal file
1
node_modules/next/dist/experimental/testmode/playwright/step.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/experimental/testmode/playwright/step.ts"],"names":["step","isWithRunAsStep","testInfo","props","handler","_runAsStep","complete","result","reportedError","console","log","title","test","error"],"mappings":";;;;+BA4BsBA;;;eAAAA;;;sBA1BD;AAoBrB,SAASC,gBACPC,QAAkB;IAElB,OAAO,gBAAgBA;AACzB;AAEO,eAAeF,KACpBE,QAAkB,EAClBC,KAAgB,EAChBC,OAAoD;IAEpD,IAAIH,gBAAgBC,WAAW;QAC7B,OAAOA,SAASG,UAAU,CAACF,OAAO,CAAC,EAAEG,QAAQ,EAAE,GAAKF,QAAQE;IAC9D;IAEA,iCAAiC;IACjC,IAAIC;IACJ,IAAIC;IACJ,IAAI;QACFC,QAAQC,GAAG,CAACP,MAAMQ,KAAK,EAAER;QACzB,MAAMS,UAAI,CAACZ,IAAI,CAACG,MAAMQ,KAAK,EAAE;YAC3BJ,SAAS,MAAMH,QAAQ,CAAC,EAAES,KAAK,EAAE;gBAC/BL,gBAAgBK;gBAChB,IAAIL,eAAe;oBACjB,MAAMA;gBACR;YACF;QACF;IACF,EAAE,OAAOK,OAAO;QACd,IAAIA,UAAUL,eAAe;YAC3B,MAAMK;QACR;IACF;IACA,OAAON;AACT"}
|
||||
Reference in New Issue
Block a user