From 9f1734b13e0250ed543f86bf6a6ce04e12f73f1a Mon Sep 17 00:00:00 2001 From: Alex Rudenko Date: Mon, 24 Oct 2022 14:46:00 +0200 Subject: [PATCH] chore: rebase --- docs/api/README.md | 2 +- src/Runner.ts | 95 +-------------------------------------------- test/runner.test.ts | 9 +++-- 3 files changed, 7 insertions(+), 99 deletions(-) diff --git a/docs/api/README.md b/docs/api/README.md index 6faa45ca..5cbd2005 100644 --- a/docs/api/README.md +++ b/docs/api/README.md @@ -323,7 +323,7 @@ limitations under the License. #### Defined in -[Runner.ts:172](https://github.com/puppeteer/replay/blob/main/src/Runner.ts#L172) +[Runner.ts:61](https://github.com/puppeteer/replay/blob/main/src/Runner.ts#L61) --- diff --git a/src/Runner.ts b/src/Runner.ts index 6bb4819d..bb1fffc2 100644 --- a/src/Runner.ts +++ b/src/Runner.ts @@ -16,21 +16,7 @@ import { PuppeteerRunnerOwningBrowserExtension } from './PuppeteerRunnerExtension.js'; import { RunnerExtension } from './RunnerExtension.js'; -import { - UserFlow, - Step, - ClickStep, - SetViewportStep, - KeyDownStep, - KeyUpStep, - HoverStep, - CloseStep, - EmulateNetworkConditionsStep, - ChangeStep, - DoubleClickStep, - NavigateStep, - ScrollStep, -} from './Schema.js'; +import { UserFlow, Step } from './Schema.js'; async function _runStepWithHooks( extension: RunnerExtension, @@ -63,85 +49,6 @@ export class Runner { await _runStepWithHooks(this.#extension, step); } - async click(step: Omit): Promise { - await this.runStep({ - type: 'click', - ...step, - }); - } - - async hover(step: Omit): Promise { - await this.runStep({ - type: 'hover', - ...step, - }); - } - - async keyDown(step: Omit): Promise { - await this.runStep({ - type: 'keyDown', - ...step, - }); - } - - async keyUp(step: Omit): Promise { - await this.runStep({ - type: 'keyUp', - ...step, - }); - } - - async setViewport(step: Omit): Promise { - await this.runStep({ - type: 'setViewport', - ...step, - }); - } - - async close(step: Omit): Promise { - await this.runStep({ - type: 'close', - ...step, - }); - } - - async emulateNetworkConditions( - step: Omit - ): Promise { - await this.runStep({ - type: 'emulateNetworkConditions', - ...step, - }); - } - - async change(step: Omit): Promise { - await this.runStep({ - type: 'change', - ...step, - }); - } - - async doubleClick(step: Omit): Promise { - await this.runStep({ - type: 'doubleClick', - ...step, - }); - } - - async navigate(step: Omit): Promise { - await this.runStep({ - type: 'navigate', - ...step, - }); - } - - async scroll(step: Omit): Promise { - await this.#extension.runStep({ - type: 'scroll', - ...step, - }); - } - /** * Run all the steps in the flow * @returns whether all the steps are run or the execution is aborted diff --git a/test/runner.test.ts b/test/runner.test.ts index d917642b..c1cbe977 100644 --- a/test/runner.test.ts +++ b/test/runner.test.ts @@ -946,18 +946,19 @@ describe('Runner', () => { }, new PuppeteerRunnerExtension(browser, page) ); - await runner.navigate({ + await runner.runStep({ + type: StepType.Navigate as const, url: `${HTTP_PREFIX}/main.html`, assertedEvents: [ { title: '', - type: 'navigation', + type: AssertedEventType.Navigation, url: `${HTTP_PREFIX}/main.html`, }, ], }); - await runner.hover({ - target: 'main', + await runner.runStep({ + type: StepType.Hover as const, selectors: [['#hover-button']], }); assert.ok(