playwright-fluent
Version:
Fluent API around playwright
36 lines (35 loc) • 1.25 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 page_actions_1 = require("../../../page-actions");
describe('invoke method on 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
const options = {
...page_actions_1.defaultInvokeOptions,
timeoutInMilliseconds: 1000,
};
// When
let result = undefined;
try {
const selector = p.selector('foobar').find('input');
await SUT.invokeMethodOnSelectorObject('click', selector, options);
}
catch (error) {
result = error;
}
// Then
const expectedErrorMessage = `Cannot invoke method 'click' on 'selector(foobar)
.find(input)' because this selector was not found in DOM`;
expect(result && result.message).toContain(expectedErrorMessage);
});
});
;