Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

capabilities config mobile #41

Open
webdesignberlin opened this issue Jul 14, 2021 · 3 comments
Open

capabilities config mobile #41

webdesignberlin opened this issue Jul 14, 2021 · 3 comments

Comments

@webdesignberlin
Copy link

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;
@harsh-browserstack
Copy link

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

@webdesignberlin
Copy link
Author

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

@webdesignberlin
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants