私はキュウリと分度器を使用して動作テストを作成しています。私のシナリオとすべてのステップは合格しますが、最後にタイムアウトエラーが表示されます。最初のステップでホームページがロードされ、後でステップ定義ファイルに記述されているステップは実行されません。ページが読み込まれたら、タブをクリックします。私はステップ定義ファイルでこれらのステップを述べました。しかし、これらのステップは実行されず、コンソールに渡されたすべてのステップが表示されます。私は、このエラーメッセージキュウリ+分度器 - ステップ実行中のタイムアウトエラー
ある参照https://semaphoreci.com/community/tutorials/getting-started-with-protractor-and-cucumber
ために、このリンクをたどっ以下のサンプルコードを見つけてください。
//sample.feature
Feature: The Dashboard has 2 tabs, Statistics and Results
Scenario: I want to have 2 tabs with Displayed text "Statistics" and "Results" on the homepage
Given I go to Dashboard homepage
And I click on the "#/results"
Then the Results page is displayed
And I click on the "#/Statistics" tab
Then the Statistics page is displayed
//menu.steps.js
var chai = require('chai');
var chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
var expect = chai.expect;
module.exports = function() {
this.Given(/^I go to Dashboard homepage$/, function() {
browser.get('http://localhost:8100/#/');
browser.waitForAngular();
});
this.Then(/^I click on the "([^"]*)"$/,function(arg1){
element(by.css('[href="#/results"]')).click();
});
this.Then(/^the results page is displayed$/,() => {
browser.get('http://localhost:8100/#/results');
});
this.When(/^I click on the "([^"]*)" tab$/, function(arg1) {
element(by.css('[href="#/statistics"]')).click();
});
this.Then(/^the statistics page is displayed$/, () =>{
browser.get('http://localhost:8100/#/statistics');
});
//cucumber.conf.js
exports.config = {
framework: 'custom', // set to "custom" instead of cucumber.
frameworkPath: require.resolve('protractor-cucumber-framework'),
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['test/e2e/cucumber/*.feature'],
capabilities: {
'browserName': 'firefox',
},
baseUrl: 'http://localhost:8100/#/',
// cucumber command line options
cucumberOpts: {
require: ['test/e2e/cucumber/*.steps.js'], // require step definition files before executing features
tags: [], // <string[]> (expression) only execute the features or scenarios with tags matching the expression
strict: true, // <boolean> fail if there are any undefined or pending steps
format: ["pretty"], // <string[]> (type[:path]) specify the output format, optionally supply PATH to redirect formatter output (repeatable)
dryRun: false, // <boolean> invoke formatters without executing steps
compiler: [] // <string[]> ("extension:module") require files with the given EXTENSION after requiring MODULE (repeatable)
},
onPrepare: function() {
browser.manage().window().maximize(); // maximize the browser before executing the feature files
},
resultJsonOutputFile: './test/e2e/results.json'
}
Hey !!約束をもって - 私はTimedエラーを出力します。「関数は、5000ミリ秒後にタイムアウトし、コールバックを受け取ると、私は 'TypeError:プロパティがnotify 'notifyのプロパティを読み取ることができません」というメッセージを返します。 、 – Mythri
' 5000ミリ秒 'デフォルトでは「5000ミリ秒」のタイムアウトになっていますので、これを修正するには[this](https://github.com/cucumber/cucumber-js/blob/1.x/docs/support_files/timeouts.md)をお読みください。 ご希望の場合 – wswebcreation
タイムアウトは最初のステップ 'this.Given(/ ^ダッシュボードのホームページ$ /、{timeout:60 * 1000}、function(){ return browser.get( 'http:// localhost:8100 /#/ '); }); 'と同じ方法で2番目の手順でタイムアウトを追加しましたが、起動時に上記の画像に示すようにタイムアウトエラーが表示されませんでした – Mythri