CodeceptJS icon indicating copy to clipboard operation
CodeceptJS copied to clipboard

Protractor browser property create miss configuration

Open xeonarno opened this issue 8 years ago • 4 comments

What are you trying to achieve?

Start simple run with no main browser but defined just the capabilities.

In fact, in Protractor helper, there is a browser property that is redundant with the capabilities property. If you defined it empty , it generates errors, if you remove the property, it generates automatically "Chrome" browser regardless the capabilities property (browserName for example) which creates strange behavior with Selenium Server.

What do you get instead?

Provide console output if related. Use --verbose mode for more details.

Error: Can't connect to WebDriver.
TypeError: Target browser must be a string, but is <undefined>; did you forget to call forBrowser()?

Please make sure Selenium Server (ChromeDriver or PhantomJS) is running and accessible

Details

  • CodeceptJS version: CodeceptJS v1.4.2
  • NodeJS Version: v10.11.0
  • Operating System: osx 10.14 Mojave
  • Protractor
  • Configuration file:
{
  "tests": "./../ui/**/!(_)*_test.ts",
  "timeout": 60000,
  "output": "./../test-reports/screenshots/",
  "helpers": {
    "CrossBT": {
      "require": "./helpers/CrossBT_helper.js",
      "defaultHost": "https://data-staging.xxxxx-xxxxx.io"
    },
    "Protractor": {
      "browser": "",
      "url": "https://data-staging.xxxxx-xxxxx.io",
      "defaultHost": "https://data-staging.xxxxx-xxxxx.io",
      "baseUrl": "https://data-staging.xxxxx-xxxxx.io",
      "driver": "hosted",
      "rootElement": "body",
      "allScriptsTimeout": 60000,
      "smartWait": 5000,
      "useAllAngular2AppRoots": true,
      "restart": false,
      "manualStart": false,
      "seleniumAddress": "http://[email protected]:[email protected]:80/wd/hub",
      "multiCapabilities": [
        {
          "build": "v3.0.0 alpha",
          "record_video": "true",
          "record_network": "true",
          "record_snapshot": "true",
          "username": "[email protected]",
          "password": "xxxxx",
          "chromeOptions": {
            "prefs": {
              "download": {
                "prompt_for_download": false,
                "directory_upgrade": true,
                "default_directory": "/Users/xxxxx/Dev/nodejs/xxxxx/front/test/data"
              }
            }
          },
          "browserName": "Chrome",
          "version": "68",
          "platform": "Windows 10",
          "screenResolution": "1366x768",
          "name": "Oct-08 11:37 > Chrome -- "
        },
        {
          "build": "v3.0.0 alpha",
          "record_video": "true",
          "record_network": "true",
          "record_snapshot": "true",
          "username": "[email protected]",
          "password": "xxxxx",
          "chromeOptions": {
            "prefs": {
              "download": {
                "prompt_for_download": false,
                "directory_upgrade": true,
                "default_directory": "/Users/xxxxx/Dev/nodejs/xxxxx/front/test/data"
              }
            }
          },
          "browserName": "Chrome",
          "version": "63",
          "platform": "Windows 8",
          "screenResolution": "1920x1080",
          "name": "Oct-08 11:37 > Chrome -- "
        },
        {
          "build": "v3.0.0 alpha",
          "record_video": "true",
          "record_network": "true",
          "record_snapshot": "true",
          "username": "[email protected]",
          "password": "xxxxx",
          "browserName": "Internet Explorer",
          "version": "10",
          "platform": "Windows 8",
          "screenResolution": "1366x768",
          "name": "Oct-08 11:37 > Internet Explorer -- "
        },
        {
          "build": "v3.0.0 alpha",
          "record_video": "true",
          "record_network": "true",
          "record_snapshot": "true",
          "username": "[email protected]",
          "password": "xxxxx",
          "browserName": "Safari",
          "version": "11",
          "platform": "Mac OSX 10.13",
          "screenResolution": "1366x768",
          "name": "Oct-08 11:37 > Safari -- "
        }
      ]
    },
    "Mochawesome": {
      "uniqueScreenshotNames": "true"
    },
    "FileSystem": {}
  },
  "noGlobals": false,
  "angular": true,
  "mocha": {
    "reporterOptions": {
      "codeceptjs-cli-reporter": {
        "stdout": "-",
        "options": {
          "verbose": false,
          "steps": true
        }
      },
      "mochawesome": {
        "stdout": "-",
        "options": {
          "reportDir": "./test/test-reports/html/",
          "reportFilename": "index"
        }
      },
      "xunit": {
        "stdout": "-",
        "options": {
          "output": "./test/test-reports/results.xml"
        }
      }
    }
  },
  "multiple": {
    "basic": {
      "chunks": 2,
      "browsers": [
        "Chrome",
        "Firefox"
      ]
    }
  },
  "include": {
    "I": "./helpers/customActor.js"
  },
  "bootstrap": "./helpers/PreProcess.js"
}

xeonarno avatar Oct 08 '18 10:10 xeonarno

Default config for Protractor as I could see in framework is chrome if you don't specify it and leaving that value blank would give error.

_validateConfig(config) { const defaults = { browser: 'chrome', url: 'http://localhost', seleniumAddress: 'http://localhost:4444/wd/hub', fullPageScreenshots: false, rootElement: 'body', allScriptsTimeout: 10000, scriptTimeout: 10000, waitForTimeout: 1000, // ms windowSize: null, getPageTimeout: 10000, driver: 'hosted', capabilities: {}, angular: true, restart: true, };

kobenguyent avatar Oct 08 '18 10:10 kobenguyent

I saw that, but it's wrong, it should take the browserName value in the capabilities, shouldn't it ?

xeonarno avatar Oct 08 '18 15:10 xeonarno

I guess there would be a rework on this to handle multiCapabilities nicely.

kobenguyent avatar Oct 09 '18 10:10 kobenguyent

I will work on that later ....

xeonarno avatar Oct 09 '18 22:10 xeonarno