Skip to content

Commit

Permalink
rename screenshot method
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolayAvramov committed Jan 30, 2025
1 parent c29c49a commit f201943
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion @bellatrix/appium/src/android/AndroidDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export class AndroidDriver extends AppiumDriver {
});
}

async getScreenshot(): Promise<Image> {
async takeScreenshot(): Promise<Image> {
const base64image = await this.commandExecutor.execute<Promise<string>>(MobileCommands.SCREENSHOT);
return Image.fromBase64(base64image);
}
Expand Down
3 changes: 2 additions & 1 deletion @bellatrix/extras/src/plugins/ScreenshotOnFailPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class ScreenshotOnFailPlugin extends Plugin {
}

const app = ServiceLocator.resolve(App);
const screenshotImage = await app.browser.getScreenshot();
const screenshotImage = await app.browser.takeScreenshot();

const outputPath = pluginSettings?.outputPath;

Expand Down Expand Up @@ -77,4 +77,5 @@ interface ScreenshotOnFailPluginSettings {
isPluginEnabled: boolean;
outputPath: string,
shouldCreateFolderPerSuite?: boolean,
shouldCaptureFullPage?: boolean,
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export abstract class BrowserController implements SearchContext {
abstract getCookie(name: string): Promise<Cookie | null>;
abstract getAllCookies(): Promise<Cookie[]>;
abstract clearCookies(): Promise<void>;
abstract getScreenshot(): Promise<Image>;
abstract takeScreenshot(): Promise<Image>;
abstract executeJavascript<T, VarArgs extends unknown[] = []>(script: string | ((...args: VarArgs) => T), ...args: VarArgs): Promise<T>;
abstract waitUntil(condition: (browserController: Omit<BrowserController, 'waitUntil'>) => boolean | Promise<boolean>, timeout: number, pollingInterval: number): Promise<void>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class PlaywrightBrowserController extends BrowserController {
return await this._page.content();
}

override async getScreenshot(): Promise<Image> {
override async takeScreenshot(): Promise<Image> {
return await Image.fromBase64((await this._page.screenshot()).toString('base64'));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class SeleniumBrowserController extends BrowserController {
return await this.wrappedDriver.getPageSource();
}

override async getScreenshot(): Promise<Image> {
override async takeScreenshot(): Promise<Image> {
const base64image = (await this.wrappedDriver.takeScreenshot());
return Image.fromBase64(base64image);
}
Expand Down
4 changes: 2 additions & 2 deletions @bellatrix/web/src/services/BrowserService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export class BrowserService extends WebService {
return await this.driver.getPageSource();
}

async getScreenshot(): Promise<Image> {
const base64image = (await this.driver.getScreenshot()).base64;
async takeScreenshot(): Promise<Image> {
const base64image = (await this.driver.takeScreenshot()).base64;
return Image.fromBase64(base64image);
}

Expand Down

0 comments on commit f201943

Please sign in to comment.