不断收到TypeError:运行回归测试时config.suite.split不是函数 [英] Keep getting TypeError: config.suite.split is not a function when running regression tests

查看:64
本文介绍了不断收到TypeError:运行回归测试时config.suite.split不是函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行样本回归测试时出现以下错误:

I got the following error when running a sample regression test:

TypeError: config.suite.split is not a function

这是配置文件.看起来还可以,但我一定错过了一些东西,但我不能诚实地找到可能的东西.

Here is the the configuration file. It looks ok but I must have missed something but I can't honestly find what it could be.

Configuration.js文件(几天前已在运行)

var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');

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

  onPrepare: function() {
      browser.driver.manage().window().maximize(); 

      jasmine.getEnv().addReporter(
                new Jasmine2HtmlReporter({
                  savePath: 'target/screenshots'
                })
              );




  },// end of onPrepare

  suite:
      {
      Smoke  : ['ChainLocator.js','dropDowns.js'],
      Regression : 'nonAnuglarSpec.js'

      },



//Options to be passed to Jasmine-node.
  jasmineNodeOpts: {
    showColors: true, // Use colors in the command line report.
  }

}

这是package.json文件.这里的问题可以,但老实说不知道

This is the package.json file. Could the issues here but honestly don't know

{
  "name": "LocatorTraining",

  "dependencies": {

"protractor":  "^5.4.1",
"jasmine-data-provider": "^2.2.0",
"protractor-jasmine2-html-reporter":"^0.0.7"



  },


  "scripts": {

 "webdriver-update": "./node_modules/.bin/webdriver-manager update",
"webdriver-start": "./node_modules/.bin/webdriver-manager start",
"protractor": "./node_modules/.bin/protractor configurations.js",
"SmokeTest": "./node_modules/.bin/protractor configurations.js  --suite Smoke",
"RegressionTest": "./node_modules/.bin/protractor configurations.js  --suite Regression",

 "start": "npm run webdriver-update && npm run webdriver-start"

  }

}

来自终端的消息.

Jacquelines-MacBook-Air:LocatorTraining jacquelinegeorge$ npm run RegressionTest

> LocatorTraining@ RegressionTest /Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining
> protractor configurations.js  --suite Regression

/Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/node_modules/q/q.js:155
                throw e;
                ^

TypeError: config.suite.split is not a function
    at Function.getSpecs (/Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/node_modules/protractor/built/configParser.js:86:26)
    at new TaskScheduler (/Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/node_modules/protractor/built/taskScheduler.js:34:100)
    at helper.runFilenameOrFn_.then.then.then (/Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/node_modules/protractor/built/launcher.js:175:25)
    at _fulfilled (/Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/node_modules/q/q.js:834:54)
    at /Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/node_modules/q/q.js:863:30
    at Promise.promise.promiseDispatch (/Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/node_modules/q/q.js:796:13)
    at /Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/node_modules/q/q.js:604:44
    at runSingle (/Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/node_modules/q/q.js:137:13)
    at flush (/Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/node_modules/q/q.js:125:13)
    at internalTickCallback (internal/process/next_tick.js:70:11)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! LocatorTraining@ RegressionTest: `protractor configurations.js  --suite Regression`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the LocatorTraining@ RegressionTest script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/jacquelinegeorge/.npm/_logs/2018-11-07T14_32_24_804Z-debug.log

将套件修改为套件"确实解决了部分问题.但是收到以下错误消息:

[21:38:02] I/launcher - Running 1 instances of WebDriver
[21:38:02] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
Started
F

Failures:
1) Opening non Angular website Opening google page
  Message:
    WebDriverError: unknown error: failed to change window state to maximized, current state is normal
      (Session info: chrome=70.0.3538.77)
      (Driver info: chromedriver=2.43.600229 (3fae4d0cda5334b4f533bede5a4787f7b832d052),platform=Mac OS X 10.13.6 x86_64)
  Stack:
    WebDriverError: unknown error: failed to change window state to maximized, current state is normal
      (Session info: chrome=70.0.3538.77)
      (Driver info: chromedriver=2.43.600229 (3fae4d0cda5334b4f533bede5a4787f7b832d052),platform=Mac OS X 10.13.6 x86_64)
        at Object.checkLegacyResponse (/Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/node_modules/selenium-webdriver/lib/error.js:546:15)
        at parseHttpResponse (/Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/node_modules/selenium-webdriver/lib/http.js:509:13)
        at doSend.then.response (/Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/node_modules/selenium-webdriver/lib/http.js:441:30)
        at process.internalTickCallback (internal/process/next_tick.js:77:7)
    From: Task: WebDriver.manage().window().maximize()
        at thenableWebDriverProxy.schedule (/Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/node_modules/selenium-webdriver/lib/webdriver.js:807:17)
        at Window.maximize (/Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/node_modules/selenium-webdriver/lib/webdriver.js:1686:25)
        at onPrepare (/Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/configurations.js:11:37)
        at q_1.Promise (/Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/node_modules/protractor/built/util.js:46:49)
        at Function.promise (/Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/node_modules/q/q.js:682:9)
        at Object.runFilenameOrFn_ (/Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/node_modules/protractor/built/util.js:38:16)
        at plugins_.onPrepare.then (/Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/node_modules/protractor/built/runner.js:98:27)
        at _fulfilled (/Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/node_modules/q/q.js:834:54)
        at /Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/node_modules/q/q.js:863:30
        at Promise.promise.promiseDispatch (/Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/node_modules/q/q.js:796:13)

1 spec, 1 failure
Finished in 0.143 seconds


[21:38:06] I/launcher - 0 instance(s) of WebDriver still running
[21:38:06] I/launcher - chrome #01 failed 1 test(s)
[21:38:06] I/launcher - overall: 1 failed spec(s)
[21:38:06] E/launcher - Process exited with error code 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! LocatorTraining@ RegressionTest: `protractor configurations.js  --suite Regression`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the LocatorTraining@ RegressionTest script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/jacquelinegeorge/.npm/_logs/2018-11-07T21_38_06_831Z-debug.log
Jacquelines-MacBook-Air:LocatorTraining jacquelinegeorge$ 

推荐答案

就像 https://www.protractortest.org/#/page-objects 建议您配置的suites必须为复数形式,而不是suite

Just as https://www.protractortest.org/#/page-objects suggests your config's suites must be plural, not suite

但是,在cmd行中,应该使用--suite(而不是--suites)提供在配置文件的suites块中定义的套件名称.

However in cmd line, you should use --suite (not --suites) to give the suite name you defined in suites block in your config file.

这篇关于不断收到TypeError:运行回归测试时config.suite.split不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆