playwright-fluent
Version:
Fluent API around playwright
31 lines (30 loc) • 1.14 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const fluent_api_1 = require("../../../../fluent-api");
const SUT = tslib_1.__importStar(require("../index"));
const handle_actions_1 = require("../../../handle-actions");
describe('switch to iframe from selector object', () => {
let p;
beforeEach(() => {
p = new fluent_api_1.PlaywrightFluent();
});
afterEach(async () => {
await p.close();
});
test('should throw an error when browser has not been launched', async () => {
// Given
// When
let result = undefined;
try {
const selector = p.selector('foobar');
await SUT.switchFromSelectorObjectToIframe(selector, p.currentPage(), handle_actions_1.defaultSwitchToIframeOptions);
}
catch (error) {
result = error;
}
// Then
const expectedErrorMessage = "Cannot switch to iframe from 'selector(foobar)' because no browser has been launched";
expect(result && result.message).toContain(expectedErrorMessage);
});
});
;