Following is the test case,
const browserActions = new BrowserActions();
describe('browserUtilities', () => {
beforeEach(() => {
global.browser = {
getUrl: jest.fn(),
getTitle: jest.fn(),
};
});
it('should call deleteCookies on the browser', async () => {
await browserActions.getUrlAndTitle();
expect(global.browser.getUrl).toHaveBeenCalledTimes(2);
expect(global.browser.getTitle).toHaveBeenCalledTimes(2);
});
});
If I make this class .js file, then the code is running fine. But if I make this class .ts (TypeScript) file, I am getting the error as follows,
e2e/test/support/action/browserUntil.spec.ts:7:12 - error TS2339: Property 'browser' does not exist on type 'typeof globalThis'.