黄瓜测试不在浏览器中运行

时间:2018-06-22 11:15:17

标签: javascript html angular

我在黄瓜和保护器框架中具有此功能:

const assert = require('assert');
const {
    Given,
    When,
    Then
} = require('cucumber');

var chai = require('chai');
var chaiAsPromised = require('chai-as-promised');

chai.use(chaiAsPromised);
var expect = chai.expect;

Given('I go to the page', function() {
    browser.driver.manage().window().maximize();
    browser.get('http://localhost:8080/#/').then();

});

When('I click the add button', function() {
    element(by.css("*[id='account-menu'] > span > span > span")).click();

});

Then('I should see my new task in the list', function() {
    expect(true).to.equal(true);

});

我可以使用此配置文件cumul.js执行它:

exports.config = {
    baseUrl: 'http://localhost:8080/#/',
    specs: [
        './e2e_cucumber/features/*.feature'
    ],
    framework: 'custom',
    allScriptsTimeout: 110000,
    cucumberOpts: {
        require: ['./e2e_cucumber/features/step_definitions/*.js'],
        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)
        'dry-run': false, // <boolean> invoke formatters without executing steps
        compiler: [] // <string[]> ("extension:module") require files with the given EXTENSION after requiring MODULE (repeatable)
    },
    directConnect: true,
    capabilities: {
        'browserName': 'chrome'
    },
    frameworkPath: require.resolve('protractor-cucumber-framework'),
    onPrepare: function() {
        browser.manage().window().maximize(); // maximize the browser before executing the feature files
    },
};

现在它说测试通过了,但是浏览器只打开一秒钟然后关闭,我没有看到任何点击或浏览器上的东西。同时,如果我超时,它似乎保持打开状态并工作得更好,但随后输出错误,如下所示:enter link description here 我的package.json中有这个:

"protractor": "~5.3.1",
"protractor-cucumber-framework": "^5.0.0",
"cucumber": "^2.3.1",

是否有关于黄瓜量角器配置的东西?

0 个答案:

没有答案