Convert spotlight tests to playwright (#12033)
* Convert tests * Use existing code * Remove code from settings * Change names * Change comment * Update comment
This commit is contained in:
parent
7508e62eda
commit
d1562befc4
3 changed files with 408 additions and 460 deletions
|
@ -28,8 +28,13 @@ export class Spotlight {
|
|||
constructor(private page: Page) {}
|
||||
|
||||
public async open() {
|
||||
await this.page.keyboard.press(`${CommandOrControl}+KeyK`);
|
||||
this.root = this.page.locator('[role=dialog][aria-label="Search Dialog"]');
|
||||
const isSpotlightAlreadyOpen = !!(await this.root.count());
|
||||
if (isSpotlightAlreadyOpen) {
|
||||
// Close dialog if it is already open
|
||||
await this.page.keyboard.press(`${CommandOrControl}+KeyK`);
|
||||
}
|
||||
await this.page.keyboard.press(`${CommandOrControl}+KeyK`);
|
||||
}
|
||||
|
||||
public async filter(filter: Filter) {
|
||||
|
@ -49,10 +54,18 @@ export class Spotlight {
|
|||
}
|
||||
|
||||
public async search(query: string) {
|
||||
await this.root.locator(".mx_SpotlightDialog_searchBox").getByRole("textbox", { name: "Search" }).fill(query);
|
||||
await this.searchBox.getByRole("textbox", { name: "Search" }).fill(query);
|
||||
}
|
||||
|
||||
public get searchBox() {
|
||||
return this.root.locator(".mx_SpotlightDialog_searchBox");
|
||||
}
|
||||
|
||||
public get results() {
|
||||
return this.root.locator(".mx_SpotlightDialog_section.mx_SpotlightDialog_results .mx_SpotlightDialog_option");
|
||||
}
|
||||
|
||||
public get dialog() {
|
||||
return this.root;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue