1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-18 09:35:20 +02:00
joplin/packages/app-desktop/integration-tests/models/GoToAnything.ts

34 lines
966 B
TypeScript

import { ElectronApplication, expect, Locator, Page } from '@playwright/test';
import MainScreen from './MainScreen';
import activateMainMenuItem from '../util/activateMainMenuItem';
export default class GoToAnything {
public readonly containerLocator: Locator;
public readonly inputLocator: Locator;
public constructor(page: Page, private readonly mainScreen: MainScreen) {
this.containerLocator = page.locator('.go-to-anything-dialog[open]');
this.inputLocator = this.containerLocator.getByRole('textbox');
}
public async open(electronApp: ElectronApplication) {
await this.mainScreen.waitFor();
await activateMainMenuItem(electronApp, 'Goto Anything...');
return this.waitFor();
}
public async waitFor() {
await this.containerLocator.waitFor();
}
public async expectToBeClosed() {
await expect(this.containerLocator).not.toBeAttached();
}
public async expectToBeOpen() {
await expect(this.containerLocator).toBeAttached();
}
}