MOBILE-4081 behat: Improve debugging ergonomics

main
Noel De Martin 2022-12-15 13:04:49 +01:00
parent 84668aa639
commit 7191626f2c
1 changed files with 9 additions and 1 deletions

View File

@ -333,7 +333,15 @@ export class TestingBehatRuntimeService {
* @param locator Element locator.
* @returns OK if successful, or ERROR: followed by message
*/
async press(locator: TestingBehatElementLocator): Promise<string> {
async press(locator: TestingBehatElementLocator): Promise<string>;
async press(text: string, nearText?: string): Promise<string>;
async press(locatorOrText: TestingBehatElementLocator | string, nearText?: string): Promise<string> {
const locator = typeof locatorOrText === 'string' ? { text: locatorOrText } : locatorOrText;
if (nearText) {
locator.near = { text: nearText };
}
this.log('Action - Press', locator);
try {