Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/core/engine/command/measure.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ export class Measure {
*
* @async
* @param {string} errorMessage - The message about the error. This will end up on the HTML report for sitespeed.io so give it a good message so you know what's gone wrong.
* @returns {Promise} A promise that resolves when the stop process has completed.
* @returns {Promise<void>} A promise that resolves when the stop process has completed.
* @since 21.2.0
*/
async stopAsError(errorMessage) {
Expand Down Expand Up @@ -361,7 +361,7 @@ export class Measure {
* @async
* @param {string} alias - The friendly name for this measurement.
* @param {string} selector - The CSS selector of the element to click.
* @returns {Promise} A promise that resolves with the collected metrics data.
* @returns {Promise<unknown>} A promise that resolves with the collected metrics data.
* @throws {Error} Throws an error if the element is not found or the measurement fails.
*/
async clickAndMeasure(alias, selector) {
Expand All @@ -378,7 +378,7 @@ export class Measure {
* @async
* @param {string} testedStartUrl - The URL that was initially tested. If not provided, it will be obtained from the browser.
* @throws {Error} Throws an error if there are issues in stopping the measurement or collecting data.
* @returns {Promise} A promise that resolves with the collected metrics data.
* @returns {Promise<unknown>} A promise that resolves with the collected metrics data.
*/
async stop(testedStartUrl) {
log.debug('Stop measuring');
Expand Down
14 changes: 10 additions & 4 deletions lib/core/engine/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,10 +357,6 @@ export class Commands {
*/
this.debug = new Debug(browser, options);

/**
* Interact with the page using the mouse.
* @type {Object}
*/
const singleClickInstance = new SingleClick(
browser,
pageCompleteCheck,
Expand All @@ -375,6 +371,16 @@ export class Commands {
const mouseMoveInstance = new MouseMove(browser, options);
const clickAndHoldInstance = new ClickAndHold(browser);

/**
* Interact with the page using the mouse.
* @type {{
* moveTo: (selector: string) => Promise<void>,
* singleClick: (selector: string, mouseOptions?: { waitForNavigation?: boolean }) => Promise<void>,
* doubleClick: (selector: string) => Promise<void>,
* contextClick: (selector: string) => Promise<void>,
* clickAndHold: ClickAndHold
* }}
*/
this.mouse = {
moveTo: async selector => mouseMoveInstance.run(selector),
singleClick: async (selector, mouseOptions) =>
Expand Down
12 changes: 6 additions & 6 deletions types/core/engine/command/measure.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ export class Measure {
*
* @async
* @param {string} errorMessage - The message about the error. This will end up on the HTML report for sitespeed.io so give it a good message so you know what's gone wrong.
* @returns {Promise} A promise that resolves when the stop process has completed.
* @returns {Promise<void>} A promise that resolves when the stop process has completed.
* @since 21.2.0
*/
stopAsError(errorMessage: string): Promise<any>;
stopAsError(errorMessage: string): Promise<void>;
/**
* @private
*/
Expand All @@ -161,10 +161,10 @@ export class Measure {
* @async
* @param {string} alias - The friendly name for this measurement.
* @param {string} selector - The CSS selector of the element to click.
* @returns {Promise} A promise that resolves with the collected metrics data.
* @returns {Promise<unknown>} A promise that resolves with the collected metrics data.
* @throws {Error} Throws an error if the element is not found or the measurement fails.
*/
clickAndMeasure(alias: string, selector: string): Promise<any>;
clickAndMeasure(alias: string, selector: string): Promise<unknown>;
/**
* Stops the measurement process, collects metrics, and handles any post-measurement tasks.
* It finalizes the URL being tested, manages any URL-specific metadata, stops any ongoing video recordings,
Expand All @@ -173,9 +173,9 @@ export class Measure {
* @async
* @param {string} testedStartUrl - The URL that was initially tested. If not provided, it will be obtained from the browser.
* @throws {Error} Throws an error if there are issues in stopping the measurement or collecting data.
* @returns {Promise} A promise that resolves with the collected metrics data.
* @returns {Promise<unknown>} A promise that resolves with the collected metrics data.
*/
stop(testedStartUrl: string): Promise<any>;
stop(testedStartUrl: string): Promise<unknown>;
/**
* Adds a custom metric to the current measurement result.
* The metric will be attached to the latest tested page, meaming
Expand Down
2 changes: 1 addition & 1 deletion types/core/engine/command/measure.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 16 additions & 4 deletions types/core/engine/commands.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,23 @@ export class Commands {
* @type {Debug}
*/
debug: Debug;
/**
* Interact with the page using the mouse.
* @type {{
* moveTo: (selector: string) => Promise<void>,
* singleClick: (selector: string, mouseOptions?: { waitForNavigation?: boolean }) => Promise<void>,
* doubleClick: (selector: string) => Promise<void>,
* contextClick: (selector: string) => Promise<void>,
* clickAndHold: ClickAndHold
* }}
*/
mouse: {
moveTo: (selector: any) => Promise<void>;
singleClick: (selector: any, mouseOptions: any) => Promise<any>;
doubleClick: (selector: any) => Promise<void>;
contextClick: (selector: any) => Promise<void>;
moveTo: (selector: string) => Promise<void>;
singleClick: (selector: string, mouseOptions?: {
waitForNavigation?: boolean;
}) => Promise<void>;
doubleClick: (selector: string) => Promise<void>;
contextClick: (selector: string) => Promise<void>;
clickAndHold: ClickAndHold;
};
/**
Expand Down
2 changes: 1 addition & 1 deletion types/core/engine/commands.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading