@telefonica/acceptance-testing 2.18.1 → 2.19.0
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/README.md +28 -5
- package/dist/acceptance-testing.cjs.development.js +108 -19
- package/dist/acceptance-testing.cjs.development.js.map +1 -1
- package/dist/acceptance-testing.cjs.production.min.js +1 -1
- package/dist/acceptance-testing.cjs.production.min.js.map +1 -1
- package/dist/acceptance-testing.esm.js +106 -17
- package/dist/acceptance-testing.esm.js.map +1 -1
- package/dist/coverage.d.ts +8 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acceptance-testing.cjs.production.min.js","sources":["../src/index.ts"],"sourcesContent":["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';\nconst execSync = require('child_process').execSync;\n\nimport type {\n Page,\n ElementHandle,\n ScreenshotOptions,\n Browser,\n ClickOptions,\n Viewport,\n GeolocationOptions,\n HTTPRequest,\n ResponseForRequest,\n} from 'puppeteer';\nimport type {getQueriesForElement} from 'pptr-testing-library';\n\ntype CustomScreenshotOptions = ScreenshotOptions & {\n skipNetworkWait?: boolean;\n};\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\nexport const serverHostName = ((): string => {\n if (isCi) {\n return 'localhost';\n }\n\n if (isUsingDockerizedChromium) {\n return process.platform === 'linux' ? '172.17.0.1' : '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;\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-ignore\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 = ({baseUrl}: {baseUrl: string}): ApiEndpointMock => {\n interceptRequest((req) => req.method() === 'OPTIONS' && req.url().startsWith(baseUrl)).mockImplementation(\n () => ({\n status: 204,\n headers: {\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'POST,PATCH,PUT,GET,OPTIONS',\n 'Access-Control-Allow-Headers': '*',\n },\n })\n );\n\n return {\n spyOn(path: string, method: string = 'GET') {\n const matcher = (req: HTTPRequest) => {\n const url = req.url();\n const urlPath = url.substring(baseUrl.length);\n return (\n req.method() === method && url.startsWith(baseUrl) && !!urlPath.match(globToRegExp(path))\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\ninterface OpenPageCommonConfig {\n userAgent?: string;\n viewport?: Viewport;\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 const error = 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 // Error.captureStackTrace(error, openPage);\n throw error;\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(() => {\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 `;\n window.addEventListener('DOMContentLoaded', () => {\n document.head.appendChild(style);\n });\n });\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 // 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 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":["execSync","require","getGlobalBrowser","global","browser","getGlobalPage","page","isCi","process","argv","includes","env","CI","isUsingDockerizedChromium","URL","wsEndpoint","port","serverHostName","platform","projectConfig","_pkg$acceptanceTests","JSON","parse","fs","readFileSync","path","join","findRoot","cwd","acceptanceTests","server","_ref","ciServer","devServer","serverPort","calledToMatchImageSnapshotOutsideDocker","expect","extend","toMatchImageSnapshot","configureToMatchImageSnapshot","failureThreshold","failureThresholdType","customSnapshotIdentifier","_ref2","defaultIdentifier","message","pass","afterEach","error","Error","stack","split","waitForPaintEnd","_ref3","_asyncToGenerator","_regeneratorRuntime","mark","_callee","element","_temp","_ref4","_ref4$fullPage","fullPage","captureBeyondViewport","MAX_WAIT","STEP_TIME","t0","buf1","buf2","wrap","_context","prev","next","Date","now","screenshot","normalizeSreenshotOptions","sent","Promise","r","setTimeout","compare","stop","_x","_x2","apply","arguments","_temp2","_ref5$captureBeyondVi","_ref5","_extends","_objectWithoutPropertiesLoose","_excluded","scrollIntoView","el","evaluate","e","block","getPageApi","api","Object","create","type","_ref6","_callee2","elementHandle","text","options","_context2","abrupt","_x3","_x4","_x5","click","_ref7","_callee3","_context3","_x6","_x7","select","_ref8","_callee4","_len","values","_key","_args4","_context4","length","Array","_x8","_ref9","_callee5","_context5","skipNetworkWait","waitForNetworkIdle","_x9","clear","_ref10","_callee6","_context6","clickCount","press","_x10","setGeolocation","position","window","navigator","geolocation","getCurrentPosition","callback","coords","needsRequestInterception","requestHandlers","requestInterceptor","req","handler","_requestHandlers$find","find","_ref12","matcher","response","respond","interceptRequest","spy","jest","fn","push","openPage","_ref15","_callee7","_ref14","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","style","document","createElement","innerHTML","addEventListener","head","appendChild","setRequestInterception","on","t1","captureStackTrace","waitForFunction","_x11","buildQueryMethods","_temp3","_ref16","boundQueries","_loop","_Object$entries$_i","_Object$entries","_i","queryName","queryFn","_callee12","doc","body","_len2","args","_key2","queryArgs","newElementHandle","_args12","_context12","getDocument","$","concat","startsWith","timeout","_ref18","_callee8","_context8","_x12","_ref19","_callee9","_context9","_x13","_ref20","_callee10","_context10","_x14","_x15","_callee11","_args11","_context11","entries","queries","screen","beforeEach","_callee13","_context13","jestPuppeteer","resetPage","_callee14","_context14","off","_ref13","baseUrl","method","mockImplementation","status","headers","Access-Control-Allow-Origin","Access-Control-Allow-Methods","Access-Control-Allow-Headers","spyOn","urlPath","substring","match","globToRegExp","spyResult","_spyResult$status","contentType","stringify","filepath","isHeadless","HEADLESS","usesDocker","dockerComposeFile","__dirname","containerId","toString","trim","newPath","basename","copyFileSync","expectation","interval","startTime","startStack","resolve","reject","rejectOrRerun","runExpectation","then","_ref24","_callee15","_context15","boundingBox","wait"],"mappings":"k/OAMMA,EAAWC,QAAQ,iBAAiBD,SAmB7BE,EAAmB,WAAH,OAAmBC,OAAeC,SAClDC,EAAgB,WAAH,O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AAIvB,MAAM,uBAAsB,QAAA,UAAA,OAAA6P,EAAA5N,UAAA2N,OACzC,kBAXS,OAAAD,EAAAvN,WAAAC,cAaH0N,UAAa,SAAChQ,GAIjB,KAHsB,wBAAlBA,EAAMH,UACNG,EAAME,MAAQoP,GAEZtP,qBArHQ,SAACU,GAAsB,OAAKuJ,EAAkB,CAACvJ,QAAAA"}
|
|
1
|
+
{"version":3,"file":"acceptance-testing.cjs.production.min.js","sources":["../src/coverage.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 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';\n\nimport type {\n Page,\n ElementHandle,\n ScreenshotOptions,\n Browser,\n ClickOptions,\n Viewport,\n GeolocationOptions,\n HTTPRequest,\n ResponseForRequest,\n} from 'puppeteer';\nimport type {getQueriesForElement} from 'pptr-testing-library';\n\ntype CustomScreenshotOptions = ScreenshotOptions & {\n skipNetworkWait?: boolean;\n};\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\nexport const serverHostName = ((): string => {\n if (isCi) {\n return 'localhost';\n }\n\n if (isUsingDockerizedChromium) {\n return process.platform === 'linux' ? '172.17.0.1' : '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-ignore\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 = ({baseUrl}: {baseUrl: string}): ApiEndpointMock => {\n interceptRequest((req) => req.method() === 'OPTIONS' && req.url().startsWith(baseUrl)).mockImplementation(\n () => ({\n status: 204,\n headers: {\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'POST,PATCH,PUT,GET,OPTIONS',\n 'Access-Control-Allow-Headers': '*',\n },\n })\n );\n\n return {\n spyOn(path: string, method: string = 'GET') {\n const matcher = (req: HTTPRequest) => {\n const url = req.url();\n const urlPath = url.substring(baseUrl.length);\n return (\n req.method() === method && url.startsWith(baseUrl) && !!urlPath.match(globToRegExp(path))\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\ninterface OpenPageCommonConfig {\n userAgent?: string;\n viewport?: Viewport;\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 const error = 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 // Error.captureStackTrace(error, openPage);\n throw error;\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(() => {\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 `;\n window.addEventListener('DOMContentLoaded', () => {\n document.head.appendChild(style);\n });\n });\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":["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","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","split","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","e","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","_ref15","_callee7","_ref14","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","style","document","createElement","innerHTML","addEventListener","head","appendChild","setRequestInterception","on","t1","captureStackTrace","waitForFunction","_x11","buildQueryMethods","_temp3","_ref16","boundQueries","_loop","_Object$entries$_i","_Object$entries","_i","queryName","queryFn","_callee12","doc","body","_len2","args","_key2","queryArgs","newElementHandle","_args12","_context12","getDocument","$","concat","timeout","_ref18","_callee8","_context8","_x12","_ref19","_callee9","_context9","_x13","_ref20","_callee10","_context10","_x14","_x15","_callee11","_args11","_context11","entries","queries","screen","beforeEach","_callee13","_context13","jestPuppeteer","resetPage","_callee14","_context14","off","_ref13","baseUrl","method","mockImplementation","status","headers","Access-Control-Allow-Origin","Access-Control-Allow-Methods","Access-Control-Allow-Headers","spyOn","urlPath","substring","match","globToRegExp","spyResult","_spyResult$status","contentType","filepath","isHeadless","HEADLESS","usesDocker","dockerComposeFile","__dirname","containerId","execSync","trim","newPath","basename","copyFileSync","expectation","interval","startTime","startStack","resolve","reject","rejectOrRerun","runExpectation","then","_ref24","_callee15","_context15","boundingBox","wait"],"mappings":"u7OAKA,UAkBMA,EAA4B,SAAHC,OAAKC,EAAYD,EAAZC,aAC1BC,EAAWC,EAAKC,KAAKH,EAAc,SACnCI,EA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R,EAAAhS,OAAA,MAAA,OAAAgS,EAAAzR,iBAAA,OAAA,OAAAyR,EAAAhS,OAGF,IAAI2E,SAAQ,SAAC8M,GAAO,OAAK5M,WAAW4M,EAASH,MAAU,OAAAU,EAAAhS,OAAA,MAAA,QAAA,MAE3D,IAAItB,MAAM,uBAAsB,QAAA,UAAA,OAAAsT,EAAAhR,UAAA+Q,OACzC,kBAXS,OAAAD,EAAA5Q,WAAAC,cAaH+Q,UAAa,SAAC1O,GAIjB,KAHsB,wBAAlBA,EAAMH,UACNG,EAAMC,MAAQ+N,GAEZhO,qBAxHQ,SAACI,GAAsB,OAAKyI,EAAkB,CAACzI,QAAAA"}
|
|
@@ -4,6 +4,7 @@ import findRoot from 'find-root';
|
|
|
4
4
|
import { queries, getDocument } from 'pptr-testing-library';
|
|
5
5
|
import { configureToMatchImageSnapshot } from 'jest-image-snapshot';
|
|
6
6
|
import globToRegExp from 'glob-to-regexp';
|
|
7
|
+
import { execSync } from 'child_process';
|
|
7
8
|
|
|
8
9
|
function _regeneratorRuntime() {
|
|
9
10
|
_regeneratorRuntime = function () {
|
|
@@ -363,14 +364,96 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
363
364
|
return target;
|
|
364
365
|
}
|
|
365
366
|
|
|
367
|
+
var getGlobalPage = function getGlobalPage() {
|
|
368
|
+
return global.page;
|
|
369
|
+
};
|
|
370
|
+
var getRootPath = function getRootPath() {
|
|
371
|
+
var rootPath = expect.getState().snapshotState._rootDir;
|
|
372
|
+
if (!rootPath) {
|
|
373
|
+
throw new Error('Root path not found');
|
|
374
|
+
}
|
|
375
|
+
return rootPath;
|
|
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
|
|
384
|
+
*/
|
|
385
|
+
var prepareCoverageReportPath = function prepareCoverageReportPath(_ref) {
|
|
386
|
+
var coveragePath = _ref.coveragePath;
|
|
387
|
+
var ppidFile = path.join(coveragePath, '.ppid');
|
|
388
|
+
var ppid = process.ppid.toString();
|
|
389
|
+
if (!fs.existsSync(ppidFile) || fs.readFileSync(ppidFile, 'utf-8') !== ppid) {
|
|
390
|
+
// the condition is just to make sure we don't remove files outside the repo
|
|
391
|
+
if (getRootPath() === process.cwd() && path.normalize(coveragePath).startsWith(process.cwd())) {
|
|
392
|
+
fs.rmSync(coveragePath, {
|
|
393
|
+
recursive: true,
|
|
394
|
+
force: true
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
fs.mkdirSync(coveragePath, {
|
|
398
|
+
recursive: true
|
|
399
|
+
});
|
|
400
|
+
fs.writeFileSync(ppidFile, ppid);
|
|
401
|
+
}
|
|
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.
|
|
406
|
+
*/
|
|
407
|
+
var collectCoverageIfAvailable = /*#__PURE__*/function () {
|
|
408
|
+
var _ref3 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref2) {
|
|
409
|
+
var coveragePath, coverage, nycOutputPath;
|
|
410
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
411
|
+
while (1) switch (_context.prev = _context.next) {
|
|
412
|
+
case 0:
|
|
413
|
+
coveragePath = _ref2.coveragePath;
|
|
414
|
+
_context.next = 3;
|
|
415
|
+
return getGlobalPage().evaluate(function () {
|
|
416
|
+
return window.__coverage__;
|
|
417
|
+
});
|
|
418
|
+
case 3:
|
|
419
|
+
coverage = _context.sent;
|
|
420
|
+
if (coverage) {
|
|
421
|
+
_context.next = 6;
|
|
422
|
+
break;
|
|
423
|
+
}
|
|
424
|
+
return _context.abrupt("return");
|
|
425
|
+
case 6:
|
|
426
|
+
prepareCoverageReportPath({
|
|
427
|
+
coveragePath: coveragePath
|
|
428
|
+
});
|
|
429
|
+
nycOutputPath = path.join(coveragePath, '.nyc_output');
|
|
430
|
+
fs.mkdirSync(nycOutputPath, {
|
|
431
|
+
recursive: true
|
|
432
|
+
});
|
|
433
|
+
Object.values(coverage).forEach(function (cov) {
|
|
434
|
+
if (cov && cov.path && cov.hash) {
|
|
435
|
+
var _JSON$stringify;
|
|
436
|
+
fs.writeFileSync(path.join(nycOutputPath, cov.hash + '.json'), JSON.stringify((_JSON$stringify = {}, _JSON$stringify[cov.path] = cov, _JSON$stringify)));
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
case 10:
|
|
440
|
+
case "end":
|
|
441
|
+
return _context.stop();
|
|
442
|
+
}
|
|
443
|
+
}, _callee);
|
|
444
|
+
}));
|
|
445
|
+
return function collectCoverageIfAvailable(_x) {
|
|
446
|
+
return _ref3.apply(this, arguments);
|
|
447
|
+
};
|
|
448
|
+
}();
|
|
449
|
+
|
|
366
450
|
var _excluded = ["captureBeyondViewport"],
|
|
367
451
|
_excluded2 = ["userAgent", "isDarkMode", "viewport", "cookies"];
|
|
368
|
-
var _pkg$acceptanceTests, _ref;
|
|
369
|
-
var execSync = /*#__PURE__*/require('child_process').execSync;
|
|
452
|
+
var _pkg$acceptanceTests, _ref, _projectConfig$covera;
|
|
370
453
|
var getGlobalBrowser = function getGlobalBrowser() {
|
|
371
454
|
return global.browser;
|
|
372
455
|
};
|
|
373
|
-
var getGlobalPage = function getGlobalPage() {
|
|
456
|
+
var getGlobalPage$1 = function getGlobalPage() {
|
|
374
457
|
return global.page;
|
|
375
458
|
};
|
|
376
459
|
var isCi = /*#__PURE__*/process.argv.includes('--ci') || process.env.CI;
|
|
@@ -388,6 +471,7 @@ var rootDir = /*#__PURE__*/findRoot( /*#__PURE__*/process.cwd());
|
|
|
388
471
|
var pkg = /*#__PURE__*/JSON.parse( /*#__PURE__*/fs.readFileSync( /*#__PURE__*/path.join(rootDir, 'package.json'), 'utf-8'));
|
|
389
472
|
var projectConfig = (_pkg$acceptanceTests = pkg.acceptanceTests) != null ? _pkg$acceptanceTests : {};
|
|
390
473
|
var server = (_ref = isCi ? projectConfig.ciServer : projectConfig.devServer) != null ? _ref : projectConfig.server;
|
|
474
|
+
var coveragePath = /*#__PURE__*/path.join(rootDir, (_projectConfig$covera = projectConfig.coveragePath) != null ? _projectConfig$covera : 'reports/coverage-acceptance');
|
|
391
475
|
var serverPort = server == null ? void 0 : server.port;
|
|
392
476
|
var toMatchImageSnapshot = /*#__PURE__*/configureToMatchImageSnapshot({
|
|
393
477
|
failureThreshold: 0,
|
|
@@ -742,7 +826,7 @@ var openPage = /*#__PURE__*/function () {
|
|
|
742
826
|
_context7.t0 = _context7.sent;
|
|
743
827
|
case 7:
|
|
744
828
|
currentUserAgent = _context7.t0;
|
|
745
|
-
page = getGlobalPage();
|
|
829
|
+
page = getGlobalPage$1();
|
|
746
830
|
_context7.next = 11;
|
|
747
831
|
return page.bringToFront();
|
|
748
832
|
case 11:
|
|
@@ -843,7 +927,7 @@ var buildQueryMethods = function buildQueryMethods(_temp3) {
|
|
|
843
927
|
while (1) switch (_context12.prev = _context12.next) {
|
|
844
928
|
case 0:
|
|
845
929
|
_context12.next = 2;
|
|
846
|
-
return getDocument(page != null ? page : getGlobalPage());
|
|
930
|
+
return getDocument(page != null ? page : getGlobalPage$1());
|
|
847
931
|
case 2:
|
|
848
932
|
doc = _context12.sent;
|
|
849
933
|
_context12.next = 5;
|
|
@@ -877,7 +961,7 @@ var buildQueryMethods = function buildQueryMethods(_temp3) {
|
|
|
877
961
|
break;
|
|
878
962
|
}
|
|
879
963
|
_context8.next = 3;
|
|
880
|
-
return (page != null ? page : getGlobalPage()).waitForNetworkIdle();
|
|
964
|
+
return (page != null ? page : getGlobalPage$1()).waitForNetworkIdle();
|
|
881
965
|
case 3:
|
|
882
966
|
_context8.next = 5;
|
|
883
967
|
return waitForPaintEnd(elementHandle, _extends({}, options, {
|
|
@@ -977,7 +1061,7 @@ beforeEach( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().m
|
|
|
977
1061
|
while (1) switch (_context13.prev = _context13.next) {
|
|
978
1062
|
case 0:
|
|
979
1063
|
_context13.next = 2;
|
|
980
|
-
return getGlobalPage().setRequestInterception(false);
|
|
1064
|
+
return getGlobalPage$1().setRequestInterception(false);
|
|
981
1065
|
case 2:
|
|
982
1066
|
_context13.next = 4;
|
|
983
1067
|
return global.jestPuppeteer.resetPage();
|
|
@@ -992,25 +1076,30 @@ afterEach( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().ma
|
|
|
992
1076
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
993
1077
|
while (1) switch (_context14.prev = _context14.next) {
|
|
994
1078
|
case 0:
|
|
995
|
-
_context14.
|
|
996
|
-
|
|
1079
|
+
_context14.next = 2;
|
|
1080
|
+
return collectCoverageIfAvailable({
|
|
1081
|
+
coveragePath: coveragePath
|
|
1082
|
+
});
|
|
1083
|
+
case 2:
|
|
1084
|
+
_context14.prev = 2;
|
|
1085
|
+
page = getGlobalPage$1();
|
|
997
1086
|
requestHandlers = [];
|
|
998
1087
|
needsRequestInterception = false;
|
|
999
1088
|
page.off('request', requestInterceptor);
|
|
1000
1089
|
// clear tab, this way we clear the DOM and stop js execution or pending requests
|
|
1001
|
-
_context14.next =
|
|
1090
|
+
_context14.next = 9;
|
|
1002
1091
|
return page["goto"]('about:blank');
|
|
1003
|
-
case 7:
|
|
1004
|
-
_context14.next = 11;
|
|
1005
|
-
break;
|
|
1006
1092
|
case 9:
|
|
1007
|
-
_context14.
|
|
1008
|
-
|
|
1093
|
+
_context14.next = 13;
|
|
1094
|
+
break;
|
|
1009
1095
|
case 11:
|
|
1096
|
+
_context14.prev = 11;
|
|
1097
|
+
_context14.t0 = _context14["catch"](2);
|
|
1098
|
+
case 13:
|
|
1010
1099
|
case "end":
|
|
1011
1100
|
return _context14.stop();
|
|
1012
1101
|
}
|
|
1013
|
-
}, _callee14, null, [[
|
|
1102
|
+
}, _callee14, null, [[2, 11]]);
|
|
1014
1103
|
})));
|
|
1015
1104
|
/**
|
|
1016
1105
|
* Returns a new path to the file that can be used by chromium in acceptance tests
|
|
@@ -1134,5 +1223,5 @@ var waitForElementToBeRemoved = function waitForElementToBeRemoved(element, time
|
|
|
1134
1223
|
});
|
|
1135
1224
|
};
|
|
1136
1225
|
|
|
1137
|
-
export { createApiEndpointMock, getGlobalBrowser, getGlobalPage, getPageApi, getScreen, interceptRequest, openPage, prepareFile, screen, serverHostName, serverPort, wait, waitForElementToBeRemoved, within };
|
|
1226
|
+
export { createApiEndpointMock, getGlobalBrowser, getGlobalPage$1 as getGlobalPage, getPageApi, getScreen, interceptRequest, openPage, prepareFile, screen, serverHostName, serverPort, wait, waitForElementToBeRemoved, within };
|
|
1138
1227
|
//# sourceMappingURL=acceptance-testing.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acceptance-testing.esm.js","sources":["../src/index.ts"],"sourcesContent":["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';\nconst execSync = require('child_process').execSync;\n\nimport type {\n Page,\n ElementHandle,\n ScreenshotOptions,\n Browser,\n ClickOptions,\n Viewport,\n GeolocationOptions,\n HTTPRequest,\n ResponseForRequest,\n} from 'puppeteer';\nimport type {getQueriesForElement} from 'pptr-testing-library';\n\ntype CustomScreenshotOptions = ScreenshotOptions & {\n skipNetworkWait?: boolean;\n};\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\nexport const serverHostName = ((): string => {\n if (isCi) {\n return 'localhost';\n }\n\n if (isUsingDockerizedChromium) {\n return process.platform === 'linux' ? '172.17.0.1' : '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;\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-ignore\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 = ({baseUrl}: {baseUrl: string}): ApiEndpointMock => {\n interceptRequest((req) => req.method() === 'OPTIONS' && req.url().startsWith(baseUrl)).mockImplementation(\n () => ({\n status: 204,\n headers: {\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'POST,PATCH,PUT,GET,OPTIONS',\n 'Access-Control-Allow-Headers': '*',\n },\n })\n );\n\n return {\n spyOn(path: string, method: string = 'GET') {\n const matcher = (req: HTTPRequest) => {\n const url = req.url();\n const urlPath = url.substring(baseUrl.length);\n return (\n req.method() === method && url.startsWith(baseUrl) && !!urlPath.match(globToRegExp(path))\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\ninterface OpenPageCommonConfig {\n userAgent?: string;\n viewport?: Viewport;\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 const error = 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 // Error.captureStackTrace(error, openPage);\n throw error;\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(() => {\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 `;\n window.addEventListener('DOMContentLoaded', () => {\n document.head.appendChild(style);\n });\n });\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 // 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 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":["execSync","require","getGlobalBrowser","global","browser","getGlobalPage","page","isCi","process","argv","includes","env","CI","isUsingDockerizedChromium","URL","wsEndpoint","port","serverHostName","platform","rootDir","findRoot","cwd","pkg","JSON","parse","fs","readFileSync","path","join","projectConfig","_pkg$acceptanceTests","acceptanceTests","server","_ref","ciServer","devServer","serverPort","toMatchImageSnapshot","configureToMatchImageSnapshot","failureThreshold","failureThresholdType","customSnapshotIdentifier","_ref2","defaultIdentifier","calledToMatchImageSnapshotOutsideDocker","localToMatchImageSnapshot","message","pass","expect","extend","afterEach","error","Error","stack","split","waitForPaintEnd","_ref3","_asyncToGenerator","_regeneratorRuntime","mark","_callee","element","_temp","_ref4","_ref4$fullPage","fullPage","captureBeyondViewport","MAX_WAIT","STEP_TIME","t0","buf1","buf2","wrap","_callee$","_context","prev","next","Date","now","screenshot","normalizeSreenshotOptions","sent","Promise","r","setTimeout","compare","stop","_x","_x2","apply","arguments","_temp2","_ref5$captureBeyondVi","_ref5","options","_objectWithoutPropertiesLoose","_excluded","_extends","scrollIntoView","el","evaluate","e","block","getPageApi","api","Object","create","type","_ref6","_callee2","elementHandle","text","_callee2$","_context2","abrupt","_x3","_x4","_x5","click","_ref7","_callee3","_callee3$","_context3","_x6","_x7","select","_ref8","_callee4","_len","values","_key","_args4","_callee4$","_context4","length","Array","_x8","_ref9","_callee5","_callee5$","_context5","skipNetworkWait","waitForNetworkIdle","_x9","clear","_ref10","_callee6","_callee6$","_context6","clickCount","press","_x10","setGeolocation","position","window","navigator","geolocation","getCurrentPosition","callback","coords","needsRequestInterception","requestHandlers","requestInterceptor","req","_ref11","_requestHandlers$find","find","_ref12","matcher","handler","response","respond","interceptRequest","spy","jest","fn","push","createApiEndpointMock","_ref13","baseUrl","method","url","startsWith","mockImplementation","status","headers","spyOn","urlPath","substring","match","globToRegExp","spyResult","_spyResult$status","resBody","body","contentType","stringify","openPage","_ref15","_callee7","_ref14","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","style","document","createElement","innerHTML","addEventListener","head","appendChild","setRequestInterception","on","t1","captureStackTrace","waitForFunction","_x11","buildQueryMethods","_temp3","_ref16","boundQueries","_loop","_Object$entries$_i","_Object$entries","_i","queryName","queryFn","_callee12","doc","_len2","args","_key2","queryArgs","newElementHandle","_args12","_callee12$","_context12","getDocument","$","concat","timeout","_ref18","_callee8","_callee8$","_context8","_x12","_ref19","_callee9","_callee9$","_context9","_x13","_ref20","_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","toString","trim","newPath","basename","copyFileSync","wait","expectation","interval","startTime","startStack","resolve","reject","rejectOrRerun","runExpectation","then","waitForElementToBeRemoved","_ref24","_callee15","box","_callee15$","_context15","boundingBox"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,IAAMA,QAAQ,gBAAGC,OAAO,CAAC,eAAe,CAAC,CAACD,QAAQ;IAmBrCE,gBAAgB,GAAG,SAAnBA,gBAAgBA;EAAA,OAAmBC,MAAc,CAACC,OAAO;AAAA;IACzDC,aAAa,GAAG,SAAhBA,aAAaA;EAAA,OAAgBF,MAAc,CAACG,IAAI;AAAA;AAE7D,IAAMC,IAAI,gBAAGC,OAAO,CAACC,IAAI,CAACC,QAAQ,CAAC,MAAM,CAAC,IAAIF,OAAO,CAACG,GAAG,CAACC,EAAE;AAC5D,IAAMC,yBAAyB,GAAGN,IAAI,qBAAQO,GAAG,eAACZ,gBAAgB,EAAE,CAACa,UAAU,EAAE,CAAC,CAACC,IAAI,KAAK,MAAM;IAErFC,cAAc,gBAAI;EAC3B,IAAIV,I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A,CAAArN,MAAA;UAAA;YAAAqN,UAAA,CAAA3P,IAAA;YAAA,OAGF,IAAIM,OAAO,CAAC,UAAC2O,OAAO;cAAA,OAAKzO,UAAU,CAACyO,OAAO,EAAEH,QAAQ,CAAC;cAAC;UAAA;YAAAa,UAAA,CAAA3P,IAAA;YAAA;UAAA;YAAA,MAE3D,IAAIxB,KAAK,CAAC,qBAAqB,CAAC;UAAA;UAAA;YAAA,OAAAmR,UAAA,CAAAjP,IAAA;;SAAA8O,SAAA;KACzC;IAAA,gBAXKZ,IAAIA;MAAA,OAAAW,MAAA,CAAA1O,KAAA,OAAAC,SAAA;;KAWT;EAED,OAAO8N,IAAI,EAAE,SAAM,CAAC,UAACrQ,KAAK;IACtB,IAAIA,KAAK,CAACL,OAAO,KAAK,qBAAqB,EAAE;MACzCK,KAAK,CAACE,KAAK,GAAGuQ,UAAU;;IAE5B,MAAMzQ,KAAK;GACd,CAAC;AACN;;;;"}
|
|
1
|
+
{"version":3,"file":"acceptance-testing.esm.js","sources":["../src/coverage.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 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';\n\nimport type {\n Page,\n ElementHandle,\n ScreenshotOptions,\n Browser,\n ClickOptions,\n Viewport,\n GeolocationOptions,\n HTTPRequest,\n ResponseForRequest,\n} from 'puppeteer';\nimport type {getQueriesForElement} from 'pptr-testing-library';\n\ntype CustomScreenshotOptions = ScreenshotOptions & {\n skipNetworkWait?: boolean;\n};\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\nexport const serverHostName = ((): string => {\n if (isCi) {\n return 'localhost';\n }\n\n if (isUsingDockerizedChromium) {\n return process.platform === 'linux' ? '172.17.0.1' : '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-ignore\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 = ({baseUrl}: {baseUrl: string}): ApiEndpointMock => {\n interceptRequest((req) => req.method() === 'OPTIONS' && req.url().startsWith(baseUrl)).mockImplementation(\n () => ({\n status: 204,\n headers: {\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'POST,PATCH,PUT,GET,OPTIONS',\n 'Access-Control-Allow-Headers': '*',\n },\n })\n );\n\n return {\n spyOn(path: string, method: string = 'GET') {\n const matcher = (req: HTTPRequest) => {\n const url = req.url();\n const urlPath = url.substring(baseUrl.length);\n return (\n req.method() === method && url.startsWith(baseUrl) && !!urlPath.match(globToRegExp(path))\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\ninterface OpenPageCommonConfig {\n userAgent?: string;\n viewport?: Viewport;\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 const error = 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 // Error.captureStackTrace(error, openPage);\n throw error;\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(() => {\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 `;\n window.addEventListener('DOMContentLoaded', () => {\n document.head.appendChild(style);\n });\n });\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","getGlobalBrowser","browser","isCi","argv","includes","env","CI","isUsingDockerizedChromium","URL","wsEndpoint","port","serverHostName","platform","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","split","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","e","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","_ref13","baseUrl","method","url","mockImplementation","status","headers","spyOn","urlPath","substring","match","globToRegExp","spyResult","_spyResult$status","resBody","body","contentType","openPage","_ref15","_callee7","_ref14","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","style","document","createElement","innerHTML","addEventListener","head","appendChild","setRequestInterception","on","t1","captureStackTrace","waitForFunction","_x11","buildQueryMethods","_temp3","_ref16","boundQueries","_loop","_Object$entries$_i","_Object$entries","_i","queryName","queryFn","_callee12","doc","_len2","args","_key2","queryArgs","newElementHandle","_args12","_callee12$","_context12","getDocument","$","concat","timeout","_ref18","_callee8","_callee8$","_context8","_x12","_ref19","_callee9","_callee9$","_context9","_x13","_ref20","_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","execSync","trim","newPath","basename","copyFileSync","wait","expectation","interval","startTime","startStack","resolve","reject","rejectOrRerun","runExpectation","then","waitForElementToBeRemoved","_ref24","_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,IA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