From 196c20271c01e9e43d19e268bbb3de2958c9a48e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andor=20Kov=C3=A1cs?= Date: Mon, 20 Oct 2025 22:13:53 +0200 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#73682=20aws-sy?= =?UTF-8?q?nthetics-playwright=20by=20@kovacsandor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/amzn__synthetics-playwright/.npmignore | 5 ++ .../amzn__synthetics-playwright-tests.ts | 54 +++++++++++++++++++ types/amzn__synthetics-playwright/index.d.ts | 26 +++++++++ .../amzn__synthetics-playwright/package.json | 22 ++++++++ .../amzn__synthetics-playwright/tsconfig.json | 19 +++++++ 5 files changed, 126 insertions(+) create mode 100644 types/amzn__synthetics-playwright/.npmignore create mode 100644 types/amzn__synthetics-playwright/amzn__synthetics-playwright-tests.ts create mode 100644 types/amzn__synthetics-playwright/index.d.ts create mode 100644 types/amzn__synthetics-playwright/package.json create mode 100644 types/amzn__synthetics-playwright/tsconfig.json diff --git a/types/amzn__synthetics-playwright/.npmignore b/types/amzn__synthetics-playwright/.npmignore new file mode 100644 index 00000000000000..680c524577719f --- /dev/null +++ b/types/amzn__synthetics-playwright/.npmignore @@ -0,0 +1,5 @@ +* +!**/*.d.ts +!**/*.d.cts +!**/*.d.mts +!**/*.d.*.ts \ No newline at end of file diff --git a/types/amzn__synthetics-playwright/amzn__synthetics-playwright-tests.ts b/types/amzn__synthetics-playwright/amzn__synthetics-playwright-tests.ts new file mode 100644 index 00000000000000..43a700a3d81486 --- /dev/null +++ b/types/amzn__synthetics-playwright/amzn__synthetics-playwright-tests.ts @@ -0,0 +1,54 @@ +import { synthetics } from "@amzn/synthetics-playwright"; +import type { Browser, BrowserContext, LaunchOptions, Page } from "@playwright/test"; + +export const handler = async () => { + const launchOptions: LaunchOptions = await synthetics.getDefaultLaunchOptions(); + const browser: Browser = await synthetics.launch(launchOptions); + const page: Page = await synthetics.newPage(browser); + + await page.goto("https://example.com"); + await page.screenshot({ path: "/tmp/example.png" }); + + await synthetics.close(); +}; + +export const runTestStep = ( + stepName: string, + runTestsAndReturnNextPage: () => Promise, +): Promise => { + return synthetics.executeStep(stepName, async () => { + const nextPage = await runTestsAndReturnNextPage(); + return nextPage; + }); +}; + +export const testWithBrowserContext = async () => { + const browser: Browser = await synthetics.launch(); + const context: BrowserContext = await browser.newContext(); + const page: Page = await synthetics.newPage(context); + + await page.goto("https://example.com"); + await synthetics.close(); +}; + +export const testExecuteStepWithConfig = async () => { + const browser: Browser = await synthetics.launch(); + const page: Page = await synthetics.newPage(browser); + + await synthetics.executeStep( + "test step", + async () => { + await page.goto("https://example.com"); + return page.title(); + }, + { + continueOnStepFailure: true, + screenshotOnStepStart: true, + screenshotOnStepSuccess: false, + screenshotOnStepFailure: true, + }, + page + ); + + await synthetics.close(); +}; \ No newline at end of file diff --git a/types/amzn__synthetics-playwright/index.d.ts b/types/amzn__synthetics-playwright/index.d.ts new file mode 100644 index 00000000000000..dcff8ebaeef70d --- /dev/null +++ b/types/amzn__synthetics-playwright/index.d.ts @@ -0,0 +1,26 @@ +import type { Browser, BrowserType, BrowserContext, LaunchOptions, Page } from "@playwright/test"; + + +export interface StepConfig { + readonly continueOnHttpStepFailure?: boolean | undefined; + readonly continueOnStepFailure?: boolean | undefined; + readonly screenshotOnStepFailure?: boolean | undefined; + readonly screenshotOnStepStart?: boolean | undefined; + readonly screenshotOnStepSuccess?: boolean | undefined; + readonly stepDurationMetric?: boolean | undefined; + readonly stepsReport?: boolean | undefined; + readonly stepSuccessMetric?: boolean | undefined; +} + +export interface SyntheticsType { + readonly close: () => Promise; + readonly executeStep: (stepName: string, func: () => Promise, stepConfig?: StepConfig, page?: Page) => Promise; + readonly getDefaultLaunchOptions: () => Promise; + readonly getPage: (browser: Browser | BrowserContext) => Promise; + readonly launch: BrowserType["launch"]; + readonly newPage: (browser: Browser | BrowserContext) => Promise; +} + +export const synthetics: SyntheticsType; + +export {}; diff --git a/types/amzn__synthetics-playwright/package.json b/types/amzn__synthetics-playwright/package.json new file mode 100644 index 00000000000000..2f246a117e70ad --- /dev/null +++ b/types/amzn__synthetics-playwright/package.json @@ -0,0 +1,22 @@ +{ + "private": true, + "name": "@types/amzn__synthetics-playwright", + "version": "10.0.9999", + "nonNpm": true, + "nonNpmDescription": "Library functions available for Node.js canary scripts using Playwright", + "projects": [ + "https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries.html" + ], + "devDependencies": { + "@types/amzn__synthetics-playwright": "workspace:." + }, + "peerDependencies": { + "@playwright/test": "^1.53.0" + }, + "owners": [ + { + "name": "Andor Kovács", + "githubUsername": "kovacsandor" + } + ] +} \ No newline at end of file diff --git a/types/amzn__synthetics-playwright/tsconfig.json b/types/amzn__synthetics-playwright/tsconfig.json new file mode 100644 index 00000000000000..09b98257132178 --- /dev/null +++ b/types/amzn__synthetics-playwright/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "node16", + "lib": [ + "es2018" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "amzn__synthetics-playwright-tests.ts" + ] +} From ea36f2568c7f35bd1d52b973046808b7563fa8f6 Mon Sep 17 00:00:00 2001 From: TypeScript Bot Date: Mon, 20 Oct 2025 20:14:41 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=A4=96=20dprint=20fmt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../amzn__synthetics-playwright-tests.ts | 14 ++++---- types/amzn__synthetics-playwright/index.d.ts | 36 ++++++++++--------- .../amzn__synthetics-playwright/package.json | 2 +- 3 files changed, 28 insertions(+), 24 deletions(-) diff --git a/types/amzn__synthetics-playwright/amzn__synthetics-playwright-tests.ts b/types/amzn__synthetics-playwright/amzn__synthetics-playwright-tests.ts index 43a700a3d81486..5b97e34b1e97e1 100644 --- a/types/amzn__synthetics-playwright/amzn__synthetics-playwright-tests.ts +++ b/types/amzn__synthetics-playwright/amzn__synthetics-playwright-tests.ts @@ -5,10 +5,10 @@ export const handler = async () => { const launchOptions: LaunchOptions = await synthetics.getDefaultLaunchOptions(); const browser: Browser = await synthetics.launch(launchOptions); const page: Page = await synthetics.newPage(browser); - + await page.goto("https://example.com"); await page.screenshot({ path: "/tmp/example.png" }); - + await synthetics.close(); }; @@ -26,7 +26,7 @@ export const testWithBrowserContext = async () => { const browser: Browser = await synthetics.launch(); const context: BrowserContext = await browser.newContext(); const page: Page = await synthetics.newPage(context); - + await page.goto("https://example.com"); await synthetics.close(); }; @@ -34,7 +34,7 @@ export const testWithBrowserContext = async () => { export const testExecuteStepWithConfig = async () => { const browser: Browser = await synthetics.launch(); const page: Page = await synthetics.newPage(browser); - + await synthetics.executeStep( "test step", async () => { @@ -47,8 +47,8 @@ export const testExecuteStepWithConfig = async () => { screenshotOnStepSuccess: false, screenshotOnStepFailure: true, }, - page + page, ); - + await synthetics.close(); -}; \ No newline at end of file +}; diff --git a/types/amzn__synthetics-playwright/index.d.ts b/types/amzn__synthetics-playwright/index.d.ts index dcff8ebaeef70d..7cbf49dacd467e 100644 --- a/types/amzn__synthetics-playwright/index.d.ts +++ b/types/amzn__synthetics-playwright/index.d.ts @@ -1,24 +1,28 @@ -import type { Browser, BrowserType, BrowserContext, LaunchOptions, Page } from "@playwright/test"; - +import type { Browser, BrowserContext, BrowserType, LaunchOptions, Page } from "@playwright/test"; export interface StepConfig { - readonly continueOnHttpStepFailure?: boolean | undefined; - readonly continueOnStepFailure?: boolean | undefined; - readonly screenshotOnStepFailure?: boolean | undefined; - readonly screenshotOnStepStart?: boolean | undefined; - readonly screenshotOnStepSuccess?: boolean | undefined; - readonly stepDurationMetric?: boolean | undefined; - readonly stepsReport?: boolean | undefined; - readonly stepSuccessMetric?: boolean | undefined; + readonly continueOnHttpStepFailure?: boolean | undefined; + readonly continueOnStepFailure?: boolean | undefined; + readonly screenshotOnStepFailure?: boolean | undefined; + readonly screenshotOnStepStart?: boolean | undefined; + readonly screenshotOnStepSuccess?: boolean | undefined; + readonly stepDurationMetric?: boolean | undefined; + readonly stepsReport?: boolean | undefined; + readonly stepSuccessMetric?: boolean | undefined; } export interface SyntheticsType { - readonly close: () => Promise; - readonly executeStep: (stepName: string, func: () => Promise, stepConfig?: StepConfig, page?: Page) => Promise; - readonly getDefaultLaunchOptions: () => Promise; - readonly getPage: (browser: Browser | BrowserContext) => Promise; - readonly launch: BrowserType["launch"]; - readonly newPage: (browser: Browser | BrowserContext) => Promise; + readonly close: () => Promise; + readonly executeStep: ( + stepName: string, + func: () => Promise, + stepConfig?: StepConfig, + page?: Page, + ) => Promise; + readonly getDefaultLaunchOptions: () => Promise; + readonly getPage: (browser: Browser | BrowserContext) => Promise; + readonly launch: BrowserType["launch"]; + readonly newPage: (browser: Browser | BrowserContext) => Promise; } export const synthetics: SyntheticsType; diff --git a/types/amzn__synthetics-playwright/package.json b/types/amzn__synthetics-playwright/package.json index 2f246a117e70ad..10b7a435d5aa5c 100644 --- a/types/amzn__synthetics-playwright/package.json +++ b/types/amzn__synthetics-playwright/package.json @@ -19,4 +19,4 @@ "githubUsername": "kovacsandor" } ] -} \ No newline at end of file +} From 54df06147b8c52857c65c49424c47dc8a792969c Mon Sep 17 00:00:00 2001 From: Dolan Murvihill Date: Mon, 20 Oct 2025 15:48:50 -0700 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#73905=20Types?= =?UTF-8?q?=20for=20expect-cookies=20minor=20version=203=20by=20@dmurvihil?= =?UTF-8?q?l?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/expect-cookies/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/expect-cookies/package.json b/types/expect-cookies/package.json index 72f5db4de695f5..df0394b81e2e98 100644 --- a/types/expect-cookies/package.json +++ b/types/expect-cookies/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@types/expect-cookies", - "version": "0.2.9999", + "version": "0.3.9999", "projects": [ "https://github.com/gregl83/expect-cookies" ],