量角器+黄瓜错误:CompositeParserException:角度2中的分析器错误

时间:2017-06-14 10:02:47

标签: angular protractor cucumber cucumberjs angular2-testing

运行量角器conf.js时出现此错误**CompositeParserException: Parser errors : (2:1): expected: #EOF, #Language, #TagLine, #FeatureLine, #Comment, #Empty, got 'Given I am on the "home"'**我指的是这个https://github.com/protractor-cucumber-framework/protractor-cucumber-framework来配置黄瓜。 这些是使用的版本

"protractor-cucumber-framework": "^3.1.2", "@angular/core": "2.4.10",protractor:5.1.2

这是我的示例代码。

// e2e/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/*.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'
    }

    //e2e/cucumber/sample.feature
    Feature: The Demontrator Dashboard has 2 views, Detail view and Custom view
    Scenario: I  want to have 2 tabs with Displayed text "Detail View" and 
    "Custom  View" on the homepage 
    Given I am on the "home"
    And I click on the "Detail View" tab
    Then the detail view page is displayed
   And I click on the "Custom View" 
   Then the custom view page is displayed

//e2e/cucumber/home.js
'use strict';

module.exports = function worldView() {
    return {
        url: "#/",
        getFieldByName: function (name) {
            var mapping = {
                "Detail View": 'input[href="#/detailView"]',
                "Custom View": 'input[href="#/customlView"]'
            };

            return mapping[name];
        }
    };

}();
    //e2e/cucumber/detailView.js
    'use strict';
    module.exports = function home() {
    return {
    url: "#/detailView"
    };
    }();

0 个答案:

没有答案