@telefonica/acceptance-testing 2.23.2 → 3.0.0-beta0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__tests__/utils.test.d.ts +1 -0
- package/dist/acceptance-testing.cjs.development.js +22 -22
- package/dist/acceptance-testing.cjs.development.js.map +1 -1
- package/dist/acceptance-testing.cjs.production.min.js.map +1 -1
- package/dist/acceptance-testing.esm.js +22 -22
- package/dist/acceptance-testing.esm.js.map +1 -1
- package/dist/coverage.d.ts +8 -8
- package/dist/index.d.ts +92 -91
- package/dist/utils.d.ts +4 -4
- package/docker-compose.yaml +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -380,13 +380,13 @@ var getRootPath = function getRootPath() {
|
|
|
380
380
|
}
|
|
381
381
|
return rootPath;
|
|
382
382
|
};
|
|
383
|
-
/**
|
|
384
|
-
* We want to clear coverage files from previous runs, but at this point it is not easy because each
|
|
385
|
-
* worker runs a different instance of this script, so we can't just clear the coverage folder at
|
|
386
|
-
* the beginning of the test run.
|
|
387
|
-
*
|
|
388
|
-
* The solution is to remove the coverage folder when the stored ppid (parent process id) is
|
|
389
|
-
* different from the current one
|
|
383
|
+
/**
|
|
384
|
+
* We want to clear coverage files from previous runs, but at this point it is not easy because each
|
|
385
|
+
* worker runs a different instance of this script, so we can't just clear the coverage folder at
|
|
386
|
+
* the beginning of the test run.
|
|
387
|
+
*
|
|
388
|
+
* The solution is to remove the coverage folder when the stored ppid (parent process id) is
|
|
389
|
+
* different from the current one
|
|
390
390
|
*/
|
|
391
391
|
var prepareCoverageReportPath = function prepareCoverageReportPath(_ref) {
|
|
392
392
|
var coveragePath = _ref.coveragePath;
|
|
@@ -406,9 +406,9 @@ var prepareCoverageReportPath = function prepareCoverageReportPath(_ref) {
|
|
|
406
406
|
fs.writeFileSync(ppidFile, ppid);
|
|
407
407
|
}
|
|
408
408
|
};
|
|
409
|
-
/**
|
|
410
|
-
* Asumes the code was instrumented with istanbul and the coverage report stored in `window.__coverage__`.
|
|
411
|
-
* If not, this function does nothing.
|
|
409
|
+
/**
|
|
410
|
+
* Asumes the code was instrumented with istanbul and the coverage report stored in `window.__coverage__`.
|
|
411
|
+
* If not, this function does nothing.
|
|
412
412
|
*/
|
|
413
413
|
var collectCoverageIfAvailable = /*#__PURE__*/function () {
|
|
414
414
|
var _ref3 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref2) {
|
|
@@ -453,8 +453,8 @@ var collectCoverageIfAvailable = /*#__PURE__*/function () {
|
|
|
453
453
|
};
|
|
454
454
|
}();
|
|
455
455
|
|
|
456
|
-
/**
|
|
457
|
-
* Returns true if the current path matches the spied path, including parameters
|
|
456
|
+
/**
|
|
457
|
+
* Returns true if the current path matches the spied path, including parameters
|
|
458
458
|
*/
|
|
459
459
|
var matchPath = function matchPath(spiedPath, currentPath) {
|
|
460
460
|
var normalizedCurrentPath = path.normalize(currentPath);
|
|
@@ -1181,14 +1181,14 @@ afterEach( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().ma
|
|
|
1181
1181
|
}
|
|
1182
1182
|
}, _callee14, null, [[2, 11]]);
|
|
1183
1183
|
})));
|
|
1184
|
-
/**
|
|
1185
|
-
* Returns a new path to the file that can be used by chromium in acceptance tests
|
|
1186
|
-
*
|
|
1187
|
-
* To be able to use `element.uploadFile()` in a dockerized chromium, the file must exist in the
|
|
1188
|
-
* host and the docker, and both sides must use the same path.
|
|
1189
|
-
*
|
|
1190
|
-
* To workaround this bug or limitation, this function prepares the file by copying it to /tmp in
|
|
1191
|
-
* the host and the container.
|
|
1184
|
+
/**
|
|
1185
|
+
* Returns a new path to the file that can be used by chromium in acceptance tests
|
|
1186
|
+
*
|
|
1187
|
+
* To be able to use `element.uploadFile()` in a dockerized chromium, the file must exist in the
|
|
1188
|
+
* host and the docker, and both sides must use the same path.
|
|
1189
|
+
*
|
|
1190
|
+
* To workaround this bug or limitation, this function prepares the file by copying it to /tmp in
|
|
1191
|
+
* the host and the container.
|
|
1192
1192
|
*/
|
|
1193
1193
|
var prepareFile = function prepareFile(filepath) {
|
|
1194
1194
|
var isLocal = !isCi;
|
|
@@ -1208,8 +1208,8 @@ var prepareFile = function prepareFile(filepath) {
|
|
|
1208
1208
|
return filepath;
|
|
1209
1209
|
}
|
|
1210
1210
|
};
|
|
1211
|
-
/**
|
|
1212
|
-
* A convenience method to defer an expectation
|
|
1211
|
+
/**
|
|
1212
|
+
* A convenience method to defer an expectation
|
|
1213
1213
|
*/
|
|
1214
1214
|
var wait = function wait(expectation, timeout, interval) {
|
|
1215
1215
|
if (timeout === void 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acceptance-testing.cjs.development.js","sources":["../src/coverage.ts","../src/utils.ts","../src/index.ts"],"sourcesContent":["import path from 'path';\nimport fs from 'fs';\n\nimport type {Page} from 'puppeteer';\n\nconst getGlobalPage = (): Page => (global as any).page;\n\nexport const getRootPath = () => {\n const rootPath = expect.getState().snapshotState._rootDir;\n if (!rootPath) {\n throw new Error('Root path not found');\n }\n return rootPath;\n};\n\n/**\n * We want to clear coverage files from previous runs, but at this point it is not easy because each\n * worker runs a different instance of this script, so we can't just clear the coverage folder at\n * the beginning of the test run.\n *\n * The solution is to remove the coverage folder when the stored ppid (parent process id) is\n * different from the current one\n */\nconst prepareCoverageReportPath = ({coveragePath}: {coveragePath: string}) => {\n const ppidFile = path.join(coveragePath, '.ppid');\n const ppid = process.ppid.toString();\n if (!fs.existsSync(ppidFile) || fs.readFileSync(ppidFile, 'utf-8') !== ppid) {\n // the condition is just to make sure we don't remove files outside the repo\n if (getRootPath() === process.cwd() && path.normalize(coveragePath).startsWith(process.cwd())) {\n fs.rmSync(coveragePath, {recursive: true, force: true});\n }\n fs.mkdirSync(coveragePath, {recursive: true});\n fs.writeFileSync(ppidFile, ppid);\n }\n};\n\n/**\n * Asumes the code was instrumented with istanbul and the coverage report stored in `window.__coverage__`.\n * If not, this function does nothing.\n */\nexport const collectCoverageIfAvailable = async ({coveragePath}: {coveragePath: string}): Promise<void> => {\n const coverage = await getGlobalPage().evaluate(() => {\n return (window as any).__coverage__;\n });\n if (!coverage) {\n return;\n }\n\n prepareCoverageReportPath({coveragePath});\n const nycOutputPath = path.join(coveragePath, '.nyc_output');\n fs.mkdirSync(nycOutputPath, {recursive: true});\n\n Object.values(coverage).forEach((cov: any) => {\n if (cov && cov.path && cov.hash) {\n fs.writeFileSync(path.join(nycOutputPath, cov.hash + '.json'), JSON.stringify({[cov.path]: cov}));\n }\n });\n};\n","import path from 'path';\nimport globToRegExp from 'glob-to-regexp';\n\n/**\n * Returns true if the current path matches the spied path, including parameters\n */\nexport const matchPath = (spiedPath: string, currentPath: string): boolean => {\n const normalizedCurrentPath = path.normalize(currentPath);\n const pattern = globToRegExp(spiedPath);\n return pattern.test(normalizedCurrentPath);\n};\n","import path from 'path';\nimport fs from 'fs';\nimport findRoot from 'find-root';\nimport {getDocument, queries} from 'pptr-testing-library';\nimport {configureToMatchImageSnapshot} from 'jest-image-snapshot';\nimport globToRegExp from 'glob-to-regexp';\nimport {execSync} from 'child_process';\nimport {collectCoverageIfAvailable} from './coverage';\nimport {matchPath} from './utils';\n\nimport type {getQueriesForElement} from 'pptr-testing-library';\nimport type {\n Browser,\n ClickOptions,\n ElementHandle,\n GeolocationOptions,\n HTTPRequest,\n Page,\n ResponseForRequest,\n ScreenshotOptions,\n Viewport,\n} from 'puppeteer';\n\ntype CustomScreenshotOptions = ScreenshotOptions & {\n skipNetworkWait?: boolean;\n};\n\nconst LINUX_DOCKER_HOST_IP = '172.17.0.1';\n\nexport const getGlobalBrowser = (): Browser => (global as any).browser;\nexport const getGlobalPage = (): Page => (global as any).page;\n\nconst isCi = process.argv.includes('--ci') || process.env.CI;\nconst isUsingDockerizedChromium = isCi || new URL(getGlobalBrowser().wsEndpoint()).port === '9223';\n\n/** Check if running inside WSL */\nconst isWsl = () => {\n if (process.platform !== 'linux') {\n return false;\n }\n try {\n return execSync('which wsl.exe').toString().startsWith('/mnt/');\n } catch (e) {\n // catched because it throws an error if wsl.exe is not found\n return false;\n }\n};\n\n/** Assumes running inside WSL */\nconst isWsl2 = () => {\n // `wsl.exe -l -v` returns something like:\n //\n // NAME STATE VERSION\n // * Ubuntu-22.04 Running 2\n // docker-desktop-data Running 2\n // docker-desktop Running 2\n // Ubuntu-20.04 Stopped 2\n return (\n execSync('wsl.exe -l -v')\n .toString()\n // null-bytes are inserted between chars in this command output (UTF-16 output?)\n .replace(/\\0/g, '')\n .split('\\n')\n .map((line) => line.trim())\n // matches a line like: \"* Ubuntu-22.04 Running 2\"\n .some((line) => !!line.match(/\\*\\s+\\S+\\s+Running\\s+2/))\n );\n};\n\n/** Assumes running inside WSL */\nconst getWslHostIp = () => {\n const ips = execSync('wsl.exe hostname -I').toString().trim().split(/\\s+/);\n\n if (ips.includes(LINUX_DOCKER_HOST_IP)) {\n // looks like a docker engine installed inside linux\n return LINUX_DOCKER_HOST_IP;\n }\n // assuming docker-desktop installed in windows\n return ips[0];\n};\n\nexport const serverHostName = ((): string => {\n if (isCi) {\n return 'localhost';\n }\n\n if (isUsingDockerizedChromium) {\n if (isWsl()) {\n if (isWsl2()) {\n return getWslHostIp();\n }\n throw new Error('WSL 1 is not supported. Please, use WSL 2.');\n }\n\n if (process.platform === 'win32') {\n throw new Error('Windows is not supported. Please, use WSL 2.');\n }\n\n return process.platform === 'linux' ? LINUX_DOCKER_HOST_IP : 'host.docker.internal';\n }\n\n return 'localhost';\n})();\n\nconst rootDir = findRoot(process.cwd());\nconst pkg = JSON.parse(fs.readFileSync(path.join(rootDir, 'package.json'), 'utf-8'));\nconst projectConfig = pkg.acceptanceTests ?? {};\nconst server = (isCi ? projectConfig.ciServer : projectConfig.devServer) ?? projectConfig.server;\nconst coveragePath = path.join(rootDir, projectConfig.coveragePath ?? 'reports/coverage-acceptance');\n\nexport const serverPort = server?.port;\n\nconst toMatchImageSnapshot = configureToMatchImageSnapshot({\n failureThreshold: 0,\n failureThresholdType: 'percent',\n customSnapshotIdentifier: ({defaultIdentifier}) => defaultIdentifier,\n});\n\nlet calledToMatchImageSnapshotOutsideDocker = false;\n\nconst localToMatchImageSnapshot = () => {\n calledToMatchImageSnapshotOutsideDocker = true;\n // let the expectation pass, then fail in afterEach. This way we allow developers to debug screenshot tests in local\n // but don't allow them to save screenshots taken outside the dockerized chromium\n return {\n message: () => '',\n pass: true,\n };\n};\n\nexpect.extend({\n toMatchImageSnapshot: isUsingDockerizedChromium ? toMatchImageSnapshot : localToMatchImageSnapshot,\n});\n\nafterEach(() => {\n if (calledToMatchImageSnapshotOutsideDocker) {\n const error = new Error(\n `Calling .toMatchImageSnapshot() is not allowed outside dockerized browser. Please, run your screenshot test in headless mode.`\n );\n error.stack = (error.stack || '').split('\\n')[0];\n throw error;\n }\n});\n\ntype WaitForPaintEndOptions = {\n fullPage?: boolean;\n captureBeyondViewport?: boolean;\n};\n\nconst waitForPaintEnd = async (\n element: ElementHandle | Page,\n {fullPage = true, captureBeyondViewport}: WaitForPaintEndOptions = {}\n) => {\n const MAX_WAIT = 15000;\n const STEP_TIME = 250;\n const t0 = Date.now();\n\n let buf1 = (await element.screenshot(\n normalizeSreenshotOptions({fullPage, captureBeyondViewport})\n )) as Buffer;\n await new Promise((r) => setTimeout(r, STEP_TIME));\n let buf2 = (await element.screenshot(\n normalizeSreenshotOptions({fullPage, captureBeyondViewport})\n )) as Buffer;\n\n // buffers are different if compare != 0\n while (buf1.compare(buf2)) {\n if (Date.now() - t0 > MAX_WAIT) {\n throw Error('Paint end timeout');\n }\n buf1 = buf2;\n await new Promise((r) => setTimeout(r, STEP_TIME));\n buf2 = (await element.screenshot(\n normalizeSreenshotOptions({fullPage, captureBeyondViewport})\n )) as Buffer;\n }\n};\n\nexport interface PageApi extends Omit<Page, 'click' | 'type' | 'select'> {\n clear: (selector: ElementHandle) => Promise<void>;\n // These are overridden:\n type: (selector: ElementHandle, text: string, options?: {delay: number}) => Promise<void>;\n click: (selector: ElementHandle, options?: ClickOptions) => Promise<void>;\n select: (selector: ElementHandle, ...values: string[]) => Promise<string[]>;\n screenshot: (options?: CustomScreenshotOptions) => Promise<Buffer | string | void>;\n}\n\nconst normalizeSreenshotOptions = ({captureBeyondViewport = false, ...options}: ScreenshotOptions = {}) => {\n // Puppeter default for captureBeyondViewport is true, but we think false is a better default.\n // When this is true, the fixed elements (like fixed footers) are relative to the original page\n // viewport, not to the full page, so those elements look weird in fullPage screenshots.\n return {...options, captureBeyondViewport};\n};\n\n// Puppeteer already calls scrollIntoViewIfNeeded before clicking an element. But it doesn't work in all situations\n// For example, when there is a fixed footer in the page and the element to click is under it, the browser won't scroll\n// because the element is already in the viewport (the ifNeeded part is important here). By forcing the scroll to the\n// center, we manage to fix these edge cases.\nconst scrollIntoView = (el: ElementHandle) => el.evaluate((e) => e.scrollIntoView({block: 'center'}));\n\nexport const getPageApi = (page: Page): PageApi => {\n const api: PageApi = Object.create(page);\n\n api.type = async (elementHandle, text, options) => {\n await scrollIntoView(elementHandle);\n return elementHandle.type(text, options);\n };\n api.click = async (elementHandle, options) => {\n await scrollIntoView(elementHandle);\n return elementHandle.click(options);\n };\n api.select = async (elementHandle, ...values) => {\n await scrollIntoView(elementHandle);\n return elementHandle.select(...values);\n };\n\n api.screenshot = async (options?: CustomScreenshotOptions) => {\n if (!options?.skipNetworkWait) {\n await page.waitForNetworkIdle();\n }\n await waitForPaintEnd(page, options);\n return page.screenshot(normalizeSreenshotOptions(options));\n };\n\n api.clear = async (elementHandle) => {\n await elementHandle.click({clickCount: 3});\n await elementHandle.press('Delete');\n };\n\n // For some reason, puppeteer browserContext.overridePermissions doesn't work with newer chrome versions.\n // This workaround polyfills the browser geolocation api to return the mocked position\n api.setGeolocation = (position: GeolocationOptions) =>\n page.evaluate((position) => {\n window.navigator.geolocation.getCurrentPosition = (callback) => {\n // @ts-expect-error - puppeteer's setGeoLocation does not expect a timestamp to be passed\n callback({\n coords: position,\n });\n };\n }, position as any);\n\n return api;\n};\n\nlet needsRequestInterception = false;\ntype RequestMatcherFn = (req: HTTPRequest) => boolean;\nlet requestHandlers: Array<{\n matcher: RequestMatcherFn;\n handler: jest.Mock<any, any>;\n}> = [];\n\nconst requestInterceptor = (req: HTTPRequest) => {\n const {handler} = requestHandlers.find(({matcher}) => matcher(req)) ?? {handler: null};\n if (!handler) {\n req.continue();\n return;\n }\n const response = handler(req);\n req.respond(response);\n};\n\nexport const interceptRequest = (\n matcher: RequestMatcherFn\n): jest.Mock<Partial<ResponseForRequest>, [HTTPRequest]> => {\n needsRequestInterception = true;\n const spy = jest.fn();\n requestHandlers.push({matcher, handler: spy});\n return spy;\n};\n\ntype ApiEndpointMock = {\n spyOn(path: string, method?: string): jest.Mock<unknown, [HTTPRequest]>;\n};\n\nexport const createApiEndpointMock = ({\n /** defaults to any origin */\n origin,\n baseUrl,\n}: {\n origin?: string;\n /** @deprecated use origin */\n baseUrl?: string;\n} = {}): ApiEndpointMock => {\n const originRegExp = globToRegExp(origin ?? baseUrl ?? '*');\n\n interceptRequest((req) => {\n const {origin} = new URL(req.url());\n return req.method() === 'OPTIONS' && !!origin.match(originRegExp);\n }).mockImplementation(() => ({\n status: 204,\n headers: {\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'POST,PATCH,PUT,GET,OPTIONS,DELETE',\n 'Access-Control-Allow-Headers': '*',\n },\n }));\n\n return {\n spyOn(spiedPath: string, method: string = 'GET') {\n const matcher = (req: HTTPRequest) => {\n const {origin, pathname, search} = new URL(req.url());\n const pathWithParams = pathname + search;\n\n return (\n req.method() === method &&\n !!origin.match(originRegExp) &&\n matchPath(spiedPath, pathWithParams)\n );\n };\n\n const spy = jest.fn();\n\n interceptRequest(matcher).mockImplementation((req) => {\n const spyResult = spy(req);\n const status = spyResult.status ?? 200;\n const resBody = spyResult.body || spyResult;\n return {\n status,\n headers: {\n 'Access-Control-Allow-Origin': '*',\n },\n contentType: 'application/json',\n body: JSON.stringify(resBody),\n };\n });\n\n return spy;\n },\n };\n};\n\ntype CookieConfig = {\n name: string;\n value: string;\n url?: string;\n domain?: string;\n path?: string;\n secure?: boolean;\n httpOnly?: boolean;\n sameSite?: 'Strict' | 'Lax' | 'None';\n expires?: number;\n priority?: 'Low' | 'Medium' | 'High';\n sameParty?: boolean;\n sourceScheme?: 'Unset' | 'NonSecure' | 'Secure';\n sourcePort?: number;\n};\n\nexport interface TestViewport extends Viewport {\n safeAreaInset?: {\n top?: number | string;\n right?: number | string;\n bottom?: number | string;\n left?: number | string;\n };\n}\n\ninterface OpenPageCommonConfig {\n userAgent?: string;\n viewport?: TestViewport;\n isDarkMode?: boolean;\n cookies?: Array<CookieConfig>;\n}\n\ninterface OpenPageUrlConfig extends OpenPageCommonConfig {\n url: string;\n}\n\ninterface OpenPagePathConfig extends OpenPageCommonConfig {\n url?: undefined;\n\n path?: string;\n port?: number;\n protocol?: string;\n hostname?: string;\n}\n\ntype OpenPageConfig = OpenPageUrlConfig | OpenPagePathConfig;\n\nexport const openPage = async ({\n userAgent,\n isDarkMode,\n viewport,\n cookies,\n ...urlConfig\n}: OpenPageConfig): Promise<PageApi> => {\n const url = ((): string => {\n if (urlConfig.url !== undefined) {\n return urlConfig.url;\n }\n\n const {path = '/', port = serverPort, protocol = 'http', hostname = serverHostName} = urlConfig;\n\n if (!port) {\n // Error.captureStackTrace(error, openPage);\n throw new Error(\n 'You must specify a port. You can specify it when calling openPage() or by configuring a dev and ci server in the acceptanceTests config in your package.json'\n );\n }\n\n return `${protocol}://${hostname}:${port}${path}`;\n })();\n\n const currentUserAgent = userAgent || (await getGlobalBrowser().userAgent());\n const page = getGlobalPage();\n\n await page.bringToFront();\n if (viewport) {\n await page.setViewport(viewport);\n }\n if (cookies) {\n await page.setCookie(...cookies);\n }\n await page.setUserAgent(`${currentUserAgent} acceptance-test`);\n await page.emulateMediaFeatures([{name: 'prefers-color-scheme', value: isDarkMode ? 'dark' : 'light'}]);\n\n // A set of styles to make screenshot tests more reliable.\n await page.evaluateOnNewDocument((viewport: TestViewport) => {\n const overriddenSafeAreaInsets = !viewport\n ? []\n : Object.keys(viewport?.safeAreaInset ?? {}).map((key) => {\n const position = key as 'top' | 'right' | 'bottom' | 'left';\n return `--acceptance-test-override-safe-area-inset-${key}: ${viewport?.safeAreaInset?.[position]};`;\n });\n\n const style = document.createElement('style');\n style.innerHTML = `\n *, *:after, *:before {\n transition-delay: 0s !important;\n transition-duration: 0s !important;\n animation-delay: -0.0001s !important;\n animation-duration: 0s !important;\n animation-play-state: paused !important;\n caret-color: transparent !important;\n font-variant-ligatures: none !important;\n }\n *::-webkit-scrollbar {\n display: none !important;\n width: 0 !important;\n height: 0 !important;\n }\n :root {\n ${overriddenSafeAreaInsets.join('\\n')}\n }\n `;\n window.addEventListener('DOMContentLoaded', () => {\n document.head.appendChild(style);\n });\n }, viewport);\n\n if (needsRequestInterception) {\n await page.setRequestInterception(true);\n page.on('request', requestInterceptor);\n }\n\n try {\n await page.goto(url);\n } catch (e) {\n if ((e as Error).message.includes('net::ERR_CONNECTION_REFUSED')) {\n const connectionError = new Error(`Could not connect to ${url}. Is the server running?`);\n Error.captureStackTrace(connectionError, openPage);\n throw connectionError;\n } else {\n throw e;\n }\n }\n await page.waitForFunction('document.fonts.status === \"loaded\"');\n\n return getPageApi(page);\n};\n\nconst buildQueryMethods = ({page, element}: {page?: Page; element?: ElementHandle} = {}): ReturnType<\n typeof getQueriesForElement\n> => {\n const boundQueries: any = {};\n for (const [queryName, queryFn] of Object.entries(queries)) {\n boundQueries[queryName] = async (...args: any) => {\n const doc = await getDocument(page ?? getGlobalPage());\n const body = await doc.$('body');\n const queryArgs = [...args];\n if (queryName.startsWith('findBy')) {\n if (queryArgs.length === 1) {\n queryArgs.push(undefined);\n }\n queryArgs.push({timeout: 10000});\n }\n const elementHandle: ElementHandle = await queryFn(element ?? body, ...queryArgs);\n\n const newElementHandle = Object.create(elementHandle);\n\n newElementHandle.screenshot = async (options: CustomScreenshotOptions) => {\n if (!options?.skipNetworkWait) {\n await (page ?? getGlobalPage()).waitForNetworkIdle();\n }\n await waitForPaintEnd(elementHandle, {...options, fullPage: false});\n return elementHandle.screenshot(normalizeSreenshotOptions(options));\n };\n\n newElementHandle.click = async (options?: ClickOptions) => {\n await scrollIntoView(elementHandle);\n return elementHandle.click(options);\n };\n\n newElementHandle.type = async (text: string, options?: {delay: number}) => {\n await scrollIntoView(elementHandle);\n return elementHandle.type(text, options);\n };\n\n newElementHandle.select = async (...values: Array<string>) => {\n await scrollIntoView(elementHandle);\n return elementHandle.select(...values);\n };\n\n return newElementHandle;\n };\n }\n return boundQueries;\n};\n\nexport const getScreen = (page: Page) => buildQueryMethods({page});\n\nexport const screen = buildQueryMethods();\n\nexport const within = (element: ElementHandle) => buildQueryMethods({element});\n\nexport type {ElementHandle, Viewport} from 'puppeteer';\n\nbeforeEach(async () => {\n await getGlobalPage().setRequestInterception(false);\n\n // by resetting the page we clean up all the evaluateOnNewDocument calls, which are persistent between documents\n await (global as any).jestPuppeteer.resetPage();\n});\n\nafterEach(async () => {\n await collectCoverageIfAvailable({coveragePath});\n\n try {\n const page = getGlobalPage();\n requestHandlers = [];\n needsRequestInterception = false;\n page.off('request', requestInterceptor);\n\n // clear tab, this way we clear the DOM and stop js execution or pending requests\n await page.goto('about:blank');\n } catch (e) {\n // ignore, at this point page might be destroyed\n }\n});\n\n/**\n * Returns a new path to the file that can be used by chromium in acceptance tests\n *\n * To be able to use `element.uploadFile()` in a dockerized chromium, the file must exist in the\n * host and the docker, and both sides must use the same path.\n *\n * To workaround this bug or limitation, this function prepares the file by copying it to /tmp in\n * the host and the container.\n */\nexport const prepareFile = (filepath: string): string => {\n const isLocal = !isCi;\n const isHeadless = !!process.env.HEADLESS;\n const usesDocker = isLocal && isHeadless;\n\n const dockerComposeFile = path.join(__dirname, '..', 'docker-compose.yaml');\n\n if (usesDocker) {\n const containerId = execSync(`docker-compose -f ${dockerComposeFile} ps -q`).toString().trim();\n\n if (!containerId) {\n throw Error('acceptance-testing container not found');\n }\n\n execSync(`docker cp ${filepath} ${containerId}:/tmp`);\n\n const newPath = path.join('/tmp', path.basename(filepath));\n\n fs.copyFileSync(filepath, newPath);\n\n return newPath;\n } else {\n return filepath;\n }\n};\n\n/**\n * A convenience method to defer an expectation\n */\nexport const wait = <T>(expectation: () => Promise<T> | T, timeout = 10000, interval = 50): Promise<T> => {\n const startTime = Date.now();\n const startStack = new Error().stack;\n\n return new Promise((resolve, reject) => {\n const rejectOrRerun = (error: unknown) => {\n if (Date.now() - startTime >= timeout) {\n if (error instanceof Error) {\n if (error.message === 'Element not removed') {\n error.stack = startStack;\n }\n }\n reject(error);\n return;\n }\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n setTimeout(runExpectation, interval);\n };\n const runExpectation = () => {\n try {\n Promise.resolve(expectation())\n .then((r) => resolve(r))\n .catch(rejectOrRerun);\n } catch (error) {\n rejectOrRerun(error);\n }\n };\n setTimeout(runExpectation, 0);\n });\n};\n\nexport const waitForElementToBeRemoved = (\n element: ElementHandle<Element>,\n timeout = 10000,\n interval = 100\n): Promise<void> => {\n const startStack = new Error().stack;\n\n const wait = async () => {\n const t0 = Date.now();\n while (Date.now() - t0 < timeout) {\n // boundingBox returns null when the element is not in the DOM\n const box = await element.boundingBox();\n if (!box) {\n return;\n }\n await new Promise((resolve) => setTimeout(resolve, interval));\n }\n throw new Error('Element not removed');\n };\n\n return wait().catch((error) => {\n if (error.message === 'Element not removed') {\n error.stack = startStack;\n }\n throw error;\n });\n};\n"],"names":["getGlobalPage","global","page","getRootPath","rootPath","expect","getState","snapshotState","_rootDir","Error","prepareCoverageReportPath","_ref","coveragePath","ppidFile","path","join","ppid","process","toString","fs","existsSync","readFileSync","cwd","normalize","startsWith","rmSync","recursive","force","mkdirSync","writeFileSync","collectCoverageIfAvailable","_ref3","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_ref2","coverage","nycOutputPath","wrap","_callee$","_context","prev","next","evaluate","window","__coverage__","sent","abrupt","Object","values","forEach","cov","hash","_JSON$stringify","JSON","stringify","stop","_x","apply","arguments","matchPath","spiedPath","currentPath","normalizedCurrentPath","pattern","globToRegExp","test","LINUX_DOCKER_HOST_IP","getGlobalBrowser","browser","isCi","argv","includes","env","CI","isUsingDockerizedChromium","URL","wsEndpoint","port","isWsl","platform","execSync","e","isWsl2","replace","split","map","line","trim","some","match","getWslHostIp","ips","serverHostName","rootDir","findRoot","pkg","parse","projectConfig","_pkg$acceptanceTests","acceptanceTests","server","ciServer","devServer","_projectConfig$covera","serverPort","toMatchImageSnapshot","configureToMatchImageSnapshot","failureThreshold","failureThresholdType","customSnapshotIdentifier","defaultIdentifier","calledToMatchImageSnapshotOutsideDocker","localToMatchImageSnapshot","message","pass","extend","afterEach","error","stack","waitForPaintEnd","element","_temp","_ref4","_ref4$fullPage","fullPage","captureBeyondViewport","MAX_WAIT","STEP_TIME","t0","buf1","buf2","Date","now","screenshot","normalizeSreenshotOptions","Promise","r","setTimeout","compare","_x2","_temp2","_ref5$captureBeyondVi","_ref5","options","_objectWithoutPropertiesLoose","_excluded","_extends","scrollIntoView","el","block","getPageApi","api","create","type","_ref6","_callee2","elementHandle","text","_callee2$","_context2","_x3","_x4","_x5","click","_ref7","_callee3","_callee3$","_context3","_x6","_x7","select","_ref8","_callee4","_len","_key","_args4","_callee4$","_context4","length","Array","_x8","_ref9","_callee5","_callee5$","_context5","skipNetworkWait","waitForNetworkIdle","_x9","clear","_ref10","_callee6","_callee6$","_context6","clickCount","press","_x10","setGeolocation","position","navigator","geolocation","getCurrentPosition","callback","coords","needsRequestInterception","requestHandlers","requestInterceptor","req","_ref11","_requestHandlers$find","find","_ref12","matcher","handler","response","respond","interceptRequest","spy","jest","fn","push","createApiEndpointMock","_temp3","origin","_ref13","baseUrl","originRegExp","_ref14","_URL","url","method","mockImplementation","status","headers","spyOn","_URL2","pathname","search","pathWithParams","spyResult","_spyResult$status","resBody","body","contentType","openPage","_ref16","_callee7","_ref15","userAgent","isDarkMode","viewport","cookies","urlConfig","currentUserAgent","connectionError","_callee7$","_context7","_excluded2","undefined","_urlConfig$path","_urlConfig$port","_urlConfig$protocol","protocol","_urlConfig$hostname","hostname","bringToFront","setViewport","setCookie","setUserAgent","emulateMediaFeatures","name","value","evaluateOnNewDocument","overriddenSafeAreaInsets","keys","_viewport$safeAreaIns","safeAreaInset","key","_viewport$safeAreaIns2","style","document","createElement","innerHTML","addEventListener","head","appendChild","setRequestInterception","on","t1","captureStackTrace","waitForFunction","_x11","buildQueryMethods","_temp4","_ref17","boundQueries","_loop","_Object$entries$_i","_Object$entries","_i","queryName","queryFn","_callee12","doc","_len2","args","_key2","queryArgs","newElementHandle","_args12","_callee12$","_context12","getDocument","$","concat","timeout","_ref19","_callee8","_callee8$","_context8","_x12","_ref20","_callee9","_callee9$","_context9","_x13","_ref21","_callee10","_callee10$","_context10","_x14","_x15","_callee11","_args11","_callee11$","_context11","entries","queries","getScreen","screen","within","beforeEach","_callee13","_callee13$","_context13","jestPuppeteer","resetPage","_callee14","_callee14$","_context14","off","prepareFile","filepath","isLocal","isHeadless","HEADLESS","usesDocker","dockerComposeFile","__dirname","containerId","newPath","basename","copyFileSync","wait","expectation","interval","startTime","startStack","resolve","reject","rejectOrRerun","runExpectation","then","waitForElementToBeRemoved","_ref25","_callee15","box","_callee15$","_context15","boundingBox"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AkX,UAAA,CAAAlU,IAAA;;SAAA+T,SAAA;KACzC;IAAA,gBAXKZ,IAAIA;MAAA,OAAAW,MAAA,CAAA5T,KAAA,OAAAC,SAAA;;KAWT;EAED,OAAOgT,IAAI,EAAE,SAAM,CAAC,UAACrP,KAAK;IACtB,IAAIA,KAAK,CAACJ,OAAO,KAAK,qBAAqB,EAAE;MACzCI,KAAK,CAACC,KAAK,GAAGwP,UAAU;;IAE5B,MAAMzP,KAAK;GACd,CAAC;AACN,CAAC;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"acceptance-testing.cjs.development.js","sources":["../src/coverage.ts","../src/utils.ts","../src/index.ts"],"sourcesContent":["import path from 'path';\nimport fs from 'fs';\n\nimport type {Page} from 'puppeteer';\n\nconst getGlobalPage = (): Page => (global as any).page;\n\nexport const getRootPath = () => {\n const rootPath = expect.getState().snapshotState._rootDir;\n if (!rootPath) {\n throw new Error('Root path not found');\n }\n return rootPath;\n};\n\n/**\n * We want to clear coverage files from previous runs, but at this point it is not easy because each\n * worker runs a different instance of this script, so we can't just clear the coverage folder at\n * the beginning of the test run.\n *\n * The solution is to remove the coverage folder when the stored ppid (parent process id) is\n * different from the current one\n */\nconst prepareCoverageReportPath = ({coveragePath}: {coveragePath: string}) => {\n const ppidFile = path.join(coveragePath, '.ppid');\n const ppid = process.ppid.toString();\n if (!fs.existsSync(ppidFile) || fs.readFileSync(ppidFile, 'utf-8') !== ppid) {\n // the condition is just to make sure we don't remove files outside the repo\n if (getRootPath() === process.cwd() && path.normalize(coveragePath).startsWith(process.cwd())) {\n fs.rmSync(coveragePath, {recursive: true, force: true});\n }\n fs.mkdirSync(coveragePath, {recursive: true});\n fs.writeFileSync(ppidFile, ppid);\n }\n};\n\n/**\n * Asumes the code was instrumented with istanbul and the coverage report stored in `window.__coverage__`.\n * If not, this function does nothing.\n */\nexport const collectCoverageIfAvailable = async ({coveragePath}: {coveragePath: string}): Promise<void> => {\n const coverage = await getGlobalPage().evaluate(() => {\n return (window as any).__coverage__;\n });\n if (!coverage) {\n return;\n }\n\n prepareCoverageReportPath({coveragePath});\n const nycOutputPath = path.join(coveragePath, '.nyc_output');\n fs.mkdirSync(nycOutputPath, {recursive: true});\n\n Object.values(coverage).forEach((cov: any) => {\n if (cov && cov.path && cov.hash) {\n fs.writeFileSync(path.join(nycOutputPath, cov.hash + '.json'), JSON.stringify({[cov.path]: cov}));\n }\n });\n};\n","import path from 'path';\nimport globToRegExp from 'glob-to-regexp';\n\n/**\n * Returns true if the current path matches the spied path, including parameters\n */\nexport const matchPath = (spiedPath: string, currentPath: string): boolean => {\n const normalizedCurrentPath = path.normalize(currentPath);\n const pattern = globToRegExp(spiedPath);\n return pattern.test(normalizedCurrentPath);\n};\n","import path from 'path';\nimport fs from 'fs';\nimport findRoot from 'find-root';\nimport {getDocument, queries} from 'pptr-testing-library';\nimport {configureToMatchImageSnapshot} from 'jest-image-snapshot';\nimport globToRegExp from 'glob-to-regexp';\nimport {execSync} from 'child_process';\nimport {collectCoverageIfAvailable} from './coverage';\nimport {matchPath} from './utils';\n\nimport type {getQueriesForElement} from 'pptr-testing-library';\nimport type {\n Browser,\n ClickOptions,\n ElementHandle,\n GeolocationOptions,\n HTTPRequest,\n Page,\n ResponseForRequest,\n ScreenshotOptions,\n Viewport,\n} from 'puppeteer';\n\ntype CustomScreenshotOptions = ScreenshotOptions & {\n skipNetworkWait?: boolean;\n};\n\nconst LINUX_DOCKER_HOST_IP = '172.17.0.1';\n\nexport const getGlobalBrowser = (): Browser => (global as any).browser;\nexport const getGlobalPage = (): Page => (global as any).page;\n\nconst isCi = process.argv.includes('--ci') || process.env.CI;\nconst isUsingDockerizedChromium = isCi || new URL(getGlobalBrowser().wsEndpoint()).port === '9223';\n\n/** Check if running inside WSL */\nconst isWsl = () => {\n if (process.platform !== 'linux') {\n return false;\n }\n try {\n return execSync('which wsl.exe').toString().startsWith('/mnt/');\n } catch (e) {\n // catched because it throws an error if wsl.exe is not found\n return false;\n }\n};\n\n/** Assumes running inside WSL */\nconst isWsl2 = () => {\n // `wsl.exe -l -v` returns something like:\n //\n // NAME STATE VERSION\n // * Ubuntu-22.04 Running 2\n // docker-desktop-data Running 2\n // docker-desktop Running 2\n // Ubuntu-20.04 Stopped 2\n return (\n execSync('wsl.exe -l -v')\n .toString()\n // null-bytes are inserted between chars in this command output (UTF-16 output?)\n .replace(/\\0/g, '')\n .split('\\n')\n .map((line) => line.trim())\n // matches a line like: \"* Ubuntu-22.04 Running 2\"\n .some((line) => !!line.match(/\\*\\s+\\S+\\s+Running\\s+2/))\n );\n};\n\n/** Assumes running inside WSL */\nconst getWslHostIp = () => {\n const ips = execSync('wsl.exe hostname -I').toString().trim().split(/\\s+/);\n\n if (ips.includes(LINUX_DOCKER_HOST_IP)) {\n // looks like a docker engine installed inside linux\n return LINUX_DOCKER_HOST_IP;\n }\n // assuming docker-desktop installed in windows\n return ips[0];\n};\n\nexport const serverHostName = ((): string => {\n if (isCi) {\n return 'localhost';\n }\n\n if (isUsingDockerizedChromium) {\n if (isWsl()) {\n if (isWsl2()) {\n return getWslHostIp();\n }\n throw new Error('WSL 1 is not supported. Please, use WSL 2.');\n }\n\n if (process.platform === 'win32') {\n throw new Error('Windows is not supported. Please, use WSL 2.');\n }\n\n return process.platform === 'linux' ? LINUX_DOCKER_HOST_IP : 'host.docker.internal';\n }\n\n return 'localhost';\n})();\n\nconst rootDir = findRoot(process.cwd());\nconst pkg = JSON.parse(fs.readFileSync(path.join(rootDir, 'package.json'), 'utf-8'));\nconst projectConfig = pkg.acceptanceTests ?? {};\nconst server = (isCi ? projectConfig.ciServer : projectConfig.devServer) ?? projectConfig.server;\nconst coveragePath = path.join(rootDir, projectConfig.coveragePath ?? 'reports/coverage-acceptance');\n\nexport const serverPort = server?.port;\n\nconst toMatchImageSnapshot = configureToMatchImageSnapshot({\n failureThreshold: 0,\n failureThresholdType: 'percent',\n customSnapshotIdentifier: ({defaultIdentifier}) => defaultIdentifier,\n});\n\nlet calledToMatchImageSnapshotOutsideDocker = false;\n\nconst localToMatchImageSnapshot = () => {\n calledToMatchImageSnapshotOutsideDocker = true;\n // let the expectation pass, then fail in afterEach. This way we allow developers to debug screenshot tests in local\n // but don't allow them to save screenshots taken outside the dockerized chromium\n return {\n message: () => '',\n pass: true,\n };\n};\n\nexpect.extend({\n toMatchImageSnapshot: isUsingDockerizedChromium ? toMatchImageSnapshot : localToMatchImageSnapshot,\n});\n\nafterEach(() => {\n if (calledToMatchImageSnapshotOutsideDocker) {\n const error = new Error(\n `Calling .toMatchImageSnapshot() is not allowed outside dockerized browser. Please, run your screenshot test in headless mode.`\n );\n error.stack = (error.stack || '').split('\\n')[0];\n throw error;\n }\n});\n\ntype WaitForPaintEndOptions = {\n fullPage?: boolean;\n captureBeyondViewport?: boolean;\n};\n\nconst waitForPaintEnd = async (\n element: ElementHandle | Page,\n {fullPage = true, captureBeyondViewport}: WaitForPaintEndOptions = {}\n) => {\n const MAX_WAIT = 15000;\n const STEP_TIME = 250;\n const t0 = Date.now();\n\n let buf1 = (await element.screenshot(\n normalizeSreenshotOptions({fullPage, captureBeyondViewport})\n )) as Buffer;\n await new Promise((r) => setTimeout(r, STEP_TIME));\n let buf2 = (await element.screenshot(\n normalizeSreenshotOptions({fullPage, captureBeyondViewport})\n )) as Buffer;\n\n // buffers are different if compare != 0\n while (buf1.compare(buf2)) {\n if (Date.now() - t0 > MAX_WAIT) {\n throw Error('Paint end timeout');\n }\n buf1 = buf2;\n await new Promise((r) => setTimeout(r, STEP_TIME));\n buf2 = (await element.screenshot(\n normalizeSreenshotOptions({fullPage, captureBeyondViewport})\n )) as Buffer;\n }\n};\n\nexport interface PageApi extends Omit<Page, 'click' | 'type' | 'select' | 'screenshot'> {\n clear: (selector: ElementHandle) => Promise<void>;\n // These are overridden:\n type: (selector: ElementHandle, text: string, options?: {delay: number}) => Promise<void>;\n click: (selector: ElementHandle, options?: ClickOptions) => Promise<void>;\n select: (selector: ElementHandle, ...values: string[]) => Promise<string[]>;\n screenshot: (options?: CustomScreenshotOptions) => Promise<Buffer>;\n}\n\nconst normalizeSreenshotOptions = ({captureBeyondViewport = false, ...options}: ScreenshotOptions = {}) => {\n // Puppeter default for captureBeyondViewport is true, but we think false is a better default.\n // When this is true, the fixed elements (like fixed footers) are relative to the original page\n // viewport, not to the full page, so those elements look weird in fullPage screenshots.\n return {...options, captureBeyondViewport};\n};\n\n// Puppeteer already calls scrollIntoViewIfNeeded before clicking an element. But it doesn't work in all situations\n// For example, when there is a fixed footer in the page and the element to click is under it, the browser won't scroll\n// because the element is already in the viewport (the ifNeeded part is important here). By forcing the scroll to the\n// center, we manage to fix these edge cases.\nconst scrollIntoView = (el: ElementHandle) => el.evaluate((e) => e.scrollIntoView({block: 'center'}));\n\nexport const getPageApi = (page: Page): PageApi => {\n const api: PageApi = Object.create(page);\n\n api.type = async (elementHandle, text, options) => {\n await scrollIntoView(elementHandle);\n return elementHandle.type(text, options);\n };\n api.click = async (elementHandle, options) => {\n await scrollIntoView(elementHandle);\n return elementHandle.click(options);\n };\n api.select = async (elementHandle, ...values) => {\n await scrollIntoView(elementHandle);\n return elementHandle.select(...values);\n };\n\n api.screenshot = async (options?: CustomScreenshotOptions) => {\n if (!options?.skipNetworkWait) {\n await page.waitForNetworkIdle();\n }\n await waitForPaintEnd(page, options);\n return page.screenshot(normalizeSreenshotOptions(options));\n };\n\n api.clear = async (elementHandle) => {\n await elementHandle.click({clickCount: 3});\n await elementHandle.press('Delete');\n };\n\n // For some reason, puppeteer browserContext.overridePermissions doesn't work with newer chrome versions.\n // This workaround polyfills the browser geolocation api to return the mocked position\n api.setGeolocation = (position: GeolocationOptions) =>\n page.evaluate((position) => {\n window.navigator.geolocation.getCurrentPosition = (callback) => {\n // @ts-expect-error - puppeteer's setGeoLocation does not expect a timestamp to be passed\n callback({\n coords: position,\n });\n };\n }, position as any);\n\n return api;\n};\n\nlet needsRequestInterception = false;\ntype RequestMatcherFn = (req: HTTPRequest) => boolean;\nlet requestHandlers: Array<{\n matcher: RequestMatcherFn;\n handler: jest.Mock<any, any>;\n}> = [];\n\nconst requestInterceptor = (req: HTTPRequest) => {\n const {handler} = requestHandlers.find(({matcher}) => matcher(req)) ?? {\n handler: null,\n };\n if (!handler) {\n req.continue();\n return;\n }\n const response = handler(req);\n req.respond(response);\n};\n\nexport const interceptRequest = (\n matcher: RequestMatcherFn\n): jest.Mock<Partial<ResponseForRequest>, [HTTPRequest]> => {\n needsRequestInterception = true;\n const spy = jest.fn();\n requestHandlers.push({matcher, handler: spy});\n return spy;\n};\n\ntype ApiEndpointMock = {\n spyOn(path: string, method?: string): jest.Mock<unknown, [HTTPRequest]>;\n};\n\nexport const createApiEndpointMock = ({\n /** defaults to any origin */\n origin,\n baseUrl,\n}: {\n origin?: string;\n /** @deprecated use origin */\n baseUrl?: string;\n} = {}): ApiEndpointMock => {\n const originRegExp = globToRegExp(origin ?? baseUrl ?? '*');\n\n interceptRequest((req) => {\n const {origin} = new URL(req.url());\n return req.method() === 'OPTIONS' && !!origin.match(originRegExp);\n }).mockImplementation(() => ({\n status: 204,\n headers: {\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'POST,PATCH,PUT,GET,OPTIONS,DELETE',\n 'Access-Control-Allow-Headers': '*',\n },\n }));\n\n return {\n spyOn(spiedPath: string, method: string = 'GET') {\n const matcher = (req: HTTPRequest) => {\n const {origin, pathname, search} = new URL(req.url());\n const pathWithParams = pathname + search;\n\n return (\n req.method() === method &&\n !!origin.match(originRegExp) &&\n matchPath(spiedPath, pathWithParams)\n );\n };\n\n const spy = jest.fn();\n\n interceptRequest(matcher).mockImplementation((req) => {\n const spyResult = spy(req);\n const status = spyResult.status ?? 200;\n const resBody = spyResult.body || spyResult;\n return {\n status,\n headers: {\n 'Access-Control-Allow-Origin': '*',\n },\n contentType: 'application/json',\n body: JSON.stringify(resBody),\n };\n });\n\n return spy;\n },\n };\n};\n\ntype CookieConfig = {\n name: string;\n value: string;\n url?: string;\n domain?: string;\n path?: string;\n secure?: boolean;\n httpOnly?: boolean;\n sameSite?: 'Strict' | 'Lax' | 'None';\n expires?: number;\n priority?: 'Low' | 'Medium' | 'High';\n sameParty?: boolean;\n sourceScheme?: 'Unset' | 'NonSecure' | 'Secure';\n sourcePort?: number;\n};\n\nexport interface TestViewport extends Viewport {\n safeAreaInset?: {\n top?: number | string;\n right?: number | string;\n bottom?: number | string;\n left?: number | string;\n };\n}\n\ninterface OpenPageCommonConfig {\n userAgent?: string;\n viewport?: TestViewport;\n isDarkMode?: boolean;\n cookies?: Array<CookieConfig>;\n}\n\ninterface OpenPageUrlConfig extends OpenPageCommonConfig {\n url: string;\n}\n\ninterface OpenPagePathConfig extends OpenPageCommonConfig {\n url?: undefined;\n\n path?: string;\n port?: number;\n protocol?: string;\n hostname?: string;\n}\n\ntype OpenPageConfig = OpenPageUrlConfig | OpenPagePathConfig;\n\nexport const openPage = async ({\n userAgent,\n isDarkMode,\n viewport,\n cookies,\n ...urlConfig\n}: OpenPageConfig): Promise<PageApi> => {\n const url = ((): string => {\n if (urlConfig.url !== undefined) {\n return urlConfig.url;\n }\n\n const {path = '/', port = serverPort, protocol = 'http', hostname = serverHostName} = urlConfig;\n\n if (!port) {\n // Error.captureStackTrace(error, openPage);\n throw new Error(\n 'You must specify a port. You can specify it when calling openPage() or by configuring a dev and ci server in the acceptanceTests config in your package.json'\n );\n }\n\n return `${protocol}://${hostname}:${port}${path}`;\n })();\n\n const currentUserAgent = userAgent || (await getGlobalBrowser().userAgent());\n const page = getGlobalPage();\n\n await page.bringToFront();\n if (viewport) {\n await page.setViewport(viewport);\n }\n if (cookies) {\n await page.setCookie(...cookies);\n }\n await page.setUserAgent(`${currentUserAgent} acceptance-test`);\n await page.emulateMediaFeatures([{name: 'prefers-color-scheme', value: isDarkMode ? 'dark' : 'light'}]);\n\n // A set of styles to make screenshot tests more reliable.\n await page.evaluateOnNewDocument((viewport?: TestViewport) => {\n const overriddenSafeAreaInsets = !viewport\n ? []\n : Object.keys(viewport?.safeAreaInset ?? {}).map((key) => {\n const position = key as 'top' | 'right' | 'bottom' | 'left';\n return `--acceptance-test-override-safe-area-inset-${key}: ${viewport?.safeAreaInset?.[position]};`;\n });\n\n const style = document.createElement('style');\n style.innerHTML = `\n *, *:after, *:before {\n transition-delay: 0s !important;\n transition-duration: 0s !important;\n animation-delay: -0.0001s !important;\n animation-duration: 0s !important;\n animation-play-state: paused !important;\n caret-color: transparent !important;\n font-variant-ligatures: none !important;\n }\n *::-webkit-scrollbar {\n display: none !important;\n width: 0 !important;\n height: 0 !important;\n }\n :root {\n ${overriddenSafeAreaInsets.join('\\n')}\n }\n `;\n window.addEventListener('DOMContentLoaded', () => {\n document.head.appendChild(style);\n });\n }, viewport);\n\n if (needsRequestInterception) {\n await page.setRequestInterception(true);\n page.on('request', requestInterceptor);\n }\n\n try {\n await page.goto(url);\n } catch (e) {\n if ((e as Error).message.includes('net::ERR_CONNECTION_REFUSED')) {\n const connectionError = new Error(`Could not connect to ${url}. Is the server running?`);\n Error.captureStackTrace(connectionError, openPage);\n throw connectionError;\n } else {\n throw e;\n }\n }\n await page.waitForFunction('document.fonts.status === \"loaded\"');\n\n return getPageApi(page);\n};\n\nconst buildQueryMethods = ({page, element}: {page?: Page; element?: ElementHandle} = {}): ReturnType<\n typeof getQueriesForElement\n> => {\n const boundQueries: any = {};\n for (const [queryName, queryFn] of Object.entries(queries)) {\n boundQueries[queryName] = async (...args: any) => {\n const doc = await getDocument(page ?? getGlobalPage());\n const body = await doc.$('body');\n const queryArgs = [...args];\n if (queryName.startsWith('findBy')) {\n if (queryArgs.length === 1) {\n queryArgs.push(undefined);\n }\n queryArgs.push({timeout: 10000});\n }\n const elementHandle: ElementHandle = await queryFn(element ?? body, ...queryArgs);\n\n const newElementHandle = Object.create(elementHandle);\n\n newElementHandle.screenshot = async (options: CustomScreenshotOptions) => {\n if (!options?.skipNetworkWait) {\n await (page ?? getGlobalPage()).waitForNetworkIdle();\n }\n await waitForPaintEnd(elementHandle, {...options, fullPage: false});\n return elementHandle.screenshot(normalizeSreenshotOptions(options));\n };\n\n newElementHandle.click = async (options?: ClickOptions) => {\n await scrollIntoView(elementHandle);\n return elementHandle.click(options);\n };\n\n newElementHandle.type = async (text: string, options?: {delay: number}) => {\n await scrollIntoView(elementHandle);\n return elementHandle.type(text, options);\n };\n\n newElementHandle.select = async (...values: Array<string>) => {\n await scrollIntoView(elementHandle);\n return elementHandle.select(...values);\n };\n\n return newElementHandle;\n };\n }\n return boundQueries;\n};\n\nexport const getScreen = (page: Page) => buildQueryMethods({page});\n\nexport const screen = buildQueryMethods();\n\nexport const within = (element: ElementHandle) => buildQueryMethods({element});\n\nexport type {ElementHandle, Viewport} from 'puppeteer';\n\nbeforeEach(async () => {\n await getGlobalPage().setRequestInterception(false);\n\n // by resetting the page we clean up all the evaluateOnNewDocument calls, which are persistent between documents\n await (global as any).jestPuppeteer.resetPage();\n});\n\nafterEach(async () => {\n await collectCoverageIfAvailable({coveragePath});\n\n try {\n const page = getGlobalPage();\n requestHandlers = [];\n needsRequestInterception = false;\n page.off('request', requestInterceptor);\n\n // clear tab, this way we clear the DOM and stop js execution or pending requests\n await page.goto('about:blank');\n } catch (e) {\n // ignore, at this point page might be destroyed\n }\n});\n\n/**\n * Returns a new path to the file that can be used by chromium in acceptance tests\n *\n * To be able to use `element.uploadFile()` in a dockerized chromium, the file must exist in the\n * host and the docker, and both sides must use the same path.\n *\n * To workaround this bug or limitation, this function prepares the file by copying it to /tmp in\n * the host and the container.\n */\nexport const prepareFile = (filepath: string): string => {\n const isLocal = !isCi;\n const isHeadless = !!process.env.HEADLESS;\n const usesDocker = isLocal && isHeadless;\n\n const dockerComposeFile = path.join(__dirname, '..', 'docker-compose.yaml');\n\n if (usesDocker) {\n const containerId = execSync(`docker-compose -f ${dockerComposeFile} ps -q`).toString().trim();\n\n if (!containerId) {\n throw Error('acceptance-testing container not found');\n }\n\n execSync(`docker cp ${filepath} ${containerId}:/tmp`);\n\n const newPath = path.join('/tmp', path.basename(filepath));\n\n fs.copyFileSync(filepath, newPath);\n\n return newPath;\n } else {\n return filepath;\n }\n};\n\n/**\n * A convenience method to defer an expectation\n */\nexport const wait = <T>(expectation: () => Promise<T> | T, timeout = 10000, interval = 50): Promise<T> => {\n const startTime = Date.now();\n const startStack = new Error().stack;\n\n return new Promise((resolve, reject) => {\n const rejectOrRerun = (error: unknown) => {\n if (Date.now() - startTime >= timeout) {\n if (error instanceof Error) {\n if (error.message === 'Element not removed') {\n error.stack = startStack;\n }\n }\n reject(error);\n return;\n }\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n setTimeout(runExpectation, interval);\n };\n const runExpectation = () => {\n try {\n Promise.resolve(expectation())\n .then((r) => resolve(r))\n .catch(rejectOrRerun);\n } catch (error) {\n rejectOrRerun(error);\n }\n };\n setTimeout(runExpectation, 0);\n });\n};\n\nexport const waitForElementToBeRemoved = (\n element: ElementHandle<Element>,\n timeout = 10000,\n interval = 100\n): Promise<void> => {\n const startStack = new Error().stack;\n\n const wait = async () => {\n const t0 = Date.now();\n while (Date.now() - t0 < timeout) {\n // boundingBox returns null when the element is not in the DOM\n const box = await element.boundingBox();\n if (!box) {\n return;\n }\n await new Promise((resolve) => setTimeout(resolve, interval));\n }\n throw new Error('Element not removed');\n };\n\n return wait().catch((error) => {\n if (error.message === 'Element not removed') {\n error.stack = startStack;\n }\n throw error;\n });\n};\n"],"names":["getGlobalPage","global","page","getRootPath","rootPath","expect","getState","snapshotState","_rootDir","Error","prepareCoverageReportPath","_ref","coveragePath","ppidFile","path","join","ppid","process","toString","fs","existsSync","readFileSync","cwd","normalize","startsWith","rmSync","recursive","force","mkdirSync","writeFileSync","collectCoverageIfAvailable","_ref3","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_ref2","coverage","nycOutputPath","wrap","_callee$","_context","prev","next","evaluate","window","__coverage__","sent","abrupt","Object","values","forEach","cov","hash","_JSON$stringify","JSON","stringify","stop","_x","apply","arguments","matchPath","spiedPath","currentPath","normalizedCurrentPath","pattern","globToRegExp","test","LINUX_DOCKER_HOST_IP","getGlobalBrowser","browser","isCi","argv","includes","env","CI","isUsingDockerizedChromium","URL","wsEndpoint","port","isWsl","platform","execSync","e","isWsl2","replace","split","map","line","trim","some","match","getWslHostIp","ips","serverHostName","rootDir","findRoot","pkg","parse","projectConfig","_pkg$acceptanceTests","acceptanceTests","server","ciServer","devServer","_projectConfig$covera","serverPort","toMatchImageSnapshot","configureToMatchImageSnapshot","failureThreshold","failureThresholdType","customSnapshotIdentifier","defaultIdentifier","calledToMatchImageSnapshotOutsideDocker","localToMatchImageSnapshot","message","pass","extend","afterEach","error","stack","waitForPaintEnd","element","_temp","_ref4","_ref4$fullPage","fullPage","captureBeyondViewport","MAX_WAIT","STEP_TIME","t0","buf1","buf2","Date","now","screenshot","normalizeSreenshotOptions","Promise","r","setTimeout","compare","_x2","_temp2","_ref5$captureBeyondVi","_ref5","options","_objectWithoutPropertiesLoose","_excluded","_extends","scrollIntoView","el","block","getPageApi","api","create","type","_ref6","_callee2","elementHandle","text","_callee2$","_context2","_x3","_x4","_x5","click","_ref7","_callee3","_callee3$","_context3","_x6","_x7","select","_ref8","_callee4","_len","_key","_args4","_callee4$","_context4","length","Array","_x8","_ref9","_callee5","_callee5$","_context5","skipNetworkWait","waitForNetworkIdle","_x9","clear","_ref10","_callee6","_callee6$","_context6","clickCount","press","_x10","setGeolocation","position","navigator","geolocation","getCurrentPosition","callback","coords","needsRequestInterception","requestHandlers","requestInterceptor","req","_ref11","_requestHandlers$find","find","_ref12","matcher","handler","response","respond","interceptRequest","spy","jest","fn","push","createApiEndpointMock","_temp3","origin","_ref13","baseUrl","originRegExp","_ref14","_URL","url","method","mockImplementation","status","headers","spyOn","_URL2","pathname","search","pathWithParams","spyResult","_spyResult$status","resBody","body","contentType","openPage","_ref16","_callee7","_ref15","userAgent","isDarkMode","viewport","cookies","urlConfig","currentUserAgent","connectionError","_callee7$","_context7","_excluded2","undefined","_urlConfig$path","_urlConfig$port","_urlConfig$protocol","protocol","_urlConfig$hostname","hostname","bringToFront","setViewport","setCookie","setUserAgent","emulateMediaFeatures","name","value","evaluateOnNewDocument","overriddenSafeAreaInsets","keys","_viewport$safeAreaIns","safeAreaInset","key","_viewport$safeAreaIns2","style","document","createElement","innerHTML","addEventListener","head","appendChild","setRequestInterception","on","t1","captureStackTrace","waitForFunction","_x11","buildQueryMethods","_temp4","_ref17","boundQueries","_loop","_Object$entries$_i","_Object$entries","_i","queryName","queryFn","_callee12","doc","_len2","args","_key2","queryArgs","newElementHandle","_args12","_callee12$","_context12","getDocument","$","concat","timeout","_ref19","_callee8","_callee8$","_context8","_x12","_ref20","_callee9","_callee9$","_context9","_x13","_ref21","_callee10","_callee10$","_context10","_x14","_x15","_callee11","_args11","_callee11$","_context11","entries","queries","getScreen","screen","within","beforeEach","_callee13","_callee13$","_context13","jestPuppeteer","resetPage","_callee14","_callee14$","_context14","off","prepareFile","filepath","isLocal","isHeadless","HEADLESS","usesDocker","dockerComposeFile","__dirname","containerId","newPath","basename","copyFileSync","wait","expectation","interval","startTime","startStack","resolve","reject","rejectOrRerun","runExpectation","then","waitForElementToBeRemoved","_ref25","_callee15","box","_callee15$","_context15","boundingBox"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAMA,aAAa,GAAG,SAAhBA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;EAED,OAAOgT,IAAI,EAAE,SAAM,CAAC,UAACrP,KAAK;IACtB,IAAIA,KAAK,CAACJ,OAAO,KAAK,qBAAqB,EAAE;MACzCI,KAAK,CAACC,KAAK,GAAGwP,UAAU;;IAE5B,MAAMzP,KAAK;GACd,CAAC;AACN,CAAC;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acceptance-testing.cjs.production.min.js","sources":["../src/coverage.ts","../src/index.ts","../src/utils.ts"],"sourcesContent":["import path from 'path';\nimport fs from 'fs';\n\nimport type {Page} from 'puppeteer';\n\nconst getGlobalPage = (): Page => (global as any).page;\n\nexport const getRootPath = () => {\n const rootPath = expect.getState().snapshotState._rootDir;\n if (!rootPath) {\n throw new Error('Root path not found');\n }\n return rootPath;\n};\n\n/**\n * We want to clear coverage files from previous runs, but at this point it is not easy because each\n * worker runs a different instance of this script, so we can't just clear the coverage folder at\n * the beginning of the test run.\n *\n * The solution is to remove the coverage folder when the stored ppid (parent process id) is\n * different from the current one\n */\nconst prepareCoverageReportPath = ({coveragePath}: {coveragePath: string}) => {\n const ppidFile = path.join(coveragePath, '.ppid');\n const ppid = process.ppid.toString();\n if (!fs.existsSync(ppidFile) || fs.readFileSync(ppidFile, 'utf-8') !== ppid) {\n // the condition is just to make sure we don't remove files outside the repo\n if (getRootPath() === process.cwd() && path.normalize(coveragePath).startsWith(process.cwd())) {\n fs.rmSync(coveragePath, {recursive: true, force: true});\n }\n fs.mkdirSync(coveragePath, {recursive: true});\n fs.writeFileSync(ppidFile, ppid);\n }\n};\n\n/**\n * Asumes the code was instrumented with istanbul and the coverage report stored in `window.__coverage__`.\n * If not, this function does nothing.\n */\nexport const collectCoverageIfAvailable = async ({coveragePath}: {coveragePath: string}): Promise<void> => {\n const coverage = await getGlobalPage().evaluate(() => {\n return (window as any).__coverage__;\n });\n if (!coverage) {\n return;\n }\n\n prepareCoverageReportPath({coveragePath});\n const nycOutputPath = path.join(coveragePath, '.nyc_output');\n fs.mkdirSync(nycOutputPath, {recursive: true});\n\n Object.values(coverage).forEach((cov: any) => {\n if (cov && cov.path && cov.hash) {\n fs.writeFileSync(path.join(nycOutputPath, cov.hash + '.json'), JSON.stringify({[cov.path]: cov}));\n }\n });\n};\n","import path from 'path';\nimport fs from 'fs';\nimport findRoot from 'find-root';\nimport {getDocument, queries} from 'pptr-testing-library';\nimport {configureToMatchImageSnapshot} from 'jest-image-snapshot';\nimport globToRegExp from 'glob-to-regexp';\nimport {execSync} from 'child_process';\nimport {collectCoverageIfAvailable} from './coverage';\nimport {matchPath} from './utils';\n\nimport type {getQueriesForElement} from 'pptr-testing-library';\nimport type {\n Browser,\n ClickOptions,\n ElementHandle,\n GeolocationOptions,\n HTTPRequest,\n Page,\n ResponseForRequest,\n ScreenshotOptions,\n Viewport,\n} from 'puppeteer';\n\ntype CustomScreenshotOptions = ScreenshotOptions & {\n skipNetworkWait?: boolean;\n};\n\nconst LINUX_DOCKER_HOST_IP = '172.17.0.1';\n\nexport const getGlobalBrowser = (): Browser => (global as any).browser;\nexport const getGlobalPage = (): Page => (global as any).page;\n\nconst isCi = process.argv.includes('--ci') || process.env.CI;\nconst isUsingDockerizedChromium = isCi || new URL(getGlobalBrowser().wsEndpoint()).port === '9223';\n\n/** Check if running inside WSL */\nconst isWsl = () => {\n if (process.platform !== 'linux') {\n return false;\n }\n try {\n return execSync('which wsl.exe').toString().startsWith('/mnt/');\n } catch (e) {\n // catched because it throws an error if wsl.exe is not found\n return false;\n }\n};\n\n/** Assumes running inside WSL */\nconst isWsl2 = () => {\n // `wsl.exe -l -v` returns something like:\n //\n // NAME STATE VERSION\n // * Ubuntu-22.04 Running 2\n // docker-desktop-data Running 2\n // docker-desktop Running 2\n // Ubuntu-20.04 Stopped 2\n return (\n execSync('wsl.exe -l -v')\n .toString()\n // null-bytes are inserted between chars in this command output (UTF-16 output?)\n .replace(/\\0/g, '')\n .split('\\n')\n .map((line) => line.trim())\n // matches a line like: \"* Ubuntu-22.04 Running 2\"\n .some((line) => !!line.match(/\\*\\s+\\S+\\s+Running\\s+2/))\n );\n};\n\n/** Assumes running inside WSL */\nconst getWslHostIp = () => {\n const ips = execSync('wsl.exe hostname -I').toString().trim().split(/\\s+/);\n\n if (ips.includes(LINUX_DOCKER_HOST_IP)) {\n // looks like a docker engine installed inside linux\n return LINUX_DOCKER_HOST_IP;\n }\n // assuming docker-desktop installed in windows\n return ips[0];\n};\n\nexport const serverHostName = ((): string => {\n if (isCi) {\n return 'localhost';\n }\n\n if (isUsingDockerizedChromium) {\n if (isWsl()) {\n if (isWsl2()) {\n return getWslHostIp();\n }\n throw new Error('WSL 1 is not supported. Please, use WSL 2.');\n }\n\n if (process.platform === 'win32') {\n throw new Error('Windows is not supported. Please, use WSL 2.');\n }\n\n return process.platform === 'linux' ? LINUX_DOCKER_HOST_IP : 'host.docker.internal';\n }\n\n return 'localhost';\n})();\n\nconst rootDir = findRoot(process.cwd());\nconst pkg = JSON.parse(fs.readFileSync(path.join(rootDir, 'package.json'), 'utf-8'));\nconst projectConfig = pkg.acceptanceTests ?? {};\nconst server = (isCi ? projectConfig.ciServer : projectConfig.devServer) ?? projectConfig.server;\nconst coveragePath = path.join(rootDir, projectConfig.coveragePath ?? 'reports/coverage-acceptance');\n\nexport const serverPort = server?.port;\n\nconst toMatchImageSnapshot = configureToMatchImageSnapshot({\n failureThreshold: 0,\n failureThresholdType: 'percent',\n customSnapshotIdentifier: ({defaultIdentifier}) => defaultIdentifier,\n});\n\nlet calledToMatchImageSnapshotOutsideDocker = false;\n\nconst localToMatchImageSnapshot = () => {\n calledToMatchImageSnapshotOutsideDocker = true;\n // let the expectation pass, then fail in afterEach. This way we allow developers to debug screenshot tests in local\n // but don't allow them to save screenshots taken outside the dockerized chromium\n return {\n message: () => '',\n pass: true,\n };\n};\n\nexpect.extend({\n toMatchImageSnapshot: isUsingDockerizedChromium ? toMatchImageSnapshot : localToMatchImageSnapshot,\n});\n\nafterEach(() => {\n if (calledToMatchImageSnapshotOutsideDocker) {\n const error = new Error(\n `Calling .toMatchImageSnapshot() is not allowed outside dockerized browser. Please, run your screenshot test in headless mode.`\n );\n error.stack = (error.stack || '').split('\\n')[0];\n throw error;\n }\n});\n\ntype WaitForPaintEndOptions = {\n fullPage?: boolean;\n captureBeyondViewport?: boolean;\n};\n\nconst waitForPaintEnd = async (\n element: ElementHandle | Page,\n {fullPage = true, captureBeyondViewport}: WaitForPaintEndOptions = {}\n) => {\n const MAX_WAIT = 15000;\n const STEP_TIME = 250;\n const t0 = Date.now();\n\n let buf1 = (await element.screenshot(\n normalizeSreenshotOptions({fullPage, captureBeyondViewport})\n )) as Buffer;\n await new Promise((r) => setTimeout(r, STEP_TIME));\n let buf2 = (await element.screenshot(\n normalizeSreenshotOptions({fullPage, captureBeyondViewport})\n )) as Buffer;\n\n // buffers are different if compare != 0\n while (buf1.compare(buf2)) {\n if (Date.now() - t0 > MAX_WAIT) {\n throw Error('Paint end timeout');\n }\n buf1 = buf2;\n await new Promise((r) => setTimeout(r, STEP_TIME));\n buf2 = (await element.screenshot(\n normalizeSreenshotOptions({fullPage, captureBeyondViewport})\n )) as Buffer;\n }\n};\n\nexport interface PageApi extends Omit<Page, 'click' | 'type' | 'select'> {\n clear: (selector: ElementHandle) => Promise<void>;\n // These are overridden:\n type: (selector: ElementHandle, text: string, options?: {delay: number}) => Promise<void>;\n click: (selector: ElementHandle, options?: ClickOptions) => Promise<void>;\n select: (selector: ElementHandle, ...values: string[]) => Promise<string[]>;\n screenshot: (options?: CustomScreenshotOptions) => Promise<Buffer | string | void>;\n}\n\nconst normalizeSreenshotOptions = ({captureBeyondViewport = false, ...options}: ScreenshotOptions = {}) => {\n // Puppeter default for captureBeyondViewport is true, but we think false is a better default.\n // When this is true, the fixed elements (like fixed footers) are relative to the original page\n // viewport, not to the full page, so those elements look weird in fullPage screenshots.\n return {...options, captureBeyondViewport};\n};\n\n// Puppeteer already calls scrollIntoViewIfNeeded before clicking an element. But it doesn't work in all situations\n// For example, when there is a fixed footer in the page and the element to click is under it, the browser won't scroll\n// because the element is already in the viewport (the ifNeeded part is important here). By forcing the scroll to the\n// center, we manage to fix these edge cases.\nconst scrollIntoView = (el: ElementHandle) => el.evaluate((e) => e.scrollIntoView({block: 'center'}));\n\nexport const getPageApi = (page: Page): PageApi => {\n const api: PageApi = Object.create(page);\n\n api.type = async (elementHandle, text, options) => {\n await scrollIntoView(elementHandle);\n return elementHandle.type(text, options);\n };\n api.click = async (elementHandle, options) => {\n await scrollIntoView(elementHandle);\n return elementHandle.click(options);\n };\n api.select = async (elementHandle, ...values) => {\n await scrollIntoView(elementHandle);\n return elementHandle.select(...values);\n };\n\n api.screenshot = async (options?: CustomScreenshotOptions) => {\n if (!options?.skipNetworkWait) {\n await page.waitForNetworkIdle();\n }\n await waitForPaintEnd(page, options);\n return page.screenshot(normalizeSreenshotOptions(options));\n };\n\n api.clear = async (elementHandle) => {\n await elementHandle.click({clickCount: 3});\n await elementHandle.press('Delete');\n };\n\n // For some reason, puppeteer browserContext.overridePermissions doesn't work with newer chrome versions.\n // This workaround polyfills the browser geolocation api to return the mocked position\n api.setGeolocation = (position: GeolocationOptions) =>\n page.evaluate((position) => {\n window.navigator.geolocation.getCurrentPosition = (callback) => {\n // @ts-expect-error - puppeteer's setGeoLocation does not expect a timestamp to be passed\n callback({\n coords: position,\n });\n };\n }, position as any);\n\n return api;\n};\n\nlet needsRequestInterception = false;\ntype RequestMatcherFn = (req: HTTPRequest) => boolean;\nlet requestHandlers: Array<{\n matcher: RequestMatcherFn;\n handler: jest.Mock<any, any>;\n}> = [];\n\nconst requestInterceptor = (req: HTTPRequest) => {\n const {handler} = requestHandlers.find(({matcher}) => matcher(req)) ?? {handler: null};\n if (!handler) {\n req.continue();\n return;\n }\n const response = handler(req);\n req.respond(response);\n};\n\nexport const interceptRequest = (\n matcher: RequestMatcherFn\n): jest.Mock<Partial<ResponseForRequest>, [HTTPRequest]> => {\n needsRequestInterception = true;\n const spy = jest.fn();\n requestHandlers.push({matcher, handler: spy});\n return spy;\n};\n\ntype ApiEndpointMock = {\n spyOn(path: string, method?: string): jest.Mock<unknown, [HTTPRequest]>;\n};\n\nexport const createApiEndpointMock = ({\n /** defaults to any origin */\n origin,\n baseUrl,\n}: {\n origin?: string;\n /** @deprecated use origin */\n baseUrl?: string;\n} = {}): ApiEndpointMock => {\n const originRegExp = globToRegExp(origin ?? baseUrl ?? '*');\n\n interceptRequest((req) => {\n const {origin} = new URL(req.url());\n return req.method() === 'OPTIONS' && !!origin.match(originRegExp);\n }).mockImplementation(() => ({\n status: 204,\n headers: {\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'POST,PATCH,PUT,GET,OPTIONS,DELETE',\n 'Access-Control-Allow-Headers': '*',\n },\n }));\n\n return {\n spyOn(spiedPath: string, method: string = 'GET') {\n const matcher = (req: HTTPRequest) => {\n const {origin, pathname, search} = new URL(req.url());\n const pathWithParams = pathname + search;\n\n return (\n req.method() === method &&\n !!origin.match(originRegExp) &&\n matchPath(spiedPath, pathWithParams)\n );\n };\n\n const spy = jest.fn();\n\n interceptRequest(matcher).mockImplementation((req) => {\n const spyResult = spy(req);\n const status = spyResult.status ?? 200;\n const resBody = spyResult.body || spyResult;\n return {\n status,\n headers: {\n 'Access-Control-Allow-Origin': '*',\n },\n contentType: 'application/json',\n body: JSON.stringify(resBody),\n };\n });\n\n return spy;\n },\n };\n};\n\ntype CookieConfig = {\n name: string;\n value: string;\n url?: string;\n domain?: string;\n path?: string;\n secure?: boolean;\n httpOnly?: boolean;\n sameSite?: 'Strict' | 'Lax' | 'None';\n expires?: number;\n priority?: 'Low' | 'Medium' | 'High';\n sameParty?: boolean;\n sourceScheme?: 'Unset' | 'NonSecure' | 'Secure';\n sourcePort?: number;\n};\n\nexport interface TestViewport extends Viewport {\n safeAreaInset?: {\n top?: number | string;\n right?: number | string;\n bottom?: number | string;\n left?: number | string;\n };\n}\n\ninterface OpenPageCommonConfig {\n userAgent?: string;\n viewport?: TestViewport;\n isDarkMode?: boolean;\n cookies?: Array<CookieConfig>;\n}\n\ninterface OpenPageUrlConfig extends OpenPageCommonConfig {\n url: string;\n}\n\ninterface OpenPagePathConfig extends OpenPageCommonConfig {\n url?: undefined;\n\n path?: string;\n port?: number;\n protocol?: string;\n hostname?: string;\n}\n\ntype OpenPageConfig = OpenPageUrlConfig | OpenPagePathConfig;\n\nexport const openPage = async ({\n userAgent,\n isDarkMode,\n viewport,\n cookies,\n ...urlConfig\n}: OpenPageConfig): Promise<PageApi> => {\n const url = ((): string => {\n if (urlConfig.url !== undefined) {\n return urlConfig.url;\n }\n\n const {path = '/', port = serverPort, protocol = 'http', hostname = serverHostName} = urlConfig;\n\n if (!port) {\n // Error.captureStackTrace(error, openPage);\n throw new Error(\n 'You must specify a port. You can specify it when calling openPage() or by configuring a dev and ci server in the acceptanceTests config in your package.json'\n );\n }\n\n return `${protocol}://${hostname}:${port}${path}`;\n })();\n\n const currentUserAgent = userAgent || (await getGlobalBrowser().userAgent());\n const page = getGlobalPage();\n\n await page.bringToFront();\n if (viewport) {\n await page.setViewport(viewport);\n }\n if (cookies) {\n await page.setCookie(...cookies);\n }\n await page.setUserAgent(`${currentUserAgent} acceptance-test`);\n await page.emulateMediaFeatures([{name: 'prefers-color-scheme', value: isDarkMode ? 'dark' : 'light'}]);\n\n // A set of styles to make screenshot tests more reliable.\n await page.evaluateOnNewDocument((viewport: TestViewport) => {\n const overriddenSafeAreaInsets = !viewport\n ? []\n : Object.keys(viewport?.safeAreaInset ?? {}).map((key) => {\n const position = key as 'top' | 'right' | 'bottom' | 'left';\n return `--acceptance-test-override-safe-area-inset-${key}: ${viewport?.safeAreaInset?.[position]};`;\n });\n\n const style = document.createElement('style');\n style.innerHTML = `\n *, *:after, *:before {\n transition-delay: 0s !important;\n transition-duration: 0s !important;\n animation-delay: -0.0001s !important;\n animation-duration: 0s !important;\n animation-play-state: paused !important;\n caret-color: transparent !important;\n font-variant-ligatures: none !important;\n }\n *::-webkit-scrollbar {\n display: none !important;\n width: 0 !important;\n height: 0 !important;\n }\n :root {\n ${overriddenSafeAreaInsets.join('\\n')}\n }\n `;\n window.addEventListener('DOMContentLoaded', () => {\n document.head.appendChild(style);\n });\n }, viewport);\n\n if (needsRequestInterception) {\n await page.setRequestInterception(true);\n page.on('request', requestInterceptor);\n }\n\n try {\n await page.goto(url);\n } catch (e) {\n if ((e as Error).message.includes('net::ERR_CONNECTION_REFUSED')) {\n const connectionError = new Error(`Could not connect to ${url}. Is the server running?`);\n Error.captureStackTrace(connectionError, openPage);\n throw connectionError;\n } else {\n throw e;\n }\n }\n await page.waitForFunction('document.fonts.status === \"loaded\"');\n\n return getPageApi(page);\n};\n\nconst buildQueryMethods = ({page, element}: {page?: Page; element?: ElementHandle} = {}): ReturnType<\n typeof getQueriesForElement\n> => {\n const boundQueries: any = {};\n for (const [queryName, queryFn] of Object.entries(queries)) {\n boundQueries[queryName] = async (...args: any) => {\n const doc = await getDocument(page ?? getGlobalPage());\n const body = await doc.$('body');\n const queryArgs = [...args];\n if (queryName.startsWith('findBy')) {\n if (queryArgs.length === 1) {\n queryArgs.push(undefined);\n }\n queryArgs.push({timeout: 10000});\n }\n const elementHandle: ElementHandle = await queryFn(element ?? body, ...queryArgs);\n\n const newElementHandle = Object.create(elementHandle);\n\n newElementHandle.screenshot = async (options: CustomScreenshotOptions) => {\n if (!options?.skipNetworkWait) {\n await (page ?? getGlobalPage()).waitForNetworkIdle();\n }\n await waitForPaintEnd(elementHandle, {...options, fullPage: false});\n return elementHandle.screenshot(normalizeSreenshotOptions(options));\n };\n\n newElementHandle.click = async (options?: ClickOptions) => {\n await scrollIntoView(elementHandle);\n return elementHandle.click(options);\n };\n\n newElementHandle.type = async (text: string, options?: {delay: number}) => {\n await scrollIntoView(elementHandle);\n return elementHandle.type(text, options);\n };\n\n newElementHandle.select = async (...values: Array<string>) => {\n await scrollIntoView(elementHandle);\n return elementHandle.select(...values);\n };\n\n return newElementHandle;\n };\n }\n return boundQueries;\n};\n\nexport const getScreen = (page: Page) => buildQueryMethods({page});\n\nexport const screen = buildQueryMethods();\n\nexport const within = (element: ElementHandle) => buildQueryMethods({element});\n\nexport type {ElementHandle, Viewport} from 'puppeteer';\n\nbeforeEach(async () => {\n await getGlobalPage().setRequestInterception(false);\n\n // by resetting the page we clean up all the evaluateOnNewDocument calls, which are persistent between documents\n await (global as any).jestPuppeteer.resetPage();\n});\n\nafterEach(async () => {\n await collectCoverageIfAvailable({coveragePath});\n\n try {\n const page = getGlobalPage();\n requestHandlers = [];\n needsRequestInterception = false;\n page.off('request', requestInterceptor);\n\n // clear tab, this way we clear the DOM and stop js execution or pending requests\n await page.goto('about:blank');\n } catch (e) {\n // ignore, at this point page might be destroyed\n }\n});\n\n/**\n * Returns a new path to the file that can be used by chromium in acceptance tests\n *\n * To be able to use `element.uploadFile()` in a dockerized chromium, the file must exist in the\n * host and the docker, and both sides must use the same path.\n *\n * To workaround this bug or limitation, this function prepares the file by copying it to /tmp in\n * the host and the container.\n */\nexport const prepareFile = (filepath: string): string => {\n const isLocal = !isCi;\n const isHeadless = !!process.env.HEADLESS;\n const usesDocker = isLocal && isHeadless;\n\n const dockerComposeFile = path.join(__dirname, '..', 'docker-compose.yaml');\n\n if (usesDocker) {\n const containerId = execSync(`docker-compose -f ${dockerComposeFile} ps -q`).toString().trim();\n\n if (!containerId) {\n throw Error('acceptance-testing container not found');\n }\n\n execSync(`docker cp ${filepath} ${containerId}:/tmp`);\n\n const newPath = path.join('/tmp', path.basename(filepath));\n\n fs.copyFileSync(filepath, newPath);\n\n return newPath;\n } else {\n return filepath;\n }\n};\n\n/**\n * A convenience method to defer an expectation\n */\nexport const wait = <T>(expectation: () => Promise<T> | T, timeout = 10000, interval = 50): Promise<T> => {\n const startTime = Date.now();\n const startStack = new Error().stack;\n\n return new Promise((resolve, reject) => {\n const rejectOrRerun = (error: unknown) => {\n if (Date.now() - startTime >= timeout) {\n if (error instanceof Error) {\n if (error.message === 'Element not removed') {\n error.stack = startStack;\n }\n }\n reject(error);\n return;\n }\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n setTimeout(runExpectation, interval);\n };\n const runExpectation = () => {\n try {\n Promise.resolve(expectation())\n .then((r) => resolve(r))\n .catch(rejectOrRerun);\n } catch (error) {\n rejectOrRerun(error);\n }\n };\n setTimeout(runExpectation, 0);\n });\n};\n\nexport const waitForElementToBeRemoved = (\n element: ElementHandle<Element>,\n timeout = 10000,\n interval = 100\n): Promise<void> => {\n const startStack = new Error().stack;\n\n const wait = async () => {\n const t0 = Date.now();\n while (Date.now() - t0 < timeout) {\n // boundingBox returns null when the element is not in the DOM\n const box = await element.boundingBox();\n if (!box) {\n return;\n }\n await new Promise((resolve) => setTimeout(resolve, interval));\n }\n throw new Error('Element not removed');\n };\n\n return wait().catch((error) => {\n if (error.message === 'Element not removed') {\n error.stack = startStack;\n }\n throw error;\n });\n};\n","import path from 'path';\nimport globToRegExp from 'glob-to-regexp';\n\n/**\n * Returns true if the current path matches the spied path, including parameters\n */\nexport const matchPath = (spiedPath: string, currentPath: string): boolean => {\n const normalizedCurrentPath = path.normalize(currentPath);\n const pattern = globToRegExp(spiedPath);\n return pattern.test(normalizedCurrentPath);\n};\n"],"names":["prepareCoverageReportPath","_ref","coveragePath","ppidFile","path","join","ppid","process","toString","fs","existsSync","readFileSync","rootPath","expect","getState","snapshotState","_rootDir","Error","getRootPath","cwd","normalize","startsWith","rmSync","recursive","force","mkdirSync","writeFileSync","collectCoverageIfAvailable","_ref3","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_ref2","coverage","nycOutputPath","wrap","_context","prev","next","global","page","evaluate","window","__coverage__","sent","abrupt","Object","values","forEach","cov","_JSON$stringify","hash","JSON","stringify","stop","_x","apply","arguments","getGlobalBrowser","browser","getGlobalPage","isCi","argv","includes","env","CI","isUsingDockerizedChromium","URL","wsEndpoint","port","serverHostName","platform","execSync","e","isWsl","replace","split","map","line","trim","some","match","ips","rootDir","findRoot","projectConfig","_pkg$acceptanceTests","parse","acceptanceTests","server","ciServer","devServer","_projectConfig$covera","serverPort","calledToMatchImageSnapshotOutsideDocker","extend","toMatchImageSnapshot","configureToMatchImageSnapshot","failureThreshold","failureThresholdType","customSnapshotIdentifier","defaultIdentifier","message","pass","afterEach","error","stack","waitForPaintEnd","element","_temp","_ref4","_ref4$fullPage","fullPage","captureBeyondViewport","MAX_WAIT","STEP_TIME","t0","buf1","buf2","Date","now","screenshot","normalizeSreenshotOptions","Promise","r","setTimeout","compare","_x2","_temp2","_ref5$captureBeyondVi","_ref5","_extends","_objectWithoutPropertiesLoose","_excluded","scrollIntoView","el","block","getPageApi","api","create","type","_ref6","_callee2","elementHandle","text","options","_context2","_x3","_x4","_x5","click","_ref7","_callee3","_context3","_x6","_x7","select","_ref8","_callee4","_len","_key","_args4","_context4","length","Array","_x8","_ref9","_callee5","_context5","skipNetworkWait","waitForNetworkIdle","_x9","clear","_ref10","_callee6","_context6","clickCount","press","_x10","setGeolocation","position","navigator","geolocation","getCurrentPosition","callback","coords","needsRequestInterception","requestHandlers","requestInterceptor","req","handler","_requestHandlers$find","find","_ref12","matcher","response","respond","interceptRequest","spy","jest","fn","push","openPage","_ref16","_callee7","_ref15","userAgent","isDarkMode","viewport","cookies","urlConfig","url","currentUserAgent","connectionError","_context7","_excluded2","undefined","_urlConfig$path","_urlConfig$port","_urlConfig$protocol","protocol","_urlConfig$hostname","hostname","bringToFront","setViewport","setCookie","setUserAgent","emulateMediaFeatures","name","value","evaluateOnNewDocument","overriddenSafeAreaInsets","keys","_viewport$safeAreaIns","safeAreaInset","key","_viewport$safeAreaIns2","style","document","createElement","innerHTML","addEventListener","head","appendChild","setRequestInterception","on","t1","captureStackTrace","waitForFunction","_x11","buildQueryMethods","_temp4","_ref17","boundQueries","_loop","_Object$entries$_i","_Object$entries","_i","queryName","queryFn","_callee12","doc","body","_len2","args","_key2","queryArgs","newElementHandle","_args12","_context12","getDocument","$","concat","timeout","_ref19","_callee8","_context8","_x12","_ref20","_callee9","_context9","_x13","_ref21","_callee10","_context10","_x14","_x15","_callee11","_args11","_context11","entries","queries","screen","beforeEach","_callee13","_context13","jestPuppeteer","resetPage","_callee14","_context14","off","_temp3","origin","_ref13","originRegExp","globToRegExp","_ref14","baseUrl","method","mockImplementation","status","headers","Access-Control-Allow-Origin","Access-Control-Allow-Methods","Access-Control-Allow-Headers","spyOn","spiedPath","_URL2","pathWithParams","pathname","search","currentPath","normalizedCurrentPath","test","matchPath","spyResult","_spyResult$status","contentType","filepath","isHeadless","HEADLESS","usesDocker","dockerComposeFile","__dirname","containerId","newPath","basename","copyFileSync","expectation","interval","startTime","startStack","resolve","reject","rejectOrRerun","runExpectation","then","_ref25","_callee15","_context15","boundingBox","wait"],"mappings":"u7OAKA,UAkBMA,EAA4B,SAAHC,OAAKC,EAAYD,EAAZC,aAC1BC,EAAWC,EAAKC,KAAKH,EAAc,SACnCI,EAAOC,QAAQD,KAAKE,WACrBC,EAAGC,WAAWP,IAAaM,EAAGE,aAAaR,EAAU,WAAaG,IAnBhD,WACvB,IAAMM,EAAWC,OAAOC,WAAWC,cAAcC,SACjD,IAAKJ,EACD,MAAM,IAAIK,MAAM,uBAEpB,OAAOL,EAgBCM,KAAkBX,QAAQY,OAASf,EAAKgB,UAAUlB,GAAcmB,WAAWd,QAAQY,QACnFV,EAAGa,OAAOpB,EAAc,CAACqB,WAAW,EAAMC,OAAO,IAErDf,EAAGgB,UAAUvB,EAAc,CAACqB,WAAW,IACvCd,EAAGiB,cAAcvB,EAAUG,KAQtBqB,aAA0B,IAAAC,EAAAC,EAAAC,IAAAC,MAAG,SAAAC,EAAAC,GAAA,IAAA/B,EAAAgC,EAAAC,EAAA,OAAAL,IAAAM,eAAAC,GAAA,cAAAA,EAAAC,KAAAD,EAAAE,MAAA,OAAoB,OAAZrC,EAAY+B,EAAZ/B,aAAYmC,EAAAE,OAnC3BC,OAAeC,KAoCPC,UAAS,WAC5C,OAAQC,OAAeC,gBACzB,OAFY,GAARV,EAAQG,EAAA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ACVkE,IAAAA,EAAW,KAEX,IAAME,GAAa,IAAIrU,OAAQ0F,MAe/B,kBAbU,IAAAiP,EAAA/T,EAAAC,IAAAC,MAAG,SAAA8T,IAAA,IAAAxO,EAAA,OAAAvF,IAAAM,eAAA0T,GAAA,cAAAA,EAAAxT,KAAAwT,EAAAvT,MAAA,OACH8E,EAAKG,KAAKC,MAAK,OAAA,KACdD,KAAKC,MAAQJ,EAAK6J,IAAO4E,EAAAvT,QAAA,MAAA,OAAAuT,EAAAvT,OAEVsE,EAAQkP,cAAa,OAA9B,GAAAD,EAAAjT,MACDiT,EAAAvT,OAAA,MAAA,OAAAuT,EAAAhT,iBAAA,OAAA,OAAAgT,EAAAvT,OAGF,IAAIqF,SAAQ,SAAC2N,GAAO,OAAKzN,WAAWyN,EAASH,MAAU,OAAAU,EAAAvT,OAAA,MAAA,QAAA,MAE3D,IAAItB,MAAM,uBAAsB,QAAA,UAAA,OAAA6U,EAAAvS,UAAAsS,OACzC,kBAXS,OAAAD,EAAAnS,WAAAC,cAaHsS,UAAa,SAACtP,GAIjB,KAHsB,wBAAlBA,EAAMH,UACNG,EAAMC,MAAQ2O,GAEZ5O,qBAxHQ,SAACG,GAAsB,OAAK8I,EAAkB,CAAC9I,QAAAA"}
|
|
1
|
+
{"version":3,"file":"acceptance-testing.cjs.production.min.js","sources":["../src/coverage.ts","../src/index.ts","../src/utils.ts"],"sourcesContent":["import path from 'path';\nimport fs from 'fs';\n\nimport type {Page} from 'puppeteer';\n\nconst getGlobalPage = (): Page => (global as any).page;\n\nexport const getRootPath = () => {\n const rootPath = expect.getState().snapshotState._rootDir;\n if (!rootPath) {\n throw new Error('Root path not found');\n }\n return rootPath;\n};\n\n/**\n * We want to clear coverage files from previous runs, but at this point it is not easy because each\n * worker runs a different instance of this script, so we can't just clear the coverage folder at\n * the beginning of the test run.\n *\n * The solution is to remove the coverage folder when the stored ppid (parent process id) is\n * different from the current one\n */\nconst prepareCoverageReportPath = ({coveragePath}: {coveragePath: string}) => {\n const ppidFile = path.join(coveragePath, '.ppid');\n const ppid = process.ppid.toString();\n if (!fs.existsSync(ppidFile) || fs.readFileSync(ppidFile, 'utf-8') !== ppid) {\n // the condition is just to make sure we don't remove files outside the repo\n if (getRootPath() === process.cwd() && path.normalize(coveragePath).startsWith(process.cwd())) {\n fs.rmSync(coveragePath, {recursive: true, force: true});\n }\n fs.mkdirSync(coveragePath, {recursive: true});\n fs.writeFileSync(ppidFile, ppid);\n }\n};\n\n/**\n * Asumes the code was instrumented with istanbul and the coverage report stored in `window.__coverage__`.\n * If not, this function does nothing.\n */\nexport const collectCoverageIfAvailable = async ({coveragePath}: {coveragePath: string}): Promise<void> => {\n const coverage = await getGlobalPage().evaluate(() => {\n return (window as any).__coverage__;\n });\n if (!coverage) {\n return;\n }\n\n prepareCoverageReportPath({coveragePath});\n const nycOutputPath = path.join(coveragePath, '.nyc_output');\n fs.mkdirSync(nycOutputPath, {recursive: true});\n\n Object.values(coverage).forEach((cov: any) => {\n if (cov && cov.path && cov.hash) {\n fs.writeFileSync(path.join(nycOutputPath, cov.hash + '.json'), JSON.stringify({[cov.path]: cov}));\n }\n });\n};\n","import path from 'path';\nimport fs from 'fs';\nimport findRoot from 'find-root';\nimport {getDocument, queries} from 'pptr-testing-library';\nimport {configureToMatchImageSnapshot} from 'jest-image-snapshot';\nimport globToRegExp from 'glob-to-regexp';\nimport {execSync} from 'child_process';\nimport {collectCoverageIfAvailable} from './coverage';\nimport {matchPath} from './utils';\n\nimport type {getQueriesForElement} from 'pptr-testing-library';\nimport type {\n Browser,\n ClickOptions,\n ElementHandle,\n GeolocationOptions,\n HTTPRequest,\n Page,\n ResponseForRequest,\n ScreenshotOptions,\n Viewport,\n} from 'puppeteer';\n\ntype CustomScreenshotOptions = ScreenshotOptions & {\n skipNetworkWait?: boolean;\n};\n\nconst LINUX_DOCKER_HOST_IP = '172.17.0.1';\n\nexport const getGlobalBrowser = (): Browser => (global as any).browser;\nexport const getGlobalPage = (): Page => (global as any).page;\n\nconst isCi = process.argv.includes('--ci') || process.env.CI;\nconst isUsingDockerizedChromium = isCi || new URL(getGlobalBrowser().wsEndpoint()).port === '9223';\n\n/** Check if running inside WSL */\nconst isWsl = () => {\n if (process.platform !== 'linux') {\n return false;\n }\n try {\n return execSync('which wsl.exe').toString().startsWith('/mnt/');\n } catch (e) {\n // catched because it throws an error if wsl.exe is not found\n return false;\n }\n};\n\n/** Assumes running inside WSL */\nconst isWsl2 = () => {\n // `wsl.exe -l -v` returns something like:\n //\n // NAME STATE VERSION\n // * Ubuntu-22.04 Running 2\n // docker-desktop-data Running 2\n // docker-desktop Running 2\n // Ubuntu-20.04 Stopped 2\n return (\n execSync('wsl.exe -l -v')\n .toString()\n // null-bytes are inserted between chars in this command output (UTF-16 output?)\n .replace(/\\0/g, '')\n .split('\\n')\n .map((line) => line.trim())\n // matches a line like: \"* Ubuntu-22.04 Running 2\"\n .some((line) => !!line.match(/\\*\\s+\\S+\\s+Running\\s+2/))\n );\n};\n\n/** Assumes running inside WSL */\nconst getWslHostIp = () => {\n const ips = execSync('wsl.exe hostname -I').toString().trim().split(/\\s+/);\n\n if (ips.includes(LINUX_DOCKER_HOST_IP)) {\n // looks like a docker engine installed inside linux\n return LINUX_DOCKER_HOST_IP;\n }\n // assuming docker-desktop installed in windows\n return ips[0];\n};\n\nexport const serverHostName = ((): string => {\n if (isCi) {\n return 'localhost';\n }\n\n if (isUsingDockerizedChromium) {\n if (isWsl()) {\n if (isWsl2()) {\n return getWslHostIp();\n }\n throw new Error('WSL 1 is not supported. Please, use WSL 2.');\n }\n\n if (process.platform === 'win32') {\n throw new Error('Windows is not supported. Please, use WSL 2.');\n }\n\n return process.platform === 'linux' ? LINUX_DOCKER_HOST_IP : 'host.docker.internal';\n }\n\n return 'localhost';\n})();\n\nconst rootDir = findRoot(process.cwd());\nconst pkg = JSON.parse(fs.readFileSync(path.join(rootDir, 'package.json'), 'utf-8'));\nconst projectConfig = pkg.acceptanceTests ?? {};\nconst server = (isCi ? projectConfig.ciServer : projectConfig.devServer) ?? projectConfig.server;\nconst coveragePath = path.join(rootDir, projectConfig.coveragePath ?? 'reports/coverage-acceptance');\n\nexport const serverPort = server?.port;\n\nconst toMatchImageSnapshot = configureToMatchImageSnapshot({\n failureThreshold: 0,\n failureThresholdType: 'percent',\n customSnapshotIdentifier: ({defaultIdentifier}) => defaultIdentifier,\n});\n\nlet calledToMatchImageSnapshotOutsideDocker = false;\n\nconst localToMatchImageSnapshot = () => {\n calledToMatchImageSnapshotOutsideDocker = true;\n // let the expectation pass, then fail in afterEach. This way we allow developers to debug screenshot tests in local\n // but don't allow them to save screenshots taken outside the dockerized chromium\n return {\n message: () => '',\n pass: true,\n };\n};\n\nexpect.extend({\n toMatchImageSnapshot: isUsingDockerizedChromium ? toMatchImageSnapshot : localToMatchImageSnapshot,\n});\n\nafterEach(() => {\n if (calledToMatchImageSnapshotOutsideDocker) {\n const error = new Error(\n `Calling .toMatchImageSnapshot() is not allowed outside dockerized browser. Please, run your screenshot test in headless mode.`\n );\n error.stack = (error.stack || '').split('\\n')[0];\n throw error;\n }\n});\n\ntype WaitForPaintEndOptions = {\n fullPage?: boolean;\n captureBeyondViewport?: boolean;\n};\n\nconst waitForPaintEnd = async (\n element: ElementHandle | Page,\n {fullPage = true, captureBeyondViewport}: WaitForPaintEndOptions = {}\n) => {\n const MAX_WAIT = 15000;\n const STEP_TIME = 250;\n const t0 = Date.now();\n\n let buf1 = (await element.screenshot(\n normalizeSreenshotOptions({fullPage, captureBeyondViewport})\n )) as Buffer;\n await new Promise((r) => setTimeout(r, STEP_TIME));\n let buf2 = (await element.screenshot(\n normalizeSreenshotOptions({fullPage, captureBeyondViewport})\n )) as Buffer;\n\n // buffers are different if compare != 0\n while (buf1.compare(buf2)) {\n if (Date.now() - t0 > MAX_WAIT) {\n throw Error('Paint end timeout');\n }\n buf1 = buf2;\n await new Promise((r) => setTimeout(r, STEP_TIME));\n buf2 = (await element.screenshot(\n normalizeSreenshotOptions({fullPage, captureBeyondViewport})\n )) as Buffer;\n }\n};\n\nexport interface PageApi extends Omit<Page, 'click' | 'type' | 'select' | 'screenshot'> {\n clear: (selector: ElementHandle) => Promise<void>;\n // These are overridden:\n type: (selector: ElementHandle, text: string, options?: {delay: number}) => Promise<void>;\n click: (selector: ElementHandle, options?: ClickOptions) => Promise<void>;\n select: (selector: ElementHandle, ...values: string[]) => Promise<string[]>;\n screenshot: (options?: CustomScreenshotOptions) => Promise<Buffer>;\n}\n\nconst normalizeSreenshotOptions = ({captureBeyondViewport = false, ...options}: ScreenshotOptions = {}) => {\n // Puppeter default for captureBeyondViewport is true, but we think false is a better default.\n // When this is true, the fixed elements (like fixed footers) are relative to the original page\n // viewport, not to the full page, so those elements look weird in fullPage screenshots.\n return {...options, captureBeyondViewport};\n};\n\n// Puppeteer already calls scrollIntoViewIfNeeded before clicking an element. But it doesn't work in all situations\n// For example, when there is a fixed footer in the page and the element to click is under it, the browser won't scroll\n// because the element is already in the viewport (the ifNeeded part is important here). By forcing the scroll to the\n// center, we manage to fix these edge cases.\nconst scrollIntoView = (el: ElementHandle) => el.evaluate((e) => e.scrollIntoView({block: 'center'}));\n\nexport const getPageApi = (page: Page): PageApi => {\n const api: PageApi = Object.create(page);\n\n api.type = async (elementHandle, text, options) => {\n await scrollIntoView(elementHandle);\n return elementHandle.type(text, options);\n };\n api.click = async (elementHandle, options) => {\n await scrollIntoView(elementHandle);\n return elementHandle.click(options);\n };\n api.select = async (elementHandle, ...values) => {\n await scrollIntoView(elementHandle);\n return elementHandle.select(...values);\n };\n\n api.screenshot = async (options?: CustomScreenshotOptions) => {\n if (!options?.skipNetworkWait) {\n await page.waitForNetworkIdle();\n }\n await waitForPaintEnd(page, options);\n return page.screenshot(normalizeSreenshotOptions(options));\n };\n\n api.clear = async (elementHandle) => {\n await elementHandle.click({clickCount: 3});\n await elementHandle.press('Delete');\n };\n\n // For some reason, puppeteer browserContext.overridePermissions doesn't work with newer chrome versions.\n // This workaround polyfills the browser geolocation api to return the mocked position\n api.setGeolocation = (position: GeolocationOptions) =>\n page.evaluate((position) => {\n window.navigator.geolocation.getCurrentPosition = (callback) => {\n // @ts-expect-error - puppeteer's setGeoLocation does not expect a timestamp to be passed\n callback({\n coords: position,\n });\n };\n }, position as any);\n\n return api;\n};\n\nlet needsRequestInterception = false;\ntype RequestMatcherFn = (req: HTTPRequest) => boolean;\nlet requestHandlers: Array<{\n matcher: RequestMatcherFn;\n handler: jest.Mock<any, any>;\n}> = [];\n\nconst requestInterceptor = (req: HTTPRequest) => {\n const {handler} = requestHandlers.find(({matcher}) => matcher(req)) ?? {\n handler: null,\n };\n if (!handler) {\n req.continue();\n return;\n }\n const response = handler(req);\n req.respond(response);\n};\n\nexport const interceptRequest = (\n matcher: RequestMatcherFn\n): jest.Mock<Partial<ResponseForRequest>, [HTTPRequest]> => {\n needsRequestInterception = true;\n const spy = jest.fn();\n requestHandlers.push({matcher, handler: spy});\n return spy;\n};\n\ntype ApiEndpointMock = {\n spyOn(path: string, method?: string): jest.Mock<unknown, [HTTPRequest]>;\n};\n\nexport const createApiEndpointMock = ({\n /** defaults to any origin */\n origin,\n baseUrl,\n}: {\n origin?: string;\n /** @deprecated use origin */\n baseUrl?: string;\n} = {}): ApiEndpointMock => {\n const originRegExp = globToRegExp(origin ?? baseUrl ?? '*');\n\n interceptRequest((req) => {\n const {origin} = new URL(req.url());\n return req.method() === 'OPTIONS' && !!origin.match(originRegExp);\n }).mockImplementation(() => ({\n status: 204,\n headers: {\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'POST,PATCH,PUT,GET,OPTIONS,DELETE',\n 'Access-Control-Allow-Headers': '*',\n },\n }));\n\n return {\n spyOn(spiedPath: string, method: string = 'GET') {\n const matcher = (req: HTTPRequest) => {\n const {origin, pathname, search} = new URL(req.url());\n const pathWithParams = pathname + search;\n\n return (\n req.method() === method &&\n !!origin.match(originRegExp) &&\n matchPath(spiedPath, pathWithParams)\n );\n };\n\n const spy = jest.fn();\n\n interceptRequest(matcher).mockImplementation((req) => {\n const spyResult = spy(req);\n const status = spyResult.status ?? 200;\n const resBody = spyResult.body || spyResult;\n return {\n status,\n headers: {\n 'Access-Control-Allow-Origin': '*',\n },\n contentType: 'application/json',\n body: JSON.stringify(resBody),\n };\n });\n\n return spy;\n },\n };\n};\n\ntype CookieConfig = {\n name: string;\n value: string;\n url?: string;\n domain?: string;\n path?: string;\n secure?: boolean;\n httpOnly?: boolean;\n sameSite?: 'Strict' | 'Lax' | 'None';\n expires?: number;\n priority?: 'Low' | 'Medium' | 'High';\n sameParty?: boolean;\n sourceScheme?: 'Unset' | 'NonSecure' | 'Secure';\n sourcePort?: number;\n};\n\nexport interface TestViewport extends Viewport {\n safeAreaInset?: {\n top?: number | string;\n right?: number | string;\n bottom?: number | string;\n left?: number | string;\n };\n}\n\ninterface OpenPageCommonConfig {\n userAgent?: string;\n viewport?: TestViewport;\n isDarkMode?: boolean;\n cookies?: Array<CookieConfig>;\n}\n\ninterface OpenPageUrlConfig extends OpenPageCommonConfig {\n url: string;\n}\n\ninterface OpenPagePathConfig extends OpenPageCommonConfig {\n url?: undefined;\n\n path?: string;\n port?: number;\n protocol?: string;\n hostname?: string;\n}\n\ntype OpenPageConfig = OpenPageUrlConfig | OpenPagePathConfig;\n\nexport const openPage = async ({\n userAgent,\n isDarkMode,\n viewport,\n cookies,\n ...urlConfig\n}: OpenPageConfig): Promise<PageApi> => {\n const url = ((): string => {\n if (urlConfig.url !== undefined) {\n return urlConfig.url;\n }\n\n const {path = '/', port = serverPort, protocol = 'http', hostname = serverHostName} = urlConfig;\n\n if (!port) {\n // Error.captureStackTrace(error, openPage);\n throw new Error(\n 'You must specify a port. You can specify it when calling openPage() or by configuring a dev and ci server in the acceptanceTests config in your package.json'\n );\n }\n\n return `${protocol}://${hostname}:${port}${path}`;\n })();\n\n const currentUserAgent = userAgent || (await getGlobalBrowser().userAgent());\n const page = getGlobalPage();\n\n await page.bringToFront();\n if (viewport) {\n await page.setViewport(viewport);\n }\n if (cookies) {\n await page.setCookie(...cookies);\n }\n await page.setUserAgent(`${currentUserAgent} acceptance-test`);\n await page.emulateMediaFeatures([{name: 'prefers-color-scheme', value: isDarkMode ? 'dark' : 'light'}]);\n\n // A set of styles to make screenshot tests more reliable.\n await page.evaluateOnNewDocument((viewport?: TestViewport) => {\n const overriddenSafeAreaInsets = !viewport\n ? []\n : Object.keys(viewport?.safeAreaInset ?? {}).map((key) => {\n const position = key as 'top' | 'right' | 'bottom' | 'left';\n return `--acceptance-test-override-safe-area-inset-${key}: ${viewport?.safeAreaInset?.[position]};`;\n });\n\n const style = document.createElement('style');\n style.innerHTML = `\n *, *:after, *:before {\n transition-delay: 0s !important;\n transition-duration: 0s !important;\n animation-delay: -0.0001s !important;\n animation-duration: 0s !important;\n animation-play-state: paused !important;\n caret-color: transparent !important;\n font-variant-ligatures: none !important;\n }\n *::-webkit-scrollbar {\n display: none !important;\n width: 0 !important;\n height: 0 !important;\n }\n :root {\n ${overriddenSafeAreaInsets.join('\\n')}\n }\n `;\n window.addEventListener('DOMContentLoaded', () => {\n document.head.appendChild(style);\n });\n }, viewport);\n\n if (needsRequestInterception) {\n await page.setRequestInterception(true);\n page.on('request', requestInterceptor);\n }\n\n try {\n await page.goto(url);\n } catch (e) {\n if ((e as Error).message.includes('net::ERR_CONNECTION_REFUSED')) {\n const connectionError = new Error(`Could not connect to ${url}. Is the server running?`);\n Error.captureStackTrace(connectionError, openPage);\n throw connectionError;\n } else {\n throw e;\n }\n }\n await page.waitForFunction('document.fonts.status === \"loaded\"');\n\n return getPageApi(page);\n};\n\nconst buildQueryMethods = ({page, element}: {page?: Page; element?: ElementHandle} = {}): ReturnType<\n typeof getQueriesForElement\n> => {\n const boundQueries: any = {};\n for (const [queryName, queryFn] of Object.entries(queries)) {\n boundQueries[queryName] = async (...args: any) => {\n const doc = await getDocument(page ?? getGlobalPage());\n const body = await doc.$('body');\n const queryArgs = [...args];\n if (queryName.startsWith('findBy')) {\n if (queryArgs.length === 1) {\n queryArgs.push(undefined);\n }\n queryArgs.push({timeout: 10000});\n }\n const elementHandle: ElementHandle = await queryFn(element ?? body, ...queryArgs);\n\n const newElementHandle = Object.create(elementHandle);\n\n newElementHandle.screenshot = async (options: CustomScreenshotOptions) => {\n if (!options?.skipNetworkWait) {\n await (page ?? getGlobalPage()).waitForNetworkIdle();\n }\n await waitForPaintEnd(elementHandle, {...options, fullPage: false});\n return elementHandle.screenshot(normalizeSreenshotOptions(options));\n };\n\n newElementHandle.click = async (options?: ClickOptions) => {\n await scrollIntoView(elementHandle);\n return elementHandle.click(options);\n };\n\n newElementHandle.type = async (text: string, options?: {delay: number}) => {\n await scrollIntoView(elementHandle);\n return elementHandle.type(text, options);\n };\n\n newElementHandle.select = async (...values: Array<string>) => {\n await scrollIntoView(elementHandle);\n return elementHandle.select(...values);\n };\n\n return newElementHandle;\n };\n }\n return boundQueries;\n};\n\nexport const getScreen = (page: Page) => buildQueryMethods({page});\n\nexport const screen = buildQueryMethods();\n\nexport const within = (element: ElementHandle) => buildQueryMethods({element});\n\nexport type {ElementHandle, Viewport} from 'puppeteer';\n\nbeforeEach(async () => {\n await getGlobalPage().setRequestInterception(false);\n\n // by resetting the page we clean up all the evaluateOnNewDocument calls, which are persistent between documents\n await (global as any).jestPuppeteer.resetPage();\n});\n\nafterEach(async () => {\n await collectCoverageIfAvailable({coveragePath});\n\n try {\n const page = getGlobalPage();\n requestHandlers = [];\n needsRequestInterception = false;\n page.off('request', requestInterceptor);\n\n // clear tab, this way we clear the DOM and stop js execution or pending requests\n await page.goto('about:blank');\n } catch (e) {\n // ignore, at this point page might be destroyed\n }\n});\n\n/**\n * Returns a new path to the file that can be used by chromium in acceptance tests\n *\n * To be able to use `element.uploadFile()` in a dockerized chromium, the file must exist in the\n * host and the docker, and both sides must use the same path.\n *\n * To workaround this bug or limitation, this function prepares the file by copying it to /tmp in\n * the host and the container.\n */\nexport const prepareFile = (filepath: string): string => {\n const isLocal = !isCi;\n const isHeadless = !!process.env.HEADLESS;\n const usesDocker = isLocal && isHeadless;\n\n const dockerComposeFile = path.join(__dirname, '..', 'docker-compose.yaml');\n\n if (usesDocker) {\n const containerId = execSync(`docker-compose -f ${dockerComposeFile} ps -q`).toString().trim();\n\n if (!containerId) {\n throw Error('acceptance-testing container not found');\n }\n\n execSync(`docker cp ${filepath} ${containerId}:/tmp`);\n\n const newPath = path.join('/tmp', path.basename(filepath));\n\n fs.copyFileSync(filepath, newPath);\n\n return newPath;\n } else {\n return filepath;\n }\n};\n\n/**\n * A convenience method to defer an expectation\n */\nexport const wait = <T>(expectation: () => Promise<T> | T, timeout = 10000, interval = 50): Promise<T> => {\n const startTime = Date.now();\n const startStack = new Error().stack;\n\n return new Promise((resolve, reject) => {\n const rejectOrRerun = (error: unknown) => {\n if (Date.now() - startTime >= timeout) {\n if (error instanceof Error) {\n if (error.message === 'Element not removed') {\n error.stack = startStack;\n }\n }\n reject(error);\n return;\n }\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n setTimeout(runExpectation, interval);\n };\n const runExpectation = () => {\n try {\n Promise.resolve(expectation())\n .then((r) => resolve(r))\n .catch(rejectOrRerun);\n } catch (error) {\n rejectOrRerun(error);\n }\n };\n setTimeout(runExpectation, 0);\n });\n};\n\nexport const waitForElementToBeRemoved = (\n element: ElementHandle<Element>,\n timeout = 10000,\n interval = 100\n): Promise<void> => {\n const startStack = new Error().stack;\n\n const wait = async () => {\n const t0 = Date.now();\n while (Date.now() - t0 < timeout) {\n // boundingBox returns null when the element is not in the DOM\n const box = await element.boundingBox();\n if (!box) {\n return;\n }\n await new Promise((resolve) => setTimeout(resolve, interval));\n }\n throw new Error('Element not removed');\n };\n\n return wait().catch((error) => {\n if (error.message === 'Element not removed') {\n error.stack = startStack;\n }\n throw error;\n });\n};\n","import path from 'path';\nimport globToRegExp from 'glob-to-regexp';\n\n/**\n * Returns true if the current path matches the spied path, including parameters\n */\nexport const matchPath = (spiedPath: string, currentPath: string): boolean => {\n const normalizedCurrentPath = path.normalize(currentPath);\n const pattern = globToRegExp(spiedPath);\n return pattern.test(normalizedCurrentPath);\n};\n"],"names":["prepareCoverageReportPath","_ref","coveragePath","ppidFile","path","join","ppid","process","toString","fs","existsSync","readFileSync","rootPath","expect","getState","snapshotState","_rootDir","Error","getRootPath","cwd","normalize","startsWith","rmSync","recursive","force","mkdirSync","writeFileSync","collectCoverageIfAvailable","_ref3","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_ref2","coverage","nycOutputPath","wrap","_context","prev","next","global","page","evaluate","window","__coverage__","sent","abrupt","Object","values","forEach","cov","_JSON$stringify","hash","JSON","stringify","stop","_x","apply","arguments","getGlobalBrowser","browser","getGlobalPage","isCi","argv","includes","env","CI","isUsingDockerizedChromium","URL","wsEndpoint","port","serverHostName","platform","execSync","e","isWsl","replace","split","map","line","trim","some","match","ips","rootDir","findRoot","projectConfig","_pkg$acceptanceTests","parse","acceptanceTests","server","ciServer","devServer","_projectConfig$covera","serverPort","calledToMatchImageSnapshotOutsideDocker","extend","toMatchImageSnapshot","configureToMatchImageSnapshot","failureThreshold","failureThresholdType","customSnapshotIdentifier","defaultIdentifier","message","pass","afterEach","error","stack","waitForPaintEnd","element","_temp","_ref4","_ref4$fullPage","fullPage","captureBeyondViewport","MAX_WAIT","STEP_TIME","t0","buf1","buf2","Date","now","screenshot","normalizeSreenshotOptions","Promise","r","setTimeout","compare","_x2","_temp2","_ref5$captureBeyondVi","_ref5","_extends","_objectWithoutPropertiesLoose","_excluded","scrollIntoView","el","block","getPageApi","api","create","type","_ref6","_callee2","elementHandle","text","options","_context2","_x3","_x4","_x5","click","_ref7","_callee3","_context3","_x6","_x7","select","_ref8","_callee4","_len","_key","_args4","_context4","length","Array","_x8","_ref9","_callee5","_context5","skipNetworkWait","waitForNetworkIdle","_x9","clear","_ref10","_callee6","_context6","clickCount","press","_x10","setGeolocation","position","navigator","geolocation","getCurrentPosition","callback","coords","needsRequestInterception","requestHandlers","requestInterceptor","req","handler","_requestHandlers$find","find","_ref12","matcher","response","respond","interceptRequest","spy","jest","fn","push","openPage","_ref16","_callee7","_ref15","userAgent","isDarkMode","viewport","cookies","urlConfig","url","currentUserAgent","connectionError","_context7","_excluded2","undefined","_urlConfig$path","_urlConfig$port","_urlConfig$protocol","protocol","_urlConfig$hostname","hostname","bringToFront","setViewport","setCookie","setUserAgent","emulateMediaFeatures","name","value","evaluateOnNewDocument","overriddenSafeAreaInsets","keys","_viewport$safeAreaIns","safeAreaInset","key","_viewport$safeAreaIns2","style","document","createElement","innerHTML","addEventListener","head","appendChild","setRequestInterception","on","t1","captureStackTrace","waitForFunction","_x11","buildQueryMethods","_temp4","_ref17","boundQueries","_loop","_Object$entries$_i","_Object$entries","_i","queryName","queryFn","_callee12","doc","body","_len2","args","_key2","queryArgs","newElementHandle","_args12","_context12","getDocument","$","concat","timeout","_ref19","_callee8","_context8","_x12","_ref20","_callee9","_context9","_x13","_ref21","_callee10","_context10","_x14","_x15","_callee11","_args11","_context11","entries","queries","screen","beforeEach","_callee13","_context13","jestPuppeteer","resetPage","_callee14","_context14","off","_temp3","origin","_ref13","originRegExp","globToRegExp","_ref14","baseUrl","method","mockImplementation","status","headers","Access-Control-Allow-Origin","Access-Control-Allow-Methods","Access-Control-Allow-Headers","spyOn","spiedPath","_URL2","pathWithParams","pathname","search","currentPath","normalizedCurrentPath","test","matchPath","spyResult","_spyResult$status","contentType","filepath","isHeadless","HEADLESS","usesDocker","dockerComposeFile","__dirname","containerId","newPath","basename","copyFileSync","expectation","interval","startTime","startStack","resolve","reject","rejectOrRerun","runExpectation","then","_ref25","_callee15","_context15","boundingBox","wait"],"mappings":"u7OAKA,UAkBMA,EAA4B,SAAHC,OAAKC,EAAYD,EAAZC,aAC1BC,EAAWC,EAAKC,KAAKH,EAAc,SACnCI,EAAOC,QAAQD,KAAKE,WACrBC,EAAGC,WAAWP,IAAaM,EAAGE,aAAaR,EAAU,WAAaG,IAnBhD,WACvB,IAAMM,EAAWC,OAAOC,WAAWC,cAA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lBA,EAAMH,UACNG,EAAMC,MAAQ2O,GAEZ5O,qBAxHQ,SAACG,GAAsB,OAAK8I,EAAkB,CAAC9I,QAAAA"}
|
|
@@ -374,13 +374,13 @@ var getRootPath = function getRootPath() {
|
|
|
374
374
|
}
|
|
375
375
|
return rootPath;
|
|
376
376
|
};
|
|
377
|
-
/**
|
|
378
|
-
* We want to clear coverage files from previous runs, but at this point it is not easy because each
|
|
379
|
-
* worker runs a different instance of this script, so we can't just clear the coverage folder at
|
|
380
|
-
* the beginning of the test run.
|
|
381
|
-
*
|
|
382
|
-
* The solution is to remove the coverage folder when the stored ppid (parent process id) is
|
|
383
|
-
* different from the current one
|
|
377
|
+
/**
|
|
378
|
+
* We want to clear coverage files from previous runs, but at this point it is not easy because each
|
|
379
|
+
* worker runs a different instance of this script, so we can't just clear the coverage folder at
|
|
380
|
+
* the beginning of the test run.
|
|
381
|
+
*
|
|
382
|
+
* The solution is to remove the coverage folder when the stored ppid (parent process id) is
|
|
383
|
+
* different from the current one
|
|
384
384
|
*/
|
|
385
385
|
var prepareCoverageReportPath = function prepareCoverageReportPath(_ref) {
|
|
386
386
|
var coveragePath = _ref.coveragePath;
|
|
@@ -400,9 +400,9 @@ var prepareCoverageReportPath = function prepareCoverageReportPath(_ref) {
|
|
|
400
400
|
fs.writeFileSync(ppidFile, ppid);
|
|
401
401
|
}
|
|
402
402
|
};
|
|
403
|
-
/**
|
|
404
|
-
* Asumes the code was instrumented with istanbul and the coverage report stored in `window.__coverage__`.
|
|
405
|
-
* If not, this function does nothing.
|
|
403
|
+
/**
|
|
404
|
+
* Asumes the code was instrumented with istanbul and the coverage report stored in `window.__coverage__`.
|
|
405
|
+
* If not, this function does nothing.
|
|
406
406
|
*/
|
|
407
407
|
var collectCoverageIfAvailable = /*#__PURE__*/function () {
|
|
408
408
|
var _ref3 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref2) {
|
|
@@ -447,8 +447,8 @@ var collectCoverageIfAvailable = /*#__PURE__*/function () {
|
|
|
447
447
|
};
|
|
448
448
|
}();
|
|
449
449
|
|
|
450
|
-
/**
|
|
451
|
-
* Returns true if the current path matches the spied path, including parameters
|
|
450
|
+
/**
|
|
451
|
+
* Returns true if the current path matches the spied path, including parameters
|
|
452
452
|
*/
|
|
453
453
|
var matchPath = function matchPath(spiedPath, currentPath) {
|
|
454
454
|
var normalizedCurrentPath = path.normalize(currentPath);
|
|
@@ -1175,14 +1175,14 @@ afterEach( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().ma
|
|
|
1175
1175
|
}
|
|
1176
1176
|
}, _callee14, null, [[2, 11]]);
|
|
1177
1177
|
})));
|
|
1178
|
-
/**
|
|
1179
|
-
* Returns a new path to the file that can be used by chromium in acceptance tests
|
|
1180
|
-
*
|
|
1181
|
-
* To be able to use `element.uploadFile()` in a dockerized chromium, the file must exist in the
|
|
1182
|
-
* host and the docker, and both sides must use the same path.
|
|
1183
|
-
*
|
|
1184
|
-
* To workaround this bug or limitation, this function prepares the file by copying it to /tmp in
|
|
1185
|
-
* the host and the container.
|
|
1178
|
+
/**
|
|
1179
|
+
* Returns a new path to the file that can be used by chromium in acceptance tests
|
|
1180
|
+
*
|
|
1181
|
+
* To be able to use `element.uploadFile()` in a dockerized chromium, the file must exist in the
|
|
1182
|
+
* host and the docker, and both sides must use the same path.
|
|
1183
|
+
*
|
|
1184
|
+
* To workaround this bug or limitation, this function prepares the file by copying it to /tmp in
|
|
1185
|
+
* the host and the container.
|
|
1186
1186
|
*/
|
|
1187
1187
|
var prepareFile = function prepareFile(filepath) {
|
|
1188
1188
|
var isLocal = !isCi;
|
|
@@ -1202,8 +1202,8 @@ var prepareFile = function prepareFile(filepath) {
|
|
|
1202
1202
|
return filepath;
|
|
1203
1203
|
}
|
|
1204
1204
|
};
|
|
1205
|
-
/**
|
|
1206
|
-
* A convenience method to defer an expectation
|
|
1205
|
+
/**
|
|
1206
|
+
* A convenience method to defer an expectation
|
|
1207
1207
|
*/
|
|
1208
1208
|
var wait = function wait(expectation, timeout, interval) {
|
|
1209
1209
|
if (timeout === void 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acceptance-testing.esm.js","sources":["../src/coverage.ts","../src/utils.ts","../src/index.ts"],"sourcesContent":["import path from 'path';\nimport fs from 'fs';\n\nimport type {Page} from 'puppeteer';\n\nconst getGlobalPage = (): Page => (global as any).page;\n\nexport const getRootPath = () => {\n const rootPath = expect.getState().snapshotState._rootDir;\n if (!rootPath) {\n throw new Error('Root path not found');\n }\n return rootPath;\n};\n\n/**\n * We want to clear coverage files from previous runs, but at this point it is not easy because each\n * worker runs a different instance of this script, so we can't just clear the coverage folder at\n * the beginning of the test run.\n *\n * The solution is to remove the coverage folder when the stored ppid (parent process id) is\n * different from the current one\n */\nconst prepareCoverageReportPath = ({coveragePath}: {coveragePath: string}) => {\n const ppidFile = path.join(coveragePath, '.ppid');\n const ppid = process.ppid.toString();\n if (!fs.existsSync(ppidFile) || fs.readFileSync(ppidFile, 'utf-8') !== ppid) {\n // the condition is just to make sure we don't remove files outside the repo\n if (getRootPath() === process.cwd() && path.normalize(coveragePath).startsWith(process.cwd())) {\n fs.rmSync(coveragePath, {recursive: true, force: true});\n }\n fs.mkdirSync(coveragePath, {recursive: true});\n fs.writeFileSync(ppidFile, ppid);\n }\n};\n\n/**\n * Asumes the code was instrumented with istanbul and the coverage report stored in `window.__coverage__`.\n * If not, this function does nothing.\n */\nexport const collectCoverageIfAvailable = async ({coveragePath}: {coveragePath: string}): Promise<void> => {\n const coverage = await getGlobalPage().evaluate(() => {\n return (window as any).__coverage__;\n });\n if (!coverage) {\n return;\n }\n\n prepareCoverageReportPath({coveragePath});\n const nycOutputPath = path.join(coveragePath, '.nyc_output');\n fs.mkdirSync(nycOutputPath, {recursive: true});\n\n Object.values(coverage).forEach((cov: any) => {\n if (cov && cov.path && cov.hash) {\n fs.writeFileSync(path.join(nycOutputPath, cov.hash + '.json'), JSON.stringify({[cov.path]: cov}));\n }\n });\n};\n","import path from 'path';\nimport globToRegExp from 'glob-to-regexp';\n\n/**\n * Returns true if the current path matches the spied path, including parameters\n */\nexport const matchPath = (spiedPath: string, currentPath: string): boolean => {\n const normalizedCurrentPath = path.normalize(currentPath);\n const pattern = globToRegExp(spiedPath);\n return pattern.test(normalizedCurrentPath);\n};\n","import path from 'path';\nimport fs from 'fs';\nimport findRoot from 'find-root';\nimport {getDocument, queries} from 'pptr-testing-library';\nimport {configureToMatchImageSnapshot} from 'jest-image-snapshot';\nimport globToRegExp from 'glob-to-regexp';\nimport {execSync} from 'child_process';\nimport {collectCoverageIfAvailable} from './coverage';\nimport {matchPath} from './utils';\n\nimport type {getQueriesForElement} from 'pptr-testing-library';\nimport type {\n Browser,\n ClickOptions,\n ElementHandle,\n GeolocationOptions,\n HTTPRequest,\n Page,\n ResponseForRequest,\n ScreenshotOptions,\n Viewport,\n} from 'puppeteer';\n\ntype CustomScreenshotOptions = ScreenshotOptions & {\n skipNetworkWait?: boolean;\n};\n\nconst LINUX_DOCKER_HOST_IP = '172.17.0.1';\n\nexport const getGlobalBrowser = (): Browser => (global as any).browser;\nexport const getGlobalPage = (): Page => (global as any).page;\n\nconst isCi = process.argv.includes('--ci') || process.env.CI;\nconst isUsingDockerizedChromium = isCi || new URL(getGlobalBrowser().wsEndpoint()).port === '9223';\n\n/** Check if running inside WSL */\nconst isWsl = () => {\n if (process.platform !== 'linux') {\n return false;\n }\n try {\n return execSync('which wsl.exe').toString().startsWith('/mnt/');\n } catch (e) {\n // catched because it throws an error if wsl.exe is not found\n return false;\n }\n};\n\n/** Assumes running inside WSL */\nconst isWsl2 = () => {\n // `wsl.exe -l -v` returns something like:\n //\n // NAME STATE VERSION\n // * Ubuntu-22.04 Running 2\n // docker-desktop-data Running 2\n // docker-desktop Running 2\n // Ubuntu-20.04 Stopped 2\n return (\n execSync('wsl.exe -l -v')\n .toString()\n // null-bytes are inserted between chars in this command output (UTF-16 output?)\n .replace(/\\0/g, '')\n .split('\\n')\n .map((line) => line.trim())\n // matches a line like: \"* Ubuntu-22.04 Running 2\"\n .some((line) => !!line.match(/\\*\\s+\\S+\\s+Running\\s+2/))\n );\n};\n\n/** Assumes running inside WSL */\nconst getWslHostIp = () => {\n const ips = execSync('wsl.exe hostname -I').toString().trim().split(/\\s+/);\n\n if (ips.includes(LINUX_DOCKER_HOST_IP)) {\n // looks like a docker engine installed inside linux\n return LINUX_DOCKER_HOST_IP;\n }\n // assuming docker-desktop installed in windows\n return ips[0];\n};\n\nexport const serverHostName = ((): string => {\n if (isCi) {\n return 'localhost';\n }\n\n if (isUsingDockerizedChromium) {\n if (isWsl()) {\n if (isWsl2()) {\n return getWslHostIp();\n }\n throw new Error('WSL 1 is not supported. Please, use WSL 2.');\n }\n\n if (process.platform === 'win32') {\n throw new Error('Windows is not supported. Please, use WSL 2.');\n }\n\n return process.platform === 'linux' ? LINUX_DOCKER_HOST_IP : 'host.docker.internal';\n }\n\n return 'localhost';\n})();\n\nconst rootDir = findRoot(process.cwd());\nconst pkg = JSON.parse(fs.readFileSync(path.join(rootDir, 'package.json'), 'utf-8'));\nconst projectConfig = pkg.acceptanceTests ?? {};\nconst server = (isCi ? projectConfig.ciServer : projectConfig.devServer) ?? projectConfig.server;\nconst coveragePath = path.join(rootDir, projectConfig.coveragePath ?? 'reports/coverage-acceptance');\n\nexport const serverPort = server?.port;\n\nconst toMatchImageSnapshot = configureToMatchImageSnapshot({\n failureThreshold: 0,\n failureThresholdType: 'percent',\n customSnapshotIdentifier: ({defaultIdentifier}) => defaultIdentifier,\n});\n\nlet calledToMatchImageSnapshotOutsideDocker = false;\n\nconst localToMatchImageSnapshot = () => {\n calledToMatchImageSnapshotOutsideDocker = true;\n // let the expectation pass, then fail in afterEach. This way we allow developers to debug screenshot tests in local\n // but don't allow them to save screenshots taken outside the dockerized chromium\n return {\n message: () => '',\n pass: true,\n };\n};\n\nexpect.extend({\n toMatchImageSnapshot: isUsingDockerizedChromium ? toMatchImageSnapshot : localToMatchImageSnapshot,\n});\n\nafterEach(() => {\n if (calledToMatchImageSnapshotOutsideDocker) {\n const error = new Error(\n `Calling .toMatchImageSnapshot() is not allowed outside dockerized browser. Please, run your screenshot test in headless mode.`\n );\n error.stack = (error.stack || '').split('\\n')[0];\n throw error;\n }\n});\n\ntype WaitForPaintEndOptions = {\n fullPage?: boolean;\n captureBeyondViewport?: boolean;\n};\n\nconst waitForPaintEnd = async (\n element: ElementHandle | Page,\n {fullPage = true, captureBeyondViewport}: WaitForPaintEndOptions = {}\n) => {\n const MAX_WAIT = 15000;\n const STEP_TIME = 250;\n const t0 = Date.now();\n\n let buf1 = (await element.screenshot(\n normalizeSreenshotOptions({fullPage, captureBeyondViewport})\n )) as Buffer;\n await new Promise((r) => setTimeout(r, STEP_TIME));\n let buf2 = (await element.screenshot(\n normalizeSreenshotOptions({fullPage, captureBeyondViewport})\n )) as Buffer;\n\n // buffers are different if compare != 0\n while (buf1.compare(buf2)) {\n if (Date.now() - t0 > MAX_WAIT) {\n throw Error('Paint end timeout');\n }\n buf1 = buf2;\n await new Promise((r) => setTimeout(r, STEP_TIME));\n buf2 = (await element.screenshot(\n normalizeSreenshotOptions({fullPage, captureBeyondViewport})\n )) as Buffer;\n }\n};\n\nexport interface PageApi extends Omit<Page, 'click' | 'type' | 'select'> {\n clear: (selector: ElementHandle) => Promise<void>;\n // These are overridden:\n type: (selector: ElementHandle, text: string, options?: {delay: number}) => Promise<void>;\n click: (selector: ElementHandle, options?: ClickOptions) => Promise<void>;\n select: (selector: ElementHandle, ...values: string[]) => Promise<string[]>;\n screenshot: (options?: CustomScreenshotOptions) => Promise<Buffer | string | void>;\n}\n\nconst normalizeSreenshotOptions = ({captureBeyondViewport = false, ...options}: ScreenshotOptions = {}) => {\n // Puppeter default for captureBeyondViewport is true, but we think false is a better default.\n // When this is true, the fixed elements (like fixed footers) are relative to the original page\n // viewport, not to the full page, so those elements look weird in fullPage screenshots.\n return {...options, captureBeyondViewport};\n};\n\n// Puppeteer already calls scrollIntoViewIfNeeded before clicking an element. But it doesn't work in all situations\n// For example, when there is a fixed footer in the page and the element to click is under it, the browser won't scroll\n// because the element is already in the viewport (the ifNeeded part is important here). By forcing the scroll to the\n// center, we manage to fix these edge cases.\nconst scrollIntoView = (el: ElementHandle) => el.evaluate((e) => e.scrollIntoView({block: 'center'}));\n\nexport const getPageApi = (page: Page): PageApi => {\n const api: PageApi = Object.create(page);\n\n api.type = async (elementHandle, text, options) => {\n await scrollIntoView(elementHandle);\n return elementHandle.type(text, options);\n };\n api.click = async (elementHandle, options) => {\n await scrollIntoView(elementHandle);\n return elementHandle.click(options);\n };\n api.select = async (elementHandle, ...values) => {\n await scrollIntoView(elementHandle);\n return elementHandle.select(...values);\n };\n\n api.screenshot = async (options?: CustomScreenshotOptions) => {\n if (!options?.skipNetworkWait) {\n await page.waitForNetworkIdle();\n }\n await waitForPaintEnd(page, options);\n return page.screenshot(normalizeSreenshotOptions(options));\n };\n\n api.clear = async (elementHandle) => {\n await elementHandle.click({clickCount: 3});\n await elementHandle.press('Delete');\n };\n\n // For some reason, puppeteer browserContext.overridePermissions doesn't work with newer chrome versions.\n // This workaround polyfills the browser geolocation api to return the mocked position\n api.setGeolocation = (position: GeolocationOptions) =>\n page.evaluate((position) => {\n window.navigator.geolocation.getCurrentPosition = (callback) => {\n // @ts-expect-error - puppeteer's setGeoLocation does not expect a timestamp to be passed\n callback({\n coords: position,\n });\n };\n }, position as any);\n\n return api;\n};\n\nlet needsRequestInterception = false;\ntype RequestMatcherFn = (req: HTTPRequest) => boolean;\nlet requestHandlers: Array<{\n matcher: RequestMatcherFn;\n handler: jest.Mock<any, any>;\n}> = [];\n\nconst requestInterceptor = (req: HTTPRequest) => {\n const {handler} = requestHandlers.find(({matcher}) => matcher(req)) ?? {handler: null};\n if (!handler) {\n req.continue();\n return;\n }\n const response = handler(req);\n req.respond(response);\n};\n\nexport const interceptRequest = (\n matcher: RequestMatcherFn\n): jest.Mock<Partial<ResponseForRequest>, [HTTPRequest]> => {\n needsRequestInterception = true;\n const spy = jest.fn();\n requestHandlers.push({matcher, handler: spy});\n return spy;\n};\n\ntype ApiEndpointMock = {\n spyOn(path: string, method?: string): jest.Mock<unknown, [HTTPRequest]>;\n};\n\nexport const createApiEndpointMock = ({\n /** defaults to any origin */\n origin,\n baseUrl,\n}: {\n origin?: string;\n /** @deprecated use origin */\n baseUrl?: string;\n} = {}): ApiEndpointMock => {\n const originRegExp = globToRegExp(origin ?? baseUrl ?? '*');\n\n interceptRequest((req) => {\n const {origin} = new URL(req.url());\n return req.method() === 'OPTIONS' && !!origin.match(originRegExp);\n }).mockImplementation(() => ({\n status: 204,\n headers: {\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'POST,PATCH,PUT,GET,OPTIONS,DELETE',\n 'Access-Control-Allow-Headers': '*',\n },\n }));\n\n return {\n spyOn(spiedPath: string, method: string = 'GET') {\n const matcher = (req: HTTPRequest) => {\n const {origin, pathname, search} = new URL(req.url());\n const pathWithParams = pathname + search;\n\n return (\n req.method() === method &&\n !!origin.match(originRegExp) &&\n matchPath(spiedPath, pathWithParams)\n );\n };\n\n const spy = jest.fn();\n\n interceptRequest(matcher).mockImplementation((req) => {\n const spyResult = spy(req);\n const status = spyResult.status ?? 200;\n const resBody = spyResult.body || spyResult;\n return {\n status,\n headers: {\n 'Access-Control-Allow-Origin': '*',\n },\n contentType: 'application/json',\n body: JSON.stringify(resBody),\n };\n });\n\n return spy;\n },\n };\n};\n\ntype CookieConfig = {\n name: string;\n value: string;\n url?: string;\n domain?: string;\n path?: string;\n secure?: boolean;\n httpOnly?: boolean;\n sameSite?: 'Strict' | 'Lax' | 'None';\n expires?: number;\n priority?: 'Low' | 'Medium' | 'High';\n sameParty?: boolean;\n sourceScheme?: 'Unset' | 'NonSecure' | 'Secure';\n sourcePort?: number;\n};\n\nexport interface TestViewport extends Viewport {\n safeAreaInset?: {\n top?: number | string;\n right?: number | string;\n bottom?: number | string;\n left?: number | string;\n };\n}\n\ninterface OpenPageCommonConfig {\n userAgent?: string;\n viewport?: TestViewport;\n isDarkMode?: boolean;\n cookies?: Array<CookieConfig>;\n}\n\ninterface OpenPageUrlConfig extends OpenPageCommonConfig {\n url: string;\n}\n\ninterface OpenPagePathConfig extends OpenPageCommonConfig {\n url?: undefined;\n\n path?: string;\n port?: number;\n protocol?: string;\n hostname?: string;\n}\n\ntype OpenPageConfig = OpenPageUrlConfig | OpenPagePathConfig;\n\nexport const openPage = async ({\n userAgent,\n isDarkMode,\n viewport,\n cookies,\n ...urlConfig\n}: OpenPageConfig): Promise<PageApi> => {\n const url = ((): string => {\n if (urlConfig.url !== undefined) {\n return urlConfig.url;\n }\n\n const {path = '/', port = serverPort, protocol = 'http', hostname = serverHostName} = urlConfig;\n\n if (!port) {\n // Error.captureStackTrace(error, openPage);\n throw new Error(\n 'You must specify a port. You can specify it when calling openPage() or by configuring a dev and ci server in the acceptanceTests config in your package.json'\n );\n }\n\n return `${protocol}://${hostname}:${port}${path}`;\n })();\n\n const currentUserAgent = userAgent || (await getGlobalBrowser().userAgent());\n const page = getGlobalPage();\n\n await page.bringToFront();\n if (viewport) {\n await page.setViewport(viewport);\n }\n if (cookies) {\n await page.setCookie(...cookies);\n }\n await page.setUserAgent(`${currentUserAgent} acceptance-test`);\n await page.emulateMediaFeatures([{name: 'prefers-color-scheme', value: isDarkMode ? 'dark' : 'light'}]);\n\n // A set of styles to make screenshot tests more reliable.\n await page.evaluateOnNewDocument((viewport: TestViewport) => {\n const overriddenSafeAreaInsets = !viewport\n ? []\n : Object.keys(viewport?.safeAreaInset ?? {}).map((key) => {\n const position = key as 'top' | 'right' | 'bottom' | 'left';\n return `--acceptance-test-override-safe-area-inset-${key}: ${viewport?.safeAreaInset?.[position]};`;\n });\n\n const style = document.createElement('style');\n style.innerHTML = `\n *, *:after, *:before {\n transition-delay: 0s !important;\n transition-duration: 0s !important;\n animation-delay: -0.0001s !important;\n animation-duration: 0s !important;\n animation-play-state: paused !important;\n caret-color: transparent !important;\n font-variant-ligatures: none !important;\n }\n *::-webkit-scrollbar {\n display: none !important;\n width: 0 !important;\n height: 0 !important;\n }\n :root {\n ${overriddenSafeAreaInsets.join('\\n')}\n }\n `;\n window.addEventListener('DOMContentLoaded', () => {\n document.head.appendChild(style);\n });\n }, viewport);\n\n if (needsRequestInterception) {\n await page.setRequestInterception(true);\n page.on('request', requestInterceptor);\n }\n\n try {\n await page.goto(url);\n } catch (e) {\n if ((e as Error).message.includes('net::ERR_CONNECTION_REFUSED')) {\n const connectionError = new Error(`Could not connect to ${url}. Is the server running?`);\n Error.captureStackTrace(connectionError, openPage);\n throw connectionError;\n } else {\n throw e;\n }\n }\n await page.waitForFunction('document.fonts.status === \"loaded\"');\n\n return getPageApi(page);\n};\n\nconst buildQueryMethods = ({page, element}: {page?: Page; element?: ElementHandle} = {}): ReturnType<\n typeof getQueriesForElement\n> => {\n const boundQueries: any = {};\n for (const [queryName, queryFn] of Object.entries(queries)) {\n boundQueries[queryName] = async (...args: any) => {\n const doc = await getDocument(page ?? getGlobalPage());\n const body = await doc.$('body');\n const queryArgs = [...args];\n if (queryName.startsWith('findBy')) {\n if (queryArgs.length === 1) {\n queryArgs.push(undefined);\n }\n queryArgs.push({timeout: 10000});\n }\n const elementHandle: ElementHandle = await queryFn(element ?? body, ...queryArgs);\n\n const newElementHandle = Object.create(elementHandle);\n\n newElementHandle.screenshot = async (options: CustomScreenshotOptions) => {\n if (!options?.skipNetworkWait) {\n await (page ?? getGlobalPage()).waitForNetworkIdle();\n }\n await waitForPaintEnd(elementHandle, {...options, fullPage: false});\n return elementHandle.screenshot(normalizeSreenshotOptions(options));\n };\n\n newElementHandle.click = async (options?: ClickOptions) => {\n await scrollIntoView(elementHandle);\n return elementHandle.click(options);\n };\n\n newElementHandle.type = async (text: string, options?: {delay: number}) => {\n await scrollIntoView(elementHandle);\n return elementHandle.type(text, options);\n };\n\n newElementHandle.select = async (...values: Array<string>) => {\n await scrollIntoView(elementHandle);\n return elementHandle.select(...values);\n };\n\n return newElementHandle;\n };\n }\n return boundQueries;\n};\n\nexport const getScreen = (page: Page) => buildQueryMethods({page});\n\nexport const screen = buildQueryMethods();\n\nexport const within = (element: ElementHandle) => buildQueryMethods({element});\n\nexport type {ElementHandle, Viewport} from 'puppeteer';\n\nbeforeEach(async () => {\n await getGlobalPage().setRequestInterception(false);\n\n // by resetting the page we clean up all the evaluateOnNewDocument calls, which are persistent between documents\n await (global as any).jestPuppeteer.resetPage();\n});\n\nafterEach(async () => {\n await collectCoverageIfAvailable({coveragePath});\n\n try {\n const page = getGlobalPage();\n requestHandlers = [];\n needsRequestInterception = false;\n page.off('request', requestInterceptor);\n\n // clear tab, this way we clear the DOM and stop js execution or pending requests\n await page.goto('about:blank');\n } catch (e) {\n // ignore, at this point page might be destroyed\n }\n});\n\n/**\n * Returns a new path to the file that can be used by chromium in acceptance tests\n *\n * To be able to use `element.uploadFile()` in a dockerized chromium, the file must exist in the\n * host and the docker, and both sides must use the same path.\n *\n * To workaround this bug or limitation, this function prepares the file by copying it to /tmp in\n * the host and the container.\n */\nexport const prepareFile = (filepath: string): string => {\n const isLocal = !isCi;\n const isHeadless = !!process.env.HEADLESS;\n const usesDocker = isLocal && isHeadless;\n\n const dockerComposeFile = path.join(__dirname, '..', 'docker-compose.yaml');\n\n if (usesDocker) {\n const containerId = execSync(`docker-compose -f ${dockerComposeFile} ps -q`).toString().trim();\n\n if (!containerId) {\n throw Error('acceptance-testing container not found');\n }\n\n execSync(`docker cp ${filepath} ${containerId}:/tmp`);\n\n const newPath = path.join('/tmp', path.basename(filepath));\n\n fs.copyFileSync(filepath, newPath);\n\n return newPath;\n } else {\n return filepath;\n }\n};\n\n/**\n * A convenience method to defer an expectation\n */\nexport const wait = <T>(expectation: () => Promise<T> | T, timeout = 10000, interval = 50): Promise<T> => {\n const startTime = Date.now();\n const startStack = new Error().stack;\n\n return new Promise((resolve, reject) => {\n const rejectOrRerun = (error: unknown) => {\n if (Date.now() - startTime >= timeout) {\n if (error instanceof Error) {\n if (error.message === 'Element not removed') {\n error.stack = startStack;\n }\n }\n reject(error);\n return;\n }\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n setTimeout(runExpectation, interval);\n };\n const runExpectation = () => {\n try {\n Promise.resolve(expectation())\n .then((r) => resolve(r))\n .catch(rejectOrRerun);\n } catch (error) {\n rejectOrRerun(error);\n }\n };\n setTimeout(runExpectation, 0);\n });\n};\n\nexport const waitForElementToBeRemoved = (\n element: ElementHandle<Element>,\n timeout = 10000,\n interval = 100\n): Promise<void> => {\n const startStack = new Error().stack;\n\n const wait = async () => {\n const t0 = Date.now();\n while (Date.now() - t0 < timeout) {\n // boundingBox returns null when the element is not in the DOM\n const box = await element.boundingBox();\n if (!box) {\n return;\n }\n await new Promise((resolve) => setTimeout(resolve, interval));\n }\n throw new Error('Element not removed');\n };\n\n return wait().catch((error) => {\n if (error.message === 'Element not removed') {\n error.stack = startStack;\n }\n throw error;\n });\n};\n"],"names":["getGlobalPage","global","page","getRootPath","rootPath","expect","getState","snapshotState","_rootDir","Error","prepareCoverageReportPath","_ref","coveragePath","ppidFile","path","join","ppid","process","toString","fs","existsSync","readFileSync","cwd","normalize","startsWith","rmSync","recursive","force","mkdirSync","writeFileSync","collectCoverageIfAvailable","_ref3","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_ref2","coverage","nycOutputPath","wrap","_callee$","_context","prev","next","evaluate","window","__coverage__","sent","abrupt","Object","values","forEach","cov","hash","_JSON$stringify","JSON","stringify","stop","_x","apply","arguments","matchPath","spiedPath","currentPath","normalizedCurrentPath","pattern","globToRegExp","test","LINUX_DOCKER_HOST_IP","getGlobalBrowser","browser","isCi","argv","includes","env","CI","isUsingDockerizedChromium","URL","wsEndpoint","port","isWsl","platform","execSync","e","isWsl2","replace","split","map","line","trim","some","match","getWslHostIp","ips","serverHostName","rootDir","findRoot","pkg","parse","projectConfig","_pkg$acceptanceTests","acceptanceTests","server","ciServer","devServer","_projectConfig$covera","serverPort","toMatchImageSnapshot","configureToMatchImageSnapshot","failureThreshold","failureThresholdType","customSnapshotIdentifier","defaultIdentifier","calledToMatchImageSnapshotOutsideDocker","localToMatchImageSnapshot","message","pass","extend","afterEach","error","stack","waitForPaintEnd","element","_temp","_ref4","_ref4$fullPage","fullPage","captureBeyondViewport","MAX_WAIT","STEP_TIME","t0","buf1","buf2","Date","now","screenshot","normalizeSreenshotOptions","Promise","r","setTimeout","compare","_x2","_temp2","_ref5$captureBeyondVi","_ref5","options","_objectWithoutPropertiesLoose","_excluded","_extends","scrollIntoView","el","block","getPageApi","api","create","type","_ref6","_callee2","elementHandle","text","_callee2$","_context2","_x3","_x4","_x5","click","_ref7","_callee3","_callee3$","_context3","_x6","_x7","select","_ref8","_callee4","_len","_key","_args4","_callee4$","_context4","length","Array","_x8","_ref9","_callee5","_callee5$","_context5","skipNetworkWait","waitForNetworkIdle","_x9","clear","_ref10","_callee6","_callee6$","_context6","clickCount","press","_x10","setGeolocation","position","navigator","geolocation","getCurrentPosition","callback","coords","needsRequestInterception","requestHandlers","requestInterceptor","req","_ref11","_requestHandlers$find","find","_ref12","matcher","handler","response","respond","interceptRequest","spy","jest","fn","push","createApiEndpointMock","_temp3","origin","_ref13","baseUrl","originRegExp","_ref14","_URL","url","method","mockImplementation","status","headers","spyOn","_URL2","pathname","search","pathWithParams","spyResult","_spyResult$status","resBody","body","contentType","openPage","_ref16","_callee7","_ref15","userAgent","isDarkMode","viewport","cookies","urlConfig","currentUserAgent","connectionError","_callee7$","_context7","_excluded2","undefined","_urlConfig$path","_urlConfig$port","_urlConfig$protocol","protocol","_urlConfig$hostname","hostname","bringToFront","setViewport","setCookie","setUserAgent","emulateMediaFeatures","name","value","evaluateOnNewDocument","overriddenSafeAreaInsets","keys","_viewport$safeAreaIns","safeAreaInset","key","_viewport$safeAreaIns2","style","document","createElement","innerHTML","addEventListener","head","appendChild","setRequestInterception","on","t1","captureStackTrace","waitForFunction","_x11","buildQueryMethods","_temp4","_ref17","boundQueries","_loop","_Object$entries$_i","_Object$entries","_i","queryName","queryFn","_callee12","doc","_len2","args","_key2","queryArgs","newElementHandle","_args12","_callee12$","_context12","getDocument","$","concat","timeout","_ref19","_callee8","_callee8$","_context8","_x12","_ref20","_callee9","_callee9$","_context9","_x13","_ref21","_callee10","_callee10$","_context10","_x14","_x15","_callee11","_args11","_callee11$","_context11","entries","queries","getScreen","screen","within","beforeEach","_callee13","_callee13$","_context13","jestPuppeteer","resetPage","_callee14","_callee14$","_context14","off","prepareFile","filepath","isLocal","isHeadless","HEADLESS","usesDocker","dockerComposeFile","__dirname","containerId","newPath","basename","copyFileSync","wait","expectation","interval","startTime","startStack","resolve","reject","rejectOrRerun","runExpectation","then","waitForElementToBeRemoved","_ref25","_callee15","box","_callee15$","_context15","boundingBox"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA;EAAA,OAAgBC,MAAc,CAACC,IAAI;AAAA;AAE/C,IAAMC,WAAW,GAAG,SAAdA,WAAWA;EACpB,IAAMC,QAAQ,GAAGC,MAAM,CAACC,QAAQ,EAAE,CAACC,aAAa,CAACC,QAAQ;EACzD,IAAI,CAACJ,QAAQ,EAAE;IACX,MAAM,IAAIK,KAAK,CAAC,qBAAqB,CAAC;;EA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utils.ts","../src/index.ts"],"sourcesContent":["import path from 'path';\nimport fs from 'fs';\n\nimport type {Page} from 'puppeteer';\n\nconst getGlobalPage = (): Page => (global as any).page;\n\nexport const getRootPath = () => {\n const rootPath = expect.getState().snapshotState._rootDir;\n if (!rootPath) {\n throw new Error('Root path not found');\n }\n return rootPath;\n};\n\n/**\n * We want to clear coverage files from previous runs, but at this point it is not easy because each\n * worker runs a different instance of this script, so we can't just clear the coverage folder at\n * the beginning of the test run.\n *\n * The solution is to remove the coverage folder when the stored ppid (parent process id) is\n * different from the current one\n */\nconst prepareCoverageReportPath = ({coveragePath}: {coveragePath: string}) => {\n const ppidFile = path.join(coveragePath, '.ppid');\n const ppid = process.ppid.toString();\n if (!fs.existsSync(ppidFile) || fs.readFileSync(ppidFile, 'utf-8') !== ppid) {\n // the condition is just to make sure we don't remove files outside the repo\n if (getRootPath() === process.cwd() && path.normalize(coveragePath).startsWith(process.cwd())) {\n fs.rmSync(coveragePath, {recursive: true, force: true});\n }\n fs.mkdirSync(coveragePath, {recursive: true});\n fs.writeFileSync(ppidFile, ppid);\n }\n};\n\n/**\n * Asumes the code was instrumented with istanbul and the coverage report stored in `window.__coverage__`.\n * If not, this function does nothing.\n */\nexport const collectCoverageIfAvailable = async ({coveragePath}: {coveragePath: string}): Promise<void> => {\n const coverage = await getGlobalPage().evaluate(() => {\n return (window as any).__coverage__;\n });\n if (!coverage) {\n return;\n }\n\n prepareCoverageReportPath({coveragePath});\n const nycOutputPath = path.join(coveragePath, '.nyc_output');\n fs.mkdirSync(nycOutputPath, {recursive: true});\n\n Object.values(coverage).forEach((cov: any) => {\n if (cov && cov.path && cov.hash) {\n fs.writeFileSync(path.join(nycOutputPath, cov.hash + '.json'), JSON.stringify({[cov.path]: cov}));\n }\n });\n};\n","import path from 'path';\nimport globToRegExp from 'glob-to-regexp';\n\n/**\n * Returns true if the current path matches the spied path, including parameters\n */\nexport const matchPath = (spiedPath: string, currentPath: string): boolean => {\n const normalizedCurrentPath = path.normalize(currentPath);\n const pattern = globToRegExp(spiedPath);\n return pattern.test(normalizedCurrentPath);\n};\n","import path from 'path';\nimport fs from 'fs';\nimport findRoot from 'find-root';\nimport {getDocument, queries} from 'pptr-testing-library';\nimport {configureToMatchImageSnapshot} from 'jest-image-snapshot';\nimport globToRegExp from 'glob-to-regexp';\nimport {execSync} from 'child_process';\nimport {collectCoverageIfAvailable} from './coverage';\nimport {matchPath} from './utils';\n\nimport type {getQueriesForElement} from 'pptr-testing-library';\nimport type {\n Browser,\n ClickOptions,\n ElementHandle,\n GeolocationOptions,\n HTTPRequest,\n Page,\n ResponseForRequest,\n ScreenshotOptions,\n Viewport,\n} from 'puppeteer';\n\ntype CustomScreenshotOptions = ScreenshotOptions & {\n skipNetworkWait?: boolean;\n};\n\nconst LINUX_DOCKER_HOST_IP = '172.17.0.1';\n\nexport const getGlobalBrowser = (): Browser => (global as any).browser;\nexport const getGlobalPage = (): Page => (global as any).page;\n\nconst isCi = process.argv.includes('--ci') || process.env.CI;\nconst isUsingDockerizedChromium = isCi || new URL(getGlobalBrowser().wsEndpoint()).port === '9223';\n\n/** Check if running inside WSL */\nconst isWsl = () => {\n if (process.platform !== 'linux') {\n return false;\n }\n try {\n return execSync('which wsl.exe').toString().startsWith('/mnt/');\n } catch (e) {\n // catched because it throws an error if wsl.exe is not found\n return false;\n }\n};\n\n/** Assumes running inside WSL */\nconst isWsl2 = () => {\n // `wsl.exe -l -v` returns something like:\n //\n // NAME STATE VERSION\n // * Ubuntu-22.04 Running 2\n // docker-desktop-data Running 2\n // docker-desktop Running 2\n // Ubuntu-20.04 Stopped 2\n return (\n execSync('wsl.exe -l -v')\n .toString()\n // null-bytes are inserted between chars in this command output (UTF-16 output?)\n .replace(/\\0/g, '')\n .split('\\n')\n .map((line) => line.trim())\n // matches a line like: \"* Ubuntu-22.04 Running 2\"\n .some((line) => !!line.match(/\\*\\s+\\S+\\s+Running\\s+2/))\n );\n};\n\n/** Assumes running inside WSL */\nconst getWslHostIp = () => {\n const ips = execSync('wsl.exe hostname -I').toString().trim().split(/\\s+/);\n\n if (ips.includes(LINUX_DOCKER_HOST_IP)) {\n // looks like a docker engine installed inside linux\n return LINUX_DOCKER_HOST_IP;\n }\n // assuming docker-desktop installed in windows\n return ips[0];\n};\n\nexport const serverHostName = ((): string => {\n if (isCi) {\n return 'localhost';\n }\n\n if (isUsingDockerizedChromium) {\n if (isWsl()) {\n if (isWsl2()) {\n return getWslHostIp();\n }\n throw new Error('WSL 1 is not supported. Please, use WSL 2.');\n }\n\n if (process.platform === 'win32') {\n throw new Error('Windows is not supported. Please, use WSL 2.');\n }\n\n return process.platform === 'linux' ? LINUX_DOCKER_HOST_IP : 'host.docker.internal';\n }\n\n return 'localhost';\n})();\n\nconst rootDir = findRoot(process.cwd());\nconst pkg = JSON.parse(fs.readFileSync(path.join(rootDir, 'package.json'), 'utf-8'));\nconst projectConfig = pkg.acceptanceTests ?? {};\nconst server = (isCi ? projectConfig.ciServer : projectConfig.devServer) ?? projectConfig.server;\nconst coveragePath = path.join(rootDir, projectConfig.coveragePath ?? 'reports/coverage-acceptance');\n\nexport const serverPort = server?.port;\n\nconst toMatchImageSnapshot = configureToMatchImageSnapshot({\n failureThreshold: 0,\n failureThresholdType: 'percent',\n customSnapshotIdentifier: ({defaultIdentifier}) => defaultIdentifier,\n});\n\nlet calledToMatchImageSnapshotOutsideDocker = false;\n\nconst localToMatchImageSnapshot = () => {\n calledToMatchImageSnapshotOutsideDocker = true;\n // let the expectation pass, then fail in afterEach. This way we allow developers to debug screenshot tests in local\n // but don't allow them to save screenshots taken outside the dockerized chromium\n return {\n message: () => '',\n pass: true,\n };\n};\n\nexpect.extend({\n toMatchImageSnapshot: isUsingDockerizedChromium ? toMatchImageSnapshot : localToMatchImageSnapshot,\n});\n\nafterEach(() => {\n if (calledToMatchImageSnapshotOutsideDocker) {\n const error = new Error(\n `Calling .toMatchImageSnapshot() is not allowed outside dockerized browser. Please, run your screenshot test in headless mode.`\n );\n error.stack = (error.stack || '').split('\\n')[0];\n throw error;\n }\n});\n\ntype WaitForPaintEndOptions = {\n fullPage?: boolean;\n captureBeyondViewport?: boolean;\n};\n\nconst waitForPaintEnd = async (\n element: ElementHandle | Page,\n {fullPage = true, captureBeyondViewport}: WaitForPaintEndOptions = {}\n) => {\n const MAX_WAIT = 15000;\n const STEP_TIME = 250;\n const t0 = Date.now();\n\n let buf1 = (await element.screenshot(\n normalizeSreenshotOptions({fullPage, captureBeyondViewport})\n )) as Buffer;\n await new Promise((r) => setTimeout(r, STEP_TIME));\n let buf2 = (await element.screenshot(\n normalizeSreenshotOptions({fullPage, captureBeyondViewport})\n )) as Buffer;\n\n // buffers are different if compare != 0\n while (buf1.compare(buf2)) {\n if (Date.now() - t0 > MAX_WAIT) {\n throw Error('Paint end timeout');\n }\n buf1 = buf2;\n await new Promise((r) => setTimeout(r, STEP_TIME));\n buf2 = (await element.screenshot(\n normalizeSreenshotOptions({fullPage, captureBeyondViewport})\n )) as Buffer;\n }\n};\n\nexport interface PageApi extends Omit<Page, 'click' | 'type' | 'select' | 'screenshot'> {\n clear: (selector: ElementHandle) => Promise<void>;\n // These are overridden:\n type: (selector: ElementHandle, text: string, options?: {delay: number}) => Promise<void>;\n click: (selector: ElementHandle, options?: ClickOptions) => Promise<void>;\n select: (selector: ElementHandle, ...values: string[]) => Promise<string[]>;\n screenshot: (options?: CustomScreenshotOptions) => Promise<Buffer>;\n}\n\nconst normalizeSreenshotOptions = ({captureBeyondViewport = false, ...options}: ScreenshotOptions = {}) => {\n // Puppeter default for captureBeyondViewport is true, but we think false is a better default.\n // When this is true, the fixed elements (like fixed footers) are relative to the original page\n // viewport, not to the full page, so those elements look weird in fullPage screenshots.\n return {...options, captureBeyondViewport};\n};\n\n// Puppeteer already calls scrollIntoViewIfNeeded before clicking an element. But it doesn't work in all situations\n// For example, when there is a fixed footer in the page and the element to click is under it, the browser won't scroll\n// because the element is already in the viewport (the ifNeeded part is important here). By forcing the scroll to the\n// center, we manage to fix these edge cases.\nconst scrollIntoView = (el: ElementHandle) => el.evaluate((e) => e.scrollIntoView({block: 'center'}));\n\nexport const getPageApi = (page: Page): PageApi => {\n const api: PageApi = Object.create(page);\n\n api.type = async (elementHandle, text, options) => {\n await scrollIntoView(elementHandle);\n return elementHandle.type(text, options);\n };\n api.click = async (elementHandle, options) => {\n await scrollIntoView(elementHandle);\n return elementHandle.click(options);\n };\n api.select = async (elementHandle, ...values) => {\n await scrollIntoView(elementHandle);\n return elementHandle.select(...values);\n };\n\n api.screenshot = async (options?: CustomScreenshotOptions) => {\n if (!options?.skipNetworkWait) {\n await page.waitForNetworkIdle();\n }\n await waitForPaintEnd(page, options);\n return page.screenshot(normalizeSreenshotOptions(options));\n };\n\n api.clear = async (elementHandle) => {\n await elementHandle.click({clickCount: 3});\n await elementHandle.press('Delete');\n };\n\n // For some reason, puppeteer browserContext.overridePermissions doesn't work with newer chrome versions.\n // This workaround polyfills the browser geolocation api to return the mocked position\n api.setGeolocation = (position: GeolocationOptions) =>\n page.evaluate((position) => {\n window.navigator.geolocation.getCurrentPosition = (callback) => {\n // @ts-expect-error - puppeteer's setGeoLocation does not expect a timestamp to be passed\n callback({\n coords: position,\n });\n };\n }, position as any);\n\n return api;\n};\n\nlet needsRequestInterception = false;\ntype RequestMatcherFn = (req: HTTPRequest) => boolean;\nlet requestHandlers: Array<{\n matcher: RequestMatcherFn;\n handler: jest.Mock<any, any>;\n}> = [];\n\nconst requestInterceptor = (req: HTTPRequest) => {\n const {handler} = requestHandlers.find(({matcher}) => matcher(req)) ?? {\n handler: null,\n };\n if (!handler) {\n req.continue();\n return;\n }\n const response = handler(req);\n req.respond(response);\n};\n\nexport const interceptRequest = (\n matcher: RequestMatcherFn\n): jest.Mock<Partial<ResponseForRequest>, [HTTPRequest]> => {\n needsRequestInterception = true;\n const spy = jest.fn();\n requestHandlers.push({matcher, handler: spy});\n return spy;\n};\n\ntype ApiEndpointMock = {\n spyOn(path: string, method?: string): jest.Mock<unknown, [HTTPRequest]>;\n};\n\nexport const createApiEndpointMock = ({\n /** defaults to any origin */\n origin,\n baseUrl,\n}: {\n origin?: string;\n /** @deprecated use origin */\n baseUrl?: string;\n} = {}): ApiEndpointMock => {\n const originRegExp = globToRegExp(origin ?? baseUrl ?? '*');\n\n interceptRequest((req) => {\n const {origin} = new URL(req.url());\n return req.method() === 'OPTIONS' && !!origin.match(originRegExp);\n }).mockImplementation(() => ({\n status: 204,\n headers: {\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'POST,PATCH,PUT,GET,OPTIONS,DELETE',\n 'Access-Control-Allow-Headers': '*',\n },\n }));\n\n return {\n spyOn(spiedPath: string, method: string = 'GET') {\n const matcher = (req: HTTPRequest) => {\n const {origin, pathname, search} = new URL(req.url());\n const pathWithParams = pathname + search;\n\n return (\n req.method() === method &&\n !!origin.match(originRegExp) &&\n matchPath(spiedPath, pathWithParams)\n );\n };\n\n const spy = jest.fn();\n\n interceptRequest(matcher).mockImplementation((req) => {\n const spyResult = spy(req);\n const status = spyResult.status ?? 200;\n const resBody = spyResult.body || spyResult;\n return {\n status,\n headers: {\n 'Access-Control-Allow-Origin': '*',\n },\n contentType: 'application/json',\n body: JSON.stringify(resBody),\n };\n });\n\n return spy;\n },\n };\n};\n\ntype CookieConfig = {\n name: string;\n value: string;\n url?: string;\n domain?: string;\n path?: string;\n secure?: boolean;\n httpOnly?: boolean;\n sameSite?: 'Strict' | 'Lax' | 'None';\n expires?: number;\n priority?: 'Low' | 'Medium' | 'High';\n sameParty?: boolean;\n sourceScheme?: 'Unset' | 'NonSecure' | 'Secure';\n sourcePort?: number;\n};\n\nexport interface TestViewport extends Viewport {\n safeAreaInset?: {\n top?: number | string;\n right?: number | string;\n bottom?: number | string;\n left?: number | string;\n };\n}\n\ninterface OpenPageCommonConfig {\n userAgent?: string;\n viewport?: TestViewport;\n isDarkMode?: boolean;\n cookies?: Array<CookieConfig>;\n}\n\ninterface OpenPageUrlConfig extends OpenPageCommonConfig {\n url: string;\n}\n\ninterface OpenPagePathConfig extends OpenPageCommonConfig {\n url?: undefined;\n\n path?: string;\n port?: number;\n protocol?: string;\n hostname?: string;\n}\n\ntype OpenPageConfig = OpenPageUrlConfig | OpenPagePathConfig;\n\nexport const openPage = async ({\n userAgent,\n isDarkMode,\n viewport,\n cookies,\n ...urlConfig\n}: OpenPageConfig): Promise<PageApi> => {\n const url = ((): string => {\n if (urlConfig.url !== undefined) {\n return urlConfig.url;\n }\n\n const {path = '/', port = serverPort, protocol = 'http', hostname = serverHostName} = urlConfig;\n\n if (!port) {\n // Error.captureStackTrace(error, openPage);\n throw new Error(\n 'You must specify a port. You can specify it when calling openPage() or by configuring a dev and ci server in the acceptanceTests config in your package.json'\n );\n }\n\n return `${protocol}://${hostname}:${port}${path}`;\n })();\n\n const currentUserAgent = userAgent || (await getGlobalBrowser().userAgent());\n const page = getGlobalPage();\n\n await page.bringToFront();\n if (viewport) {\n await page.setViewport(viewport);\n }\n if (cookies) {\n await page.setCookie(...cookies);\n }\n await page.setUserAgent(`${currentUserAgent} acceptance-test`);\n await page.emulateMediaFeatures([{name: 'prefers-color-scheme', value: isDarkMode ? 'dark' : 'light'}]);\n\n // A set of styles to make screenshot tests more reliable.\n await page.evaluateOnNewDocument((viewport?: TestViewport) => {\n const overriddenSafeAreaInsets = !viewport\n ? []\n : Object.keys(viewport?.safeAreaInset ?? {}).map((key) => {\n const position = key as 'top' | 'right' | 'bottom' | 'left';\n return `--acceptance-test-override-safe-area-inset-${key}: ${viewport?.safeAreaInset?.[position]};`;\n });\n\n const style = document.createElement('style');\n style.innerHTML = `\n *, *:after, *:before {\n transition-delay: 0s !important;\n transition-duration: 0s !important;\n animation-delay: -0.0001s !important;\n animation-duration: 0s !important;\n animation-play-state: paused !important;\n caret-color: transparent !important;\n font-variant-ligatures: none !important;\n }\n *::-webkit-scrollbar {\n display: none !important;\n width: 0 !important;\n height: 0 !important;\n }\n :root {\n ${overriddenSafeAreaInsets.join('\\n')}\n }\n `;\n window.addEventListener('DOMContentLoaded', () => {\n document.head.appendChild(style);\n });\n }, viewport);\n\n if (needsRequestInterception) {\n await page.setRequestInterception(true);\n page.on('request', requestInterceptor);\n }\n\n try {\n await page.goto(url);\n } catch (e) {\n if ((e as Error).message.includes('net::ERR_CONNECTION_REFUSED')) {\n const connectionError = new Error(`Could not connect to ${url}. Is the server running?`);\n Error.captureStackTrace(connectionError, openPage);\n throw connectionError;\n } else {\n throw e;\n }\n }\n await page.waitForFunction('document.fonts.status === \"loaded\"');\n\n return getPageApi(page);\n};\n\nconst buildQueryMethods = ({page, element}: {page?: Page; element?: ElementHandle} = {}): ReturnType<\n typeof getQueriesForElement\n> => {\n const boundQueries: any = {};\n for (const [queryName, queryFn] of Object.entries(queries)) {\n boundQueries[queryName] = async (...args: any) => {\n const doc = await getDocument(page ?? getGlobalPage());\n const body = await doc.$('body');\n const queryArgs = [...args];\n if (queryName.startsWith('findBy')) {\n if (queryArgs.length === 1) {\n queryArgs.push(undefined);\n }\n queryArgs.push({timeout: 10000});\n }\n const elementHandle: ElementHandle = await queryFn(element ?? body, ...queryArgs);\n\n const newElementHandle = Object.create(elementHandle);\n\n newElementHandle.screenshot = async (options: CustomScreenshotOptions) => {\n if (!options?.skipNetworkWait) {\n await (page ?? getGlobalPage()).waitForNetworkIdle();\n }\n await waitForPaintEnd(elementHandle, {...options, fullPage: false});\n return elementHandle.screenshot(normalizeSreenshotOptions(options));\n };\n\n newElementHandle.click = async (options?: ClickOptions) => {\n await scrollIntoView(elementHandle);\n return elementHandle.click(options);\n };\n\n newElementHandle.type = async (text: string, options?: {delay: number}) => {\n await scrollIntoView(elementHandle);\n return elementHandle.type(text, options);\n };\n\n newElementHandle.select = async (...values: Array<string>) => {\n await scrollIntoView(elementHandle);\n return elementHandle.select(...values);\n };\n\n return newElementHandle;\n };\n }\n return boundQueries;\n};\n\nexport const getScreen = (page: Page) => buildQueryMethods({page});\n\nexport const screen = buildQueryMethods();\n\nexport const within = (element: ElementHandle) => buildQueryMethods({element});\n\nexport type {ElementHandle, Viewport} from 'puppeteer';\n\nbeforeEach(async () => {\n await getGlobalPage().setRequestInterception(false);\n\n // by resetting the page we clean up all the evaluateOnNewDocument calls, which are persistent between documents\n await (global as any).jestPuppeteer.resetPage();\n});\n\nafterEach(async () => {\n await collectCoverageIfAvailable({coveragePath});\n\n try {\n const page = getGlobalPage();\n requestHandlers = [];\n needsRequestInterception = false;\n page.off('request', requestInterceptor);\n\n // clear tab, this way we clear the DOM and stop js execution or pending requests\n await page.goto('about:blank');\n } catch (e) {\n // ignore, at this point page might be destroyed\n }\n});\n\n/**\n * Returns a new path to the file that can be used by chromium in acceptance tests\n *\n * To be able to use `element.uploadFile()` in a dockerized chromium, the file must exist in the\n * host and the docker, and both sides must use the same path.\n *\n * To workaround this bug or limitation, this function prepares the file by copying it to /tmp in\n * the host and the container.\n */\nexport const prepareFile = (filepath: string): string => {\n const isLocal = !isCi;\n const isHeadless = !!process.env.HEADLESS;\n const usesDocker = isLocal && isHeadless;\n\n const dockerComposeFile = path.join(__dirname, '..', 'docker-compose.yaml');\n\n if (usesDocker) {\n const containerId = execSync(`docker-compose -f ${dockerComposeFile} ps -q`).toString().trim();\n\n if (!containerId) {\n throw Error('acceptance-testing container not found');\n }\n\n execSync(`docker cp ${filepath} ${containerId}:/tmp`);\n\n const newPath = path.join('/tmp', path.basename(filepath));\n\n fs.copyFileSync(filepath, newPath);\n\n return newPath;\n } else {\n return filepath;\n }\n};\n\n/**\n * A convenience method to defer an expectation\n */\nexport const wait = <T>(expectation: () => Promise<T> | T, timeout = 10000, interval = 50): Promise<T> => {\n const startTime = Date.now();\n const startStack = new Error().stack;\n\n return new Promise((resolve, reject) => {\n const rejectOrRerun = (error: unknown) => {\n if (Date.now() - startTime >= timeout) {\n if (error instanceof Error) {\n if (error.message === 'Element not removed') {\n error.stack = startStack;\n }\n }\n reject(error);\n return;\n }\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n setTimeout(runExpectation, interval);\n };\n const runExpectation = () => {\n try {\n Promise.resolve(expectation())\n .then((r) => resolve(r))\n .catch(rejectOrRerun);\n } catch (error) {\n rejectOrRerun(error);\n }\n };\n setTimeout(runExpectation, 0);\n });\n};\n\nexport const waitForElementToBeRemoved = (\n element: ElementHandle<Element>,\n timeout = 10000,\n interval = 100\n): Promise<void> => {\n const startStack = new Error().stack;\n\n const wait = async () => {\n const t0 = Date.now();\n while (Date.now() - t0 < timeout) {\n // boundingBox returns null when the element is not in the DOM\n const box = await element.boundingBox();\n if (!box) {\n return;\n }\n await new Promise((resolve) => setTimeout(resolve, interval));\n }\n throw new Error('Element not removed');\n };\n\n return wait().catch((error) => {\n if (error.message === 'Element not removed') {\n error.stack = startStack;\n }\n throw error;\n });\n};\n"],"names":["getGlobalPage","global","page","getRootPath","rootPath","expect","getState","snapshotState","_rootDir","Error","prepareCoverageReportPath","_ref","coveragePath","ppidFile","path","join","ppid","process","toString","fs","existsSync","readFileSync","cwd","normalize","startsWith","rmSync","recursive","force","mkdirSync","writeFileSync","collectCoverageIfAvailable","_ref3","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_ref2","coverage","nycOutputPath","wrap","_callee$","_context","prev","next","evaluate","window","__coverage__","sent","abrupt","Object","values","forEach","cov","hash","_JSON$stringify","JSON","stringify","stop","_x","apply","arguments","matchPath","spiedPath","currentPath","normalizedCurrentPath","pattern","globToRegExp","test","LINUX_DOCKER_HOST_IP","getGlobalBrowser","browser","isCi","argv","includes","env","CI","isUsingDockerizedChromium","URL","wsEndpoint","port","isWsl","platform","execSync","e","isWsl2","replace","split","map","line","trim","some","match","getWslHostIp","ips","serverHostName","rootDir","findRoot","pkg","parse","projectConfig","_pkg$acceptanceTests","acceptanceTests","server","ciServer","devServer","_projectConfig$covera","serverPort","toMatchImageSnapshot","configureToMatchImageSnapshot","failureThreshold","failureThresholdType","customSnapshotIdentifier","defaultIdentifier","calledToMatchImageSnapshotOutsideDocker","localToMatchImageSnapshot","message","pass","extend","afterEach","error","stack","waitForPaintEnd","element","_temp","_ref4","_ref4$fullPage","fullPage","captureBeyondViewport","MAX_WAIT","STEP_TIME","t0","buf1","buf2","Date","now","screenshot","normalizeSreenshotOptions","Promise","r","setTimeout","compare","_x2","_temp2","_ref5$captureBeyondVi","_ref5","options","_objectWithoutPropertiesLoose","_excluded","_extends","scrollIntoView","el","block","getPageApi","api","create","type","_ref6","_callee2","elementHandle","text","_callee2$","_context2","_x3","_x4","_x5","click","_ref7","_callee3","_callee3$","_context3","_x6","_x7","select","_ref8","_callee4","_len","_key","_args4","_callee4$","_context4","length","Array","_x8","_ref9","_callee5","_callee5$","_context5","skipNetworkWait","waitForNetworkIdle","_x9","clear","_ref10","_callee6","_callee6$","_context6","clickCount","press","_x10","setGeolocation","position","navigator","geolocation","getCurrentPosition","callback","coords","needsRequestInterception","requestHandlers","requestInterceptor","req","_ref11","_requestHandlers$find","find","_ref12","matcher","handler","response","respond","interceptRequest","spy","jest","fn","push","createApiEndpointMock","_temp3","origin","_ref13","baseUrl","originRegExp","_ref14","_URL","url","method","mockImplementation","status","headers","spyOn","_URL2","pathname","search","pathWithParams","spyResult","_spyResult$status","resBody","body","contentType","openPage","_ref16","_callee7","_ref15","userAgent","isDarkMode","viewport","cookies","urlConfig","currentUserAgent","connectionError","_callee7$","_context7","_excluded2","undefined","_urlConfig$path","_urlConfig$port","_urlConfig$protocol","protocol","_urlConfig$hostname","hostname","bringToFront","setViewport","setCookie","setUserAgent","emulateMediaFeatures","name","value","evaluateOnNewDocument","overriddenSafeAreaInsets","keys","_viewport$safeAreaIns","safeAreaInset","key","_viewport$safeAreaIns2","style","document","createElement","innerHTML","addEventListener","head","appendChild","setRequestInterception","on","t1","captureStackTrace","waitForFunction","_x11","buildQueryMethods","_temp4","_ref17","boundQueries","_loop","_Object$entries$_i","_Object$entries","_i","queryName","queryFn","_callee12","doc","_len2","args","_key2","queryArgs","newElementHandle","_args12","_callee12$","_context12","getDocument","$","concat","timeout","_ref19","_callee8","_callee8$","_context8","_x12","_ref20","_callee9","_callee9$","_context9","_x13","_ref21","_callee10","_callee10$","_context10","_x14","_x15","_callee11","_args11","_callee11$","_context11","entries","queries","getScreen","screen","within","beforeEach","_callee13","_callee13$","_context13","jestPuppeteer","resetPage","_callee14","_callee14$","_context14","off","prepareFile","filepath","isLocal","isHeadless","HEADLESS","usesDocker","dockerComposeFile","__dirname","containerId","newPath","basename","copyFileSync","wait","expectation","interval","startTime","startStack","resolve","reject","rejectOrRerun","runExpectation","then","waitForElementToBeRemoved","_ref25","_callee15","box","_callee15$","_context15","boundingBox"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA;EAAA,OAAgBC,MAAc,CAACC,IAAI;AAAA;AAE/C,IAAMC,WAAW,GAAG,SAAdA,WAAWA;EACpB,IAAMC,QAAQ,GAAGC,MAAM,CAACC,QAAQ,EAAE,CAACC,aAAa,CAACC,QAAQ;EACzD,IAAI,CAACJ,QAAQ,EAAE;IACX,MAAM,IAAIK,KAAK,CAAC,qBAAqB,CAAC;;EAE1C,OAAOL,QAAQ;AACnB,CAAC;AAED;;;;;;;;AAQA,IAAMM,yBAAyB,GAAG,SAA5BA,yBAAyBA,CAAAC,IAAA;MAAKC,YAAY,GAAAD,IAAA,CAAZC,YAAY;EAC5C,IAAMC,Q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AC,UAAA;QAAA,kBAAAA,UAAA,CAAAjV,IAAA,GAAAiV,UAAA,CAAAhV,IAAA;UAAA;YACHuF,EAAE,GAAGG,IAAI,CAACC,GAAG,EAAE;UAAA;YAAA,MACdD,IAAI,CAACC,GAAG,EAAE,GAAGJ,EAAE,GAAG0L,OAAO;cAAA+D,UAAA,CAAAhV,IAAA;cAAA;;YAAAgV,UAAA,CAAAhV,IAAA;YAAA,OAEV+E,OAAO,CAACkQ,WAAW,EAAE;UAAA;YAAjCH,GAAG,GAAAE,UAAA,CAAA5U,IAAA;YAAA,IACJ0U,GAAG;cAAAE,UAAA,CAAAhV,IAAA;cAAA;;YAAA,OAAAgV,UAAA,CAAA3U,MAAA;UAAA;YAAA2U,UAAA,CAAAhV,IAAA;YAAA,OAGF,IAAI8F,OAAO,CAAC,UAACwO,OAAO;cAAA,OAAKtO,UAAU,CAACsO,OAAO,EAAEH,QAAQ,CAAC;cAAC;UAAA;YAAAa,UAAA,CAAAhV,IAAA;YAAA;UAAA;YAAA,MAE3D,IAAIlC,KAAK,CAAC,qBAAqB,CAAC;UAAA;UAAA;YAAA,OAAAkX,UAAA,CAAAlU,IAAA;;SAAA+T,SAAA;KACzC;IAAA,gBAXKZ,IAAIA;MAAA,OAAAW,MAAA,CAAA5T,KAAA,OAAAC,SAAA;;KAWT;EAED,OAAOgT,IAAI,EAAE,SAAM,CAAC,UAACrP,KAAK;IACtB,IAAIA,KAAK,CAACJ,OAAO,KAAK,qBAAqB,EAAE;MACzCI,KAAK,CAACC,KAAK,GAAGwP,UAAU;;IAE5B,MAAMzP,KAAK;GACd,CAAC;AACN,CAAC;;;;"}
|
package/dist/coverage.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export declare const getRootPath: () => any;
|
|
2
|
-
/**
|
|
3
|
-
* Asumes the code was instrumented with istanbul and the coverage report stored in `window.__coverage__`.
|
|
4
|
-
* If not, this function does nothing.
|
|
5
|
-
*/
|
|
6
|
-
export declare const collectCoverageIfAvailable: ({ coveragePath }: {
|
|
7
|
-
coveragePath: string;
|
|
8
|
-
}) => Promise<void>;
|
|
1
|
+
export declare const getRootPath: () => any;
|
|
2
|
+
/**
|
|
3
|
+
* Asumes the code was instrumented with istanbul and the coverage report stored in `window.__coverage__`.
|
|
4
|
+
* If not, this function does nothing.
|
|
5
|
+
*/
|
|
6
|
+
export declare const collectCoverageIfAvailable: ({ coveragePath }: {
|
|
7
|
+
coveragePath: string;
|
|
8
|
+
}) => Promise<void>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,91 +1,92 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="jest" />
|
|
3
|
-
/// <reference types="jest
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
declare
|
|
23
|
-
|
|
24
|
-
declare
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
export declare const
|
|
74
|
-
export declare const
|
|
75
|
-
export declare const
|
|
76
|
-
export
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
export declare const
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="jest" />
|
|
3
|
+
/// <reference types="jest" />
|
|
4
|
+
/// <reference types="jest-image-snapshot" />
|
|
5
|
+
import type { Browser, ClickOptions, ElementHandle, HTTPRequest, Page, ResponseForRequest, ScreenshotOptions, Viewport } from 'puppeteer';
|
|
6
|
+
type CustomScreenshotOptions = ScreenshotOptions & {
|
|
7
|
+
skipNetworkWait?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const getGlobalBrowser: () => Browser;
|
|
10
|
+
export declare const getGlobalPage: () => Page;
|
|
11
|
+
export declare const serverHostName: string;
|
|
12
|
+
export declare const serverPort: any;
|
|
13
|
+
export interface PageApi extends Omit<Page, 'click' | 'type' | 'select' | 'screenshot'> {
|
|
14
|
+
clear: (selector: ElementHandle) => Promise<void>;
|
|
15
|
+
type: (selector: ElementHandle, text: string, options?: {
|
|
16
|
+
delay: number;
|
|
17
|
+
}) => Promise<void>;
|
|
18
|
+
click: (selector: ElementHandle, options?: ClickOptions) => Promise<void>;
|
|
19
|
+
select: (selector: ElementHandle, ...values: string[]) => Promise<string[]>;
|
|
20
|
+
screenshot: (options?: CustomScreenshotOptions) => Promise<Buffer>;
|
|
21
|
+
}
|
|
22
|
+
export declare const getPageApi: (page: Page) => PageApi;
|
|
23
|
+
type RequestMatcherFn = (req: HTTPRequest) => boolean;
|
|
24
|
+
export declare const interceptRequest: (matcher: RequestMatcherFn) => jest.Mock<Partial<ResponseForRequest>, [HTTPRequest]>;
|
|
25
|
+
type ApiEndpointMock = {
|
|
26
|
+
spyOn(path: string, method?: string): jest.Mock<unknown, [HTTPRequest]>;
|
|
27
|
+
};
|
|
28
|
+
export declare const createApiEndpointMock: ({ origin, baseUrl, }?: {
|
|
29
|
+
origin?: string;
|
|
30
|
+
/** @deprecated use origin */
|
|
31
|
+
baseUrl?: string;
|
|
32
|
+
}) => ApiEndpointMock;
|
|
33
|
+
type CookieConfig = {
|
|
34
|
+
name: string;
|
|
35
|
+
value: string;
|
|
36
|
+
url?: string;
|
|
37
|
+
domain?: string;
|
|
38
|
+
path?: string;
|
|
39
|
+
secure?: boolean;
|
|
40
|
+
httpOnly?: boolean;
|
|
41
|
+
sameSite?: 'Strict' | 'Lax' | 'None';
|
|
42
|
+
expires?: number;
|
|
43
|
+
priority?: 'Low' | 'Medium' | 'High';
|
|
44
|
+
sameParty?: boolean;
|
|
45
|
+
sourceScheme?: 'Unset' | 'NonSecure' | 'Secure';
|
|
46
|
+
sourcePort?: number;
|
|
47
|
+
};
|
|
48
|
+
export interface TestViewport extends Viewport {
|
|
49
|
+
safeAreaInset?: {
|
|
50
|
+
top?: number | string;
|
|
51
|
+
right?: number | string;
|
|
52
|
+
bottom?: number | string;
|
|
53
|
+
left?: number | string;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
interface OpenPageCommonConfig {
|
|
57
|
+
userAgent?: string;
|
|
58
|
+
viewport?: TestViewport;
|
|
59
|
+
isDarkMode?: boolean;
|
|
60
|
+
cookies?: Array<CookieConfig>;
|
|
61
|
+
}
|
|
62
|
+
interface OpenPageUrlConfig extends OpenPageCommonConfig {
|
|
63
|
+
url: string;
|
|
64
|
+
}
|
|
65
|
+
interface OpenPagePathConfig extends OpenPageCommonConfig {
|
|
66
|
+
url?: undefined;
|
|
67
|
+
path?: string;
|
|
68
|
+
port?: number;
|
|
69
|
+
protocol?: string;
|
|
70
|
+
hostname?: string;
|
|
71
|
+
}
|
|
72
|
+
type OpenPageConfig = OpenPageUrlConfig | OpenPagePathConfig;
|
|
73
|
+
export declare const openPage: ({ userAgent, isDarkMode, viewport, cookies, ...urlConfig }: OpenPageConfig) => Promise<PageApi>;
|
|
74
|
+
export declare const getScreen: (page: Page) => import("pptr-testing-library/dist/typedefs").IQueryUtils & import("pptr-testing-library/dist/typedefs").IScopedQueryUtils;
|
|
75
|
+
export declare const screen: import("pptr-testing-library/dist/typedefs").IQueryUtils & import("pptr-testing-library/dist/typedefs").IScopedQueryUtils;
|
|
76
|
+
export declare const within: (element: ElementHandle) => import("pptr-testing-library/dist/typedefs").IQueryUtils & import("pptr-testing-library/dist/typedefs").IScopedQueryUtils;
|
|
77
|
+
export type { ElementHandle, Viewport } from 'puppeteer';
|
|
78
|
+
/**
|
|
79
|
+
* Returns a new path to the file that can be used by chromium in acceptance tests
|
|
80
|
+
*
|
|
81
|
+
* To be able to use `element.uploadFile()` in a dockerized chromium, the file must exist in the
|
|
82
|
+
* host and the docker, and both sides must use the same path.
|
|
83
|
+
*
|
|
84
|
+
* To workaround this bug or limitation, this function prepares the file by copying it to /tmp in
|
|
85
|
+
* the host and the container.
|
|
86
|
+
*/
|
|
87
|
+
export declare const prepareFile: (filepath: string) => string;
|
|
88
|
+
/**
|
|
89
|
+
* A convenience method to defer an expectation
|
|
90
|
+
*/
|
|
91
|
+
export declare const wait: <T>(expectation: () => Promise<T> | T, timeout?: number, interval?: number) => Promise<T>;
|
|
92
|
+
export declare const waitForElementToBeRemoved: (element: ElementHandle<Element>, timeout?: number, interval?: number) => Promise<void>;
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns true if the current path matches the spied path, including parameters
|
|
3
|
-
*/
|
|
4
|
-
export declare const matchPath: (spiedPath: string, currentPath: string) => boolean;
|
|
1
|
+
/**
|
|
2
|
+
* Returns true if the current path matches the spied path, including parameters
|
|
3
|
+
*/
|
|
4
|
+
export declare const matchPath: (spiedPath: string, currentPath: string) => boolean;
|
package/docker-compose.yaml
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telefonica/acceptance-testing",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-beta0",
|
|
4
4
|
"author": "Telefonica",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"module": "dist/acceptance-testing.esm.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"jest-puppeteer-config.js"
|
|
17
17
|
],
|
|
18
18
|
"engines": {
|
|
19
|
-
"node": ">=
|
|
19
|
+
"node": ">=20"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
22
|
"start": "tsdx watch",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"babel-jest": "^29.7.0",
|
|
35
35
|
"tsdx": "^0.14.1",
|
|
36
36
|
"tslib": "^2.3.1",
|
|
37
|
-
"typescript": "^
|
|
37
|
+
"typescript": "^5.4.5"
|
|
38
38
|
},
|
|
39
39
|
"repository": "git@github.com:Telefonica/js-toolbox.git",
|
|
40
40
|
"publishConfig": {
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"glob-to-regexp": "^0.4.1",
|
|
48
48
|
"jest-image-snapshot": "^4.5.1",
|
|
49
49
|
"node-fetch": "^2.6.5",
|
|
50
|
-
"pptr-testing-library": "^0.
|
|
51
|
-
"puppeteer": "^
|
|
50
|
+
"pptr-testing-library": "^0.8.0",
|
|
51
|
+
"puppeteer": "^22.8.0"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"jest": ">=26",
|