mirror of
https://github.com/Kong/insomnia.git
synced 2026-11-07 13:34:09 -05:00
24 lines
674 B
TypeScript
24 lines
674 B
TypeScript
import type { Locator } from "@playwright/test";
|
|
|
|
import { BaseComponent } from "./base.component";
|
|
|
|
/**
|
|
* `base/file-input-button.tsx` ("Choose File") and similar pickers.
|
|
* Electron's native dialog can't be driven, so the owning page/flow must
|
|
* first stub it (see `FlowContext.stubFileChooser`); this component only
|
|
* clicks and reads the button.
|
|
*/
|
|
export class FileInputComponent extends BaseComponent {
|
|
get button(): Locator {
|
|
return this.root.getByRole("button", { name: "Choose File" });
|
|
}
|
|
|
|
async choose(): Promise<void> {
|
|
await this.button.click();
|
|
}
|
|
|
|
async label(): Promise<string> {
|
|
return (await this.button.innerText()).trim();
|
|
}
|
|
}
|