* Gets a `HarnessPredicate` that can be used to search for a `TabHarness` * that meets certain criteria. * @param options Options for filtering which tab instances are considered a match. * @return a `HarnessPredicate` configured with the given options.
(options: TabHarnessFilters = {})
| 25 | * @return a `HarnessPredicate` configured with the given options. |
| 26 | */ |
| 27 | static with(options: TabHarnessFilters = {}): HarnessPredicate<TabHarness> { |
| 28 | return new HarnessPredicate(TabHarness, options) |
| 29 | .addOption('title', options.title, (harness, title) => |
| 30 | HarnessPredicate.stringMatches(harness.getTitle(), title), |
| 31 | ) |
| 32 | .addOption( |
| 33 | 'selected', |
| 34 | options.selected, |
| 35 | async (harness, selected) => (await harness.isSelected()) === selected, |
| 36 | ) |
| 37 | .addOption( |
| 38 | 'disabled', |
| 39 | options.disabled, |
| 40 | async (harness, disabled) => (await harness.isDisabled()) === disabled, |
| 41 | ); |
| 42 | } |
| 43 | |
| 44 | /** Gets the tab's title text. */ |
| 45 | async getTitle(): Promise<string> { |
no test coverage detected