从命令调色板使用量角器测试运行器(VS代码)

时间:2017-04-20 08:05:33

标签: protractor visual-studio-code

我是Protractor的新手。我从Command Pallette(Ctrl-Shift-PF1)运行它时遇到问题。我正在使用:VS Code 1.11.2和Protractor 5.1.1。

  • 从终端开始工作。 protractor protractor/protractor.conf.js
  • 来自Debug>启动它。
  • 然而,当从视图>命令Pallette>量角器:运行测试,我收到错误:**you must either specify a configuration file or at least 3 options. See below for the options:...

文件夹结构

..demo
....package.json
....node_modules
....protractor
........protractor.conf.js
........spec.js

protractor.conf.js

exports.config = {  
  framework: 'jasmine',
  capabilities: {
    browserName: 'chrome'
  },
  seleniumAddress: 'http://localhost:4444/wd/hub',
  specs: ['protractor_selenium.js']
}; 

spec.js

describe("google show", function(){
    it('should work', function(){
        browser.ignoreSynchronization = true;
        browser.get('https://google.com');            
        //does somethi
        browser.ignoreSynchronization = false;
    });
});

launch.js

{
    "version": "0.2.0",
        {
            "type": "node",
            "request": "launch",
            "name": "Protractor Tests",
            "args": ["${workspaceRoot}/protractor/protractor.conf.js"],            
            "program": "${workspaceRoot}/node_modules/protractor/bin/protractor/"
        },        
        {
            "type": "node",
            "request": "attach",
            "name": "Attach to Port",
            "address": "localhost",
            "port": 5858
        }
    ]
}

1 个答案:

答案 0 :(得分:1)

这不是Visual Studio Code或ProtractorJS功能,这是由第三方插件(https://marketplace.visualstudio.com/items?itemName=luciannaie.protractor-test-runner)实现的。尝试在github上找到作者 - https://github.com/lnaie/vscode-protractor-test-runner/issues/