Comparing version 0.0.4-alpha-18 to 0.0.4-alpha-19
@@ -41,3 +41,3 @@ "use strict"; | ||
* | ||
* @returns {Promise<void>} - A promise that resolves when the user context is created. | ||
* @returns {Promise<CreateUserContextResult>} - A promise that resolves when the user context is created. | ||
*/ | ||
@@ -50,3 +50,7 @@ createUserContext() { | ||
}; | ||
yield this._ws.sendCommand(params); | ||
return new Promise((resolve, reject) => { | ||
this._ws.sendCommand(params) | ||
.then(response => resolve(response)) | ||
.catch(error => reject(error)); | ||
}); | ||
}); | ||
@@ -53,0 +57,0 @@ } |
@@ -105,7 +105,7 @@ "use strict"; | ||
* Create a new session | ||
* @param {sessionCapabilitiesRequest} capabilities - The capabilities that the new session should have. | ||
* @param {CapabilitiesRequest} capabilities - The capabilities that the new session should have. | ||
* @return {Promise<SessionNewResult>} Promise object represents the newly created session. | ||
* @throws {Error} When unable to create a session. | ||
*/ | ||
newSession(capabilities) { | ||
new(capabilities) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -135,3 +135,3 @@ this._capabilities = capabilities; | ||
*/ | ||
endSession() { | ||
end() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -142,3 +142,7 @@ const params = { | ||
}; | ||
yield this._ws.sendCommand(params); | ||
return new Promise((resolve, reject) => { | ||
this._ws.sendCommand(params) | ||
.then(() => resolve()) | ||
.catch(error => reject(new Error(`Unable to end session: ${error}`))); | ||
}); | ||
}); | ||
@@ -145,0 +149,0 @@ } |
@@ -39,3 +39,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
* | ||
* @returns {Promise<void>} - A promise that resolves when the user context is created. | ||
* @returns {Promise<CreateUserContextResult>} - A promise that resolves when the user context is created. | ||
*/ | ||
@@ -48,3 +48,7 @@ createUserContext() { | ||
}; | ||
yield this._ws.sendCommand(params); | ||
return new Promise((resolve, reject) => { | ||
this._ws.sendCommand(params) | ||
.then(response => resolve(response)) | ||
.catch(error => reject(error)); | ||
}); | ||
}); | ||
@@ -51,0 +55,0 @@ } |
@@ -103,7 +103,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
* Create a new session | ||
* @param {sessionCapabilitiesRequest} capabilities - The capabilities that the new session should have. | ||
* @param {CapabilitiesRequest} capabilities - The capabilities that the new session should have. | ||
* @return {Promise<SessionNewResult>} Promise object represents the newly created session. | ||
* @throws {Error} When unable to create a session. | ||
*/ | ||
newSession(capabilities) { | ||
new(capabilities) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -133,3 +133,3 @@ this._capabilities = capabilities; | ||
*/ | ||
endSession() { | ||
end() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -140,5 +140,9 @@ const params = { | ||
}; | ||
yield this._ws.sendCommand(params); | ||
return new Promise((resolve, reject) => { | ||
this._ws.sendCommand(params) | ||
.then(() => resolve()) | ||
.catch(error => reject(new Error(`Unable to end session: ${error}`))); | ||
}); | ||
}); | ||
} | ||
} |
import { BiDi } from "../../index"; | ||
import { GetUserContextsResult, RemoveUserContextParameters } from "./types"; | ||
import { CreateUserContextResult, GetUserContextsResult, RemoveUserContextParameters } from "./types"; | ||
/** | ||
@@ -23,5 +23,5 @@ * A class representing a Browser with various methods to interact with it. | ||
* | ||
* @returns {Promise<void>} - A promise that resolves when the user context is created. | ||
* @returns {Promise<CreateUserContextResult>} - A promise that resolves when the user context is created. | ||
*/ | ||
createUserContext(): Promise<void>; | ||
createUserContext(): Promise<CreateUserContextResult>; | ||
/** | ||
@@ -28,0 +28,0 @@ * Getter for the user contexts. |
import { BrowsingContext, BrowsingContextInfo, BrowsingContextNavigationInfo, UserPromptType } from "./types"; | ||
import { sessionUserPromptHandlerType } from "../session/types"; | ||
import { UserPromptHandlerType } from "../session/types"; | ||
export type BrowsingContextUserPromptClosedParameters = { | ||
@@ -11,3 +11,3 @@ context: BrowsingContext; | ||
context: BrowsingContext; | ||
handler: sessionUserPromptHandlerType; | ||
handler: UserPromptHandlerType; | ||
message: string; | ||
@@ -14,0 +14,0 @@ type: UserPromptType; |
@@ -5,5 +5,3 @@ import { UserContext } from "../browser/types"; | ||
export type Navigation = string; | ||
export interface BrowsingContextInfoList { | ||
browsingContextInfoList: BrowsingContextInfo[]; | ||
} | ||
export type BrowsingContextInfoList = BrowsingContextInfo[]; | ||
export type BrowsingContextInfo = { | ||
@@ -10,0 +8,0 @@ children: BrowsingContext[] | null; |
import { BiDi } from '../../index'; | ||
import { sessionCapabilitiesRequest, SessionNewResult, SessionStatusResult, SubscriptionRequest, SubscriptionType } from './types'; | ||
import { CapabilitiesRequest, SessionNewResult, SessionStatusResult, SubscriptionRequest, SubscriptionType } from "./types"; | ||
/** | ||
@@ -10,3 +10,3 @@ * Class representing a session. | ||
_contexts: SubscriptionType | undefined; | ||
_capabilities: sessionCapabilitiesRequest | undefined; | ||
_capabilities: CapabilitiesRequest | undefined; | ||
/** | ||
@@ -50,7 +50,7 @@ * Create a session. | ||
* Create a new session | ||
* @param {sessionCapabilitiesRequest} capabilities - The capabilities that the new session should have. | ||
* @param {CapabilitiesRequest} capabilities - The capabilities that the new session should have. | ||
* @return {Promise<SessionNewResult>} Promise object represents the newly created session. | ||
* @throws {Error} When unable to create a session. | ||
*/ | ||
newSession(capabilities: sessionCapabilitiesRequest): Promise<SessionNewResult>; | ||
new(capabilities: CapabilitiesRequest): Promise<SessionNewResult>; | ||
/** | ||
@@ -65,3 +65,3 @@ * Ends the active session. | ||
*/ | ||
endSession(): Promise<void>; | ||
end(): Promise<void>; | ||
} |
{ | ||
"name": "wd-bidi", | ||
"version": "0.0.4-alpha-18", | ||
"version": "0.0.4-alpha-19", | ||
"description": "WebDriver BiDi API for automation testing", | ||
@@ -5,0 +5,0 @@ "main": "./build/cjs/index.js", |
199801
171
4957