本文整理汇总了TypeScript中cucumber.Then函数的典型用法代码示例。如果您正苦于以下问题:TypeScript Then函数的具体用法?TypeScript Then怎么用?TypeScript Then使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Then函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: When
await browser.manage().window().maximize();
await browser.get(siteUrl);
});
When('I add two numbers {string} and {string}', async (num1, num2) => {
await calc.firstTextBox.sendKeys(num1);
await calc.secondTextBox.sendKeys(num2);
});
Then('output displayed is {string}', async (text) => {
await calc.goButton.click();
await calc.result.getText().then(function (repeaterText) {
console.log("The output of Calculator addition is -> " + repeaterText);
});
});
When('I click on header link', async () => {
await angularPage.angularLink.click();
});
When('I navigate to Angular page', async () => {
await console.log("dummy when() ... ");
});
开发者ID:ashutoshchittora,项目名称:TypeScriptCucumberProtractorVisualStudioCode,代码行数:31,代码来源:demoStepDefinition.ts
示例2: StepSampleWithoutDefineSupportCode
function StepSampleWithoutDefineSupportCode() {
setWorldConstructor(function({attach, parameters}) {
this.attach = attach;
this.parameters = parameters;
this.visit = (url: string, callback: Callback) => {
callback(null, 'pending');
};
this.toInt = parseInt;
});
Before((scenarioResult: HookScenarioResult, callback: Callback) => {
console.log(scenarioResult.result.status === Status.FAILED);
callback();
});
Before({ timeout: 1000 }, (scenarioResult: HookScenarioResult, callback: Callback) => {
console.log(scenarioResult.result.status === Status.FAILED);
callback();
});
Before('@tag', (scenarioResult: HookScenarioResult, callback: Callback) => {
console.log(scenarioResult.result.status === Status.FAILED);
callback();
});
BeforeAll((callback: Callback) => {
console.log("Before all");
callback();
});
BeforeAll({ timeout: 1000 }, (callback: Callback) => {
console.log("Before all");
callback();
});
BeforeAll('@tag', (callback: Callback) => {
console.log("Before all");
callback();
});
After((scenarioResult: HookScenarioResult, callback: Callback) => {
console.log("After");
callback();
});
After({ timeout: 1000 }, (scenarioResult: HookScenarioResult, callback: Callback) => {
console.log("After");
callback();
});
After('@tag', (scenarioResult: HookScenarioResult, callback: Callback) => {
console.log("After");
callback();
});
AfterAll((callback: Callback) => {
console.log("After all");
callback();
});
AfterAll({ timeout: 1000 }, (callback: Callback) => {
console.log("After all");
callback();
});
AfterAll('@tag', (callback: Callback) => {
console.log("After all");
callback();
});
Given(/^a variable set to (\d+)$/, (x: string) => {
console.log("the number is: " + x);
});
Given(/^a variable set to (\d+)$/, (x: number) => {
console.log(typeof x);
});
Given(/^I am on the Cucumber.js GitHub repository$/, function(callback: Callback) {
this.visit('https://github.com/cucumber/cucumber-js', callback);
});
When(/^I go to the README file$/, (title: string, callback: Callback) => {
callback(null, 'pending');
});
Then(/^I should see "(.*)" as the page title$/, {timeout: 60 * 1000}, function(title: string, callback: Callback) {
const pageTitle = this.browser.text('title');
if (title === pageTitle) {
callback();
} else {
callback(new Error("Expected to be on page with title " + title));
}
});
// Type for data_table.js on
// https://github.com/cucumber/cucumber-js/blob/a5fd8251918c278ab2e389226d165cedb44df14a/lib/cucumber/ast/data_table.js
Given(/^a table step with Table raw$/, (table: Table) => {
//.........这里部分代码省略.........
开发者ID:AlexGalays,项目名称:DefinitelyTyped,代码行数:101,代码来源:cucumber-tests.ts
示例3: When
When('I set my team {string}', (team) => {
page.setTeam(team);
});
When('I set my activity {string}', (activity) => {
page.setActivity(activity);
});
When('I set my start date {string}', (startDate) => {
page.setStartDate(startDate);
});
When('I set my end date {string}', (endDate) => {
page.setStartDate(endDate);
});
When('I set my status {word}', (status) => {
page.setStatus(status);
});
When('I click on save button', () => {
page.clickOnSave();
});
Then('I\'m redirected to result page', () => {
page.nextPage().then(url => {
expect(url).to.equal(browser.baseUrl + '/result');
});
});
开发者ID:ronerjr,项目名称:protractor-cucumber,代码行数:29,代码来源:form.steps.ts
示例4: Then
import { expect } from 'chai'
import { Then } from 'cucumber'
import fs from 'fs-extra'
import jsdiffConsole from 'jsdiff-console'
import path from 'path'
import psTreeR from 'ps-tree'
import util from 'util'
const psTree = util.promisify(psTreeR)
Then('I see usage instructions', function() {
this.verifyPrintedUsageInstructions()
})
Then('it creates a directory {string}', async function(directoryPath) {
await fs.stat(path.join(this.rootDir, directoryPath))
})
Then('it creates the file {string} with content:', async function(
filename,
expectedContent
) {
const actualContent = await fs.readFile(path.join(this.rootDir, filename), {
encoding: 'utf8'
})
try {
jsdiffConsole(expectedContent.trim(), actualContent.trim())
} catch (e) {
console.log('MISMATCHING FILE CONTENT!')
console.log(e)
throw new Error()
开发者ID:Originate,项目名称:tutorial-runner,代码行数:31,代码来源:then-steps.ts
示例5: expect
title = data;
expect(title).to.equal('AT&T Community Forums');
console.log(`TITLE: ${data}`);
})
.catch(err => {
console.log(`The error was ${err}`);
});
input = homePage.getSearchInput();
input.sendKeys('asdfasdfasdflkjal;kejf;alskdfj');
});
Then(/^I expect homePage title to be correct$/, () => {
// console.log(input.getSearchInput());
console.log(input.value);
});
When(/^I click the explore button$/, () => {
// browser.wait(EC.visibilityOf(homePage.getExploreBtn()));
console.log('Are we here');
let header = homePage.getHeader();
header.getText()
.then(text => {
console.log('TEXT!!!' + text);
})
.catch(err => {
console.log('error: ' + err);
开发者ID:winedarksea1,项目名称:ProtractorProject,代码行数:31,代码来源:homepage.e2e-spec.ts
示例6: Then
);
}
);
/**
* Then I see
*/
Then('I see a project dir called {string} with file snapshots:', async function(
project: string,
files: TableDefinition
) {
const expected = files.raw().map(([_]) => _);
const target = path.join(this.cwd, project);
expect(target)
.to.be.a.directory()
.with.deep.contents.that.include.members(expected);
for (const filename of expected) {
const contents = fs.readFileSync(path.join(target, filename)).toString();
expect(contents).to.matchSnapshot(
this.snapshot.filename,
`${this.snapshot.testname}-${filename}`
);
}
});
Then('I see {string} with a file size between {int} and {int} bytes', function(
bundle: string,
lower: number,
upper: number
) {
const file = path.join(this.cwd, bundle);
开发者ID:valtech-nyc,项目名称:brookjs,代码行数:32,代码来源:steps.ts
示例7: require
import { browser, protractor } from "protractor";
import { SearchPageObject } from "../pages/searchPage";
const { When, Then } = require("cucumber");
const search: SearchPageObject = new SearchPageObject();
When(/^I type "(.*?)"$/, async (text) => {
await search.searchTextBox.sendKeys(text);
});
Then(/^I click on search button$/, async () => {
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
});
开发者ID:alexrun,项目名称:protractor-cucumber-typescript,代码行数:13,代码来源:search.ts
示例8: require
import { SearchPageObject } from "../pages/searchPage";
const { Then } = require("cucumber");
const search: SearchPageObject = new SearchPageObject();
Then(/^I clear the search text$/, async () => {
await search.searchTextBox.clear();
});
开发者ID:alexrun,项目名称:protractor-cucumber-typescript,代码行数:8,代码来源:clearPage.ts
注:本文中的cucumber.Then函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论