Skip to content

capabilities config mobile #41

Open

Description

@webdesignberlin

hello, i'm trying to get the mobile project up and running. I looked for the capabilities out of here https://www.browserstack.com/automate/capabilities.

but as soon as I start the test, I get an error: Unknown browser: "iphone"

Ideas or suggestions?
best regards, micha

var capabilities = {
    "os_version" : "14",
    "device" : "iPhone 12",
    "real_mobile" : "false",
    "build" : "nightwatch-browserstack",
    "browserstack.local" : "false",
    "deviceOrientation" : "landscape",
    "browserstack.user" : "xxx",
    "browserstack.key" : "xxx",
    "browserName" : "iPhone"
    };

nightwatch_config = {
    src_folders : [ "tests/single" ],  // Specifies which tests would run
  
    selenium : {
      "start_process" : false,
      "host" : "hub-cloud.browserstack.com",  // Specifies the BrowserStack Hub URL
      "port" : 443
    },
  
    test_settings: {
      default: {
        // The following are the BrowserStack specific capabilities for all your tests that will run using this conf file.
        desiredCapabilities: capabilities,
      }
    }
  };
  
  // Code to copy seleniumhost/port into test settings
  for(var i in nightwatch_config.test_settings){
    var config = nightwatch_config.test_settings[i];
    config['selenium_host'] = nightwatch_config.selenium.host;
    config['selenium_port'] = nightwatch_config.selenium.port;
  }
  
  module.exports = nightwatch_config;

Activity

  1. harsh-browserstack commented on Jul 19, 2021

    @harsh-browserstack

    Hey Micha,

    I can see that you have passed the browserName capability as "iPhone" which is incorrect and hence getting the error, instead, can you put the browser name of your choice to test on eg:- Chrome, Safari, Firefox, and Edge.

    Regards,
    Harsh Pathar
    Browserstack Support

  2. webdesignberlin commented on Jul 22, 2021

    @webdesignberlin
    Author

    Hi Harsh, i get them via the Capabilities Generator: https://www.browserstack.com/automate/capabilities

  3. webdesignberlin commented on Jul 28, 2021

    @webdesignberlin
    Author

    Some Ideas?. If i use the example of https://automate.browserstack.com/dashboard/v2/quick-start/get-started#view-test-results-on-dashboard

    nightwatch_config = {
      src_folders : [ "tests/single" ],
      selenium : {
        "start_process" : false,
        "host" : "hub-cloud.browserstack.com",
        "port" : 80
      },
      common_capabilities: {
        'build': 'browserstack-build-1',
        'browserstack.user': '***',
        'browserstack.key': '***',
        'browserstack.debug': true
      },
      test_settings: {
        default: {},
        env1: {
          desiredCapabilities: {
            "device": "iPad 6th",
            "os_version": "11",
            "browserName": "ios",
            "realMobile": "true"
          }
        },
        /* env2: {
          desiredCapabilities: {
            "browser": "firefox",
            "browser_version": "latest",
            "os": "Windows",
            "os_version": "10"
          }
        },
        env3: {
          desiredCapabilities: {
            "browser": "safari",
            "browser_version": "latest",
            "os": "OS X",
            "os_version": "Big Sur"
          }
        } */
      }
    };
    // Code to support common capabilities
    for(var i in nightwatch_config.test_settings){
      var config = nightwatch_config.test_settings[i];
      config['selenium_host'] = nightwatch_config.selenium.host;
      config['selenium_port'] = nightwatch_config.selenium.port;
      config['desiredCapabilities'] = config['desiredCapabilities'] || {};
      for(var j in nightwatch_config.common_capabilities){
        config['desiredCapabilities'][j] = config['desiredCapabilities'][j] || nightwatch_config.common_capabilities[j];
      }
    }
    module.exports = nightwatch_config;

    i became:

    `./node_modules/.bin/nightwatch -c conf/parallel.conf.js -e env1

    TEST FAILURE: 1 error during execution; 0 tests failed, 0 passed (17ms)
    Error: Unknown browser: "ios"
    `

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions