UNPKG

@serenity-js/protractor

Version:

Adapter that integrates @serenity-js/web with Protractor, enabling Serenity/JS reporting and using the Screenplay Pattern to write end-to-end test scenarios

75 lines 3.31 kB
import { URL } from 'node:url'; import type { CorrelationId } from '@serenity-js/core/lib/model'; import type { Cookie, CookieData, ModalDialogHandler, PageElements, Selector } from '@serenity-js/web'; import { Key, Page, PageElement } from '@serenity-js/web'; import type * as protractor from 'protractor'; import type { ProtractorBrowsingSession } from './ProtractorBrowsingSession'; import type { ProtractorErrorHandler } from './ProtractorErrorHandler'; /** * Protractor-specific implementation of [`Page`](https://serenity-js.org/api/web/class/Page/). * * @group Models */ export declare class ProtractorPage extends Page<protractor.ElementFinder> { private readonly browser; private readonly errorHandler; private lastScriptExecutionSummary; private dehydrator; constructor(session: ProtractorBrowsingSession, browser: protractor.ProtractorBrowser, modalDialogHandler: ModalDialogHandler, errorHandler: ProtractorErrorHandler, pageId: CorrelationId); createPageElement(nativeElement: protractor.ElementFinder): PageElement<protractor.ElementFinder>; locate(selector: Selector): PageElement<protractor.ElementFinder>; locateAll(selector: Selector): PageElements<protractor.ElementFinder>; /** * If set to `false`, Protractor will not wait for Angular 1.x `$http` and `$timeout` * tasks to complete before interacting with the browser. * * This can be useful when: * - you need to switch to a non-Angular app during your tests, e.g. to sign in using an SSO gateway * - your app continuously polls an API with `$timeout` * * If you're not testing an Angular app, it's better to disable Angular synchronisation completely * in protractor configuration: * * ```js * // protractor.conf.js * exports.config = { * onPrepare: function () { * return browser.waitForAngularEnabled(false) * }, * * // ... other config * } * ``` * * @param enable */ enableAngularSynchronisation(enable: boolean): Promise<boolean>; navigateTo(destination: string): Promise<void>; navigateBack(): Promise<void>; navigateForward(): Promise<void>; reload(): Promise<void>; sendKeys(keys: (string | Key)[]): Promise<void>; executeScript<Result, InnerArguments extends any[]>(script: string | ((...parameters: InnerArguments) => Result), ...args: InnerArguments): Promise<Result>; executeAsyncScript<Result, Parameters extends any[]>(script: string | ((...args: [...parameters: Parameters, callback: (result: Result) => void]) => void), ...args: Parameters): Promise<Result>; lastScriptExecutionResult(): any; takeScreenshot(): Promise<string>; cookie(name: string): Promise<Cookie>; setCookie(cookieData: CookieData): Promise<void>; deleteAllCookies(): Promise<void>; title(): Promise<string>; name(): Promise<string>; url(): Promise<URL>; viewportSize(): Promise<{ width: number; height: number; }>; setViewportSize(size: { width: number; height: number; }): Promise<void>; close(): Promise<void>; closeOthers(): Promise<void>; isPresent(): Promise<boolean>; private inContextOfThisPage; } //# sourceMappingURL=ProtractorPage.d.ts.map