UNPKG

playwright-fluent

Version:
25 lines (24 loc) 1.14 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const SUT = tslib_1.__importStar(require("../index")); describe('invoke method on handle', () => { // eslint-disable-next-line @typescript-eslint/no-empty-function beforeEach(() => { }); test('should throw an error when the selector is undefined', async () => { // Given const handle = undefined; // When // Then const expectedError = new Error("Cannot invoke method 'click' on 'foobar' because selector was not found in DOM"); await SUT.invokeMethodOnHandle('click', handle, 'foobar').catch((error) => expect(error).toMatchObject(expectedError)); }); test('should throw an error when the selector is null', async () => { // Given const handle = null; // When // Then const expectedError = new Error("Cannot invoke method 'click' on 'foobar' because selector was not found in DOM"); await SUT.invokeMethodOnHandle('click', handle, 'foobar').catch((error) => expect(error).toMatchObject(expectedError)); }); });