Skip to content

Commit

Permalink
chore: rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
OrKoN committed Oct 25, 2022
1 parent 1d6d852 commit 9f1734b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 99 deletions.
2 changes: 1 addition & 1 deletion docs/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

---

Expand Down
95 changes: 1 addition & 94 deletions src/Runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -63,85 +49,6 @@ export class Runner {
await _runStepWithHooks(this.#extension, step);
}

async click(step: Omit<ClickStep, 'type'>): Promise<void> {
await this.runStep({
type: 'click',
...step,
});
}

async hover(step: Omit<HoverStep, 'type'>): Promise<void> {
await this.runStep({
type: 'hover',
...step,
});
}

async keyDown(step: Omit<KeyDownStep, 'type'>): Promise<void> {
await this.runStep({
type: 'keyDown',
...step,
});
}

async keyUp(step: Omit<KeyUpStep, 'type'>): Promise<void> {
await this.runStep({
type: 'keyUp',
...step,
});
}

async setViewport(step: Omit<SetViewportStep, 'type'>): Promise<void> {
await this.runStep({
type: 'setViewport',
...step,
});
}

async close(step: Omit<CloseStep, 'type'>): Promise<void> {
await this.runStep({
type: 'close',
...step,
});
}

async emulateNetworkConditions(
step: Omit<EmulateNetworkConditionsStep, 'type'>
): Promise<void> {
await this.runStep({
type: 'emulateNetworkConditions',
...step,
});
}

async change(step: Omit<ChangeStep, 'type'>): Promise<void> {
await this.runStep({
type: 'change',
...step,
});
}

async doubleClick(step: Omit<DoubleClickStep, 'type'>): Promise<void> {
await this.runStep({
type: 'doubleClick',
...step,
});
}

async navigate(step: Omit<NavigateStep, 'type'>): Promise<void> {
await this.runStep({
type: 'navigate',
...step,
});
}

async scroll(step: Omit<ScrollStep, 'type'>): Promise<void> {
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
Expand Down
9 changes: 5 additions & 4 deletions test/runner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 9f1734b

Please sign in to comment.