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
5 changes: 4 additions & 1 deletion packages/testring-types/src/browser-proxy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ export enum BrowserProxyActions {
getTagName = 'getTagName',
isSelected = 'isSelected',
getText = 'getText',
elementIdSelected = 'elementIdSelected'
elementIdSelected = 'elementIdSelected',
timeoutsAsyncScript = 'timeoutsAsyncScript',
makeScreenshot = 'makeScreenshot',
uploadFile = 'uploadFile'
}

export interface IBrowserProxyCommand {
Expand Down
18 changes: 17 additions & 1 deletion packages/testring-web-application/src/web-application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,22 @@ export class WebApplication extends PluggableModule {

private mainTabID = 1;

private client: WebClient;
protected client: WebClient;

constructor(testUID: string, transport: ITransport) {
super();

this.client = new WebClient(testUID, transport)
}

protected logXpath(xpath) {
return utils.logXpath(xpath);
}

protected normalizeXpath(xpath) {
return utils.normalizeXpath(xpath);
}

public async waitForExist(xpath, timeout = WAIT_TIMEOUT, skipMoveToObject = false) {
xpath = utils.normalizeXpath(xpath);

Expand Down Expand Up @@ -930,4 +938,12 @@ export class WebApplication extends PluggableModule {
return this.getTexts(xpath, trim, timeout);
}

public async makeScreenshot() {
await this.client.makeScreenshot();
}

public async uploadFile(fullPath) {
await this.client.uploadFile(fullPath);
}

}
12 changes: 12 additions & 0 deletions packages/testring-web-application/src/web-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ export class WebClient {
return this.makeRequest(BrowserProxyActions.executeAsync, [fn, args]);
}

public timeoutsAsyncScript(timeout, fn) {
return this.makeRequest(BrowserProxyActions.timeoutsAsyncScript, [timeout, fn]);
}

public getTitle() {
return this.makeRequest(BrowserProxyActions.getTitle, []);
}
Expand Down Expand Up @@ -217,4 +221,12 @@ export class WebClient {
public elementIdSelected(id) {
return this.makeRequest(BrowserProxyActions.elementIdSelected, [id]);
}

public makeScreenshot() {
return this.makeRequest(BrowserProxyActions.makeScreenshot, []);
}

public uploadFile(path) {
return this.makeRequest(BrowserProxyActions.uploadFile, [path]);
}
}