You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-26 22:41:17 +02:00
Desktop: Accessibility: Improve focus handling for plugin and prompt dialogs (#10801)
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
|
||||
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();
|
||||
|
||||
if (!await activateMainMenuItem(electronApp, 'Goto Anything...')) {
|
||||
throw new Error('Menu item for opening Goto Anything not found');
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ import { Page, Locator, ElectronApplication } from '@playwright/test';
|
||||
import NoteEditorScreen from './NoteEditorScreen';
|
||||
import activateMainMenuItem from '../util/activateMainMenuItem';
|
||||
import Sidebar from './Sidebar';
|
||||
import GoToAnything from './GoToAnything';
|
||||
|
||||
export default class MainScreen {
|
||||
public readonly newNoteButton: Locator;
|
||||
@@ -9,6 +10,7 @@ export default class MainScreen {
|
||||
public readonly sidebar: Sidebar;
|
||||
public readonly dialog: Locator;
|
||||
public readonly noteEditor: NoteEditorScreen;
|
||||
public readonly goToAnything: GoToAnything;
|
||||
|
||||
public constructor(private page: Page) {
|
||||
this.newNoteButton = page.locator('.new-note-button');
|
||||
@@ -16,6 +18,7 @@ export default class MainScreen {
|
||||
this.sidebar = new Sidebar(page, this);
|
||||
this.dialog = page.locator('.dialog-root');
|
||||
this.noteEditor = new NoteEditorScreen(page);
|
||||
this.goToAnything = new GoToAnything(page, this);
|
||||
}
|
||||
|
||||
public async waitFor() {
|
||||
|
||||
Reference in New Issue
Block a user