我关注https://github.com/igniteram/protractor-cucumber-typescript 在功能文件中,我添加了一个When-Sentence
WHEN something else
以及步骤定义中的相应步骤:
When(/^something else $/, async () => {
return expect(browser.getTitle()).to.eventually.equal('Google');
});
这是带有stepdefinitions(homePage.ts)的文件:
import { browser } from 'protractor';
import { SearchPageObject } from '../pages/searchPage';
import { defineSupportCode } from 'cucumber';
let chai = require('chai').use(require('chai-as-promised'));
let expect = chai.expect;
defineSupportCode(({ Given, When, Then }) => {
let search: SearchPageObject = new SearchPageObject();
Given(/^I am on google page$/, async () => {
await expect(browser.getTitle()).to.eventually.equal('Google');
});
When(/^something else $/, async () => {
return expect(browser.getTitle()).to.eventually.equal('Google');
});
Then(/^and something more$/,() => {
return expect(browser.getTitle()).to.eventually.equal('Google');
});
})
当我运行量角器时,找不到步骤:
1) Scenario: Cucumber Google Search - features\cucumber.feature:4
Step: When something else - features\cucumber.feature:6
Message: Undefined. Implement with the following snippet:
When('something else', function (callback) {
// Write code here that turns the phrase above into concrete actions
callback(null, 'pending');
});
如何找到这一步?