本文整理汇总了TypeScript中cucumber-tsflow/dist/index.when函数的典型用法代码示例。如果您正苦于以下问题:TypeScript when函数的具体用法?TypeScript when怎么用?TypeScript when使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了when函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: click
@when(pattern([
/^кликнуть (?:на|по) (.*)$/
]))
public async click(selector: string): Promise<void> {
const element: WebElement = await this.getElement(selector);
this.driver.actions().click(element).perform();
}
示例2: afterUrlChange
@when(pattern([
/^дождаться перехода (?:на|в) (.*)$/
]))
public async afterUrlChange(url: string): Promise<string> {
return await this.waitForUrlChange(url, (currentUrl: string) => {
const diff: string = this.diff(currentUrl, url, '(', ')');
throw new Error(`Время ожидания ${url} истекло ${diff}`);
});
}
示例3: fillInput
/**
* @param selector
* @param value
*/
@when(pattern([
// /^ввести в (.*?(?= (?:текст|цифр.?|значение)| ')).*'([^']*)'$/
/^ввести в (.*) (?:значение|текст|число) '(.*)'$/
]))
public async fillInput(selector: string, value: string): Promise<void> {
const input: WebElement = await this.getElement(selector);
return await this.driver.actions()
.click(input)
.sendKeys(value)
.perform();
}
示例4: navigateToPage
@when(pattern([
/^перейти (?:на|в) (.*)$/
]))
public async navigateToPage(url: string): Promise<void> {
return await this.navigateToUrl(url);
}
示例5: reloadPage
@when(pattern([
/обновить страницу/
]))
public async reloadPage(): Promise<void> {
return await driver.navigate().refresh();
}