How to configure browserstack with protractor and mocha - protractor

so I am trying to figure out how to config more correctly with mobile and aswell with desktop. Before I explain my issue, I am using this code:
let SpecReporter = require('mochawesome').SpecReporter;
exports.config = {
"browserstackUser": "helloworld",
"browserstackKey": "123456789",
multiCapabilities: [
//{
// browserName: 'Android',
// device: 'Google Pixel 4 XL',
// os_version: '10.0',
// real_mobile: "true",
// project: "Selenium-Test",
// build: "Build T-Hour",
// name: "Pixel 4 XL Android - Happy Flow"
//},
{
browserName: 'Chrome',
device: 'Samsung Galaxy S9 Plus',
os_version: '9.0',
real_mobile: "true",
project: "Selenium-Test",
build: "Build T-Hour",
name: "Samsung Galaxy S9 Plus Chrome - Happy Flow"
}
],
maxSessions: 1,
mochaOpts: {
reporter: "mochawesome",
timeout: 60000,
},
suites: {
all: 'pagesMobile/*.js',
},
framework: 'mocha',
};
As you can see I have different multiCapabilities where I can add on different browsers whenever I want to test.
However my issue is that I do feel like I am doing it incorrectly because I have entered browserName : Chrome to test on however it still does Samsung browser instead and I am not sure what I am doing wrong anymore.
I do feel like I have set it up incorrectly and I am here asking what I am doing wrong that it doesn't want to run Chrome as a browser from Mobile and also if there is someone that is willing to tell me what I can improve aswell.

BrowserStack currently supports only the Chrome Browser on Android and the Safari Browser on iOS real mobile devices. So, your tests on the Samsung Mobile devices should execute on the Chrome Browser by default.

Related

Ionic 5 Capacitor livereload white screen after re-build

I'm struggling since days with the livereload functionality on my Ionic 5 / Capacitor app. I get on the simulator a white screen after the build is reload, i.e. after a change in the code. When I run the app first time under command "ionic capacitor run ios -l" the app loads perfect in the iOS simulator. After a change in the code I see on CLI that this was compiled successfully. However, in the simulator I stuck on a white screen. I tried many solutions indicated on the web, still having this issue. Is this a known bug on Ionic 5 using capacitor or do you have any idea what could help?
My capacitor config file looks like this:
appId: 'xxxx',
appName: 'xxxx',
webDir: 'www',
bundledWebRuntime: false,
cordova: {
preferences: {
scheme: 'app',
hostname: 'localhost',
ScrollEnabled: 'false',
BackupWebStorage: 'none',
AutoHideSplashScreen: 'false',
SplashMaintainAspectRatio: 'true',
FadeSplashScreenDuration: '200',
SplashShowOnlyFirstTime: 'false',
SplashScreen: 'screen',
SplashScreenDelay: '1000',
loadUrlTimeoutValue: '70000',
ShowSplashScreenSpinner: 'false',
}
}
};
this worked for me:
Option 1: Turn off your VPN if you are using a VPN either on your desktop or your mobile or even both of them.
Option 2: Turn off your windows firewall.

Ionic app creation gets stuck at “ionic start app_name tabs”

I am new to ionic framework, facing below issue while creating first app.
**i am working behind corporate proxy
-> command executed “ionic start hello_ionic tabs”
Error Message :
? The directory hello_ionic contains file(s) that could conflict. Would you like to overwrite the directory with this new project? Yes
√ Creating directory .\hello_ionic - done!
√ Downloading and extracting tabs starter - done!
? Would you like to integrate your new app with Cordova to target native iOS and Android? Yes
√ Personalizing ionic.config.json and package.json - done!
ionic integrations enable cordova --quiet
√ Downloading integration cordova - done!
√ Copying integrations files to project - done!
[OK] Added cordova integration!
Installing dependencies may take several minutes.
IONIC DEVAPP *
Speed up development with the Ionic DevApp, our fast, on-device testing mobile app
Test on iOS and Android without Native SDKs
LiveReload for instant style and JS updates
️ –>Install DevApp:
npm i
Running command
ionic start stuck at “npm i”.
please help me in resolving this issue.
->output of “npm info”
{ name: ‘hello_ionic’,
description: ‘a’,
‘dist-tags’: { latest: ‘1.0.0’ },
versions: [ ‘1.0.0’ ],
maintainers: [ ‘gboog andersonthomas603#gmail.com’ ],
time:
{ modified: ‘2017-04-19T13:42:30.205Z’,
created: ‘2017-04-19T13:42:30.205Z’,
‘1.0.0’: ‘2017-04-19T13:42:30.205Z’ },
homepage: ‘https://github.com/WebGExecutive/app#readme’,
keywords: [ ‘sss’ ],
repository:
{ type: ‘git’,
url: ‘git+https://github.com/WebGExecutive/app.git’ },
author: ‘Griffin Blotner’,
bugs: { url: ‘https://github.com/WebGExecutive/app/issues’ },
license: ‘ISC’,
readmeFilename: ‘’,
version: ‘1.0.0’,
main: ‘index.js’,
scripts: { test: ‘s’ },
dist:
{ shasum: ‘73936188b9f38359107be3fce56da2643d195a89’,
tarball: ‘https://registry.npmjs.org/appapp/-/appapp-1.0.0.tgz’ },
directories: {} }
npm i does not works with Proxy.
You can refer to following links -
npm does not work behind corporate proxy and launched from apm
https://www.c-sharpcorner.com/article/how-to-use-npm-install-the-command-behind-corporate-proxy-server/

How to use Protractor with chromeless

Is protractor compatible with chromeless? If so, how can I configure it?
I didn't find any configuration method online or specific documentation to implement chromeless at protractor configuration.
I'm using protractor 3.1.1
Chrome headless mode is available on Mac and Linux in Chrome 59. Windows support is in Chrome 60.
capabilities: {
'browserName': process.env.PROTRACTOR_BROWSER || 'chrome',
// Using headless Chrome
chromeOptions: {
args: ['--headless', '--disable-gpu', '--start-maximized']
}
}

can't run protractor tests on macOS Sierra, Safari 10.0.2

I'm getting a UnsupportedOperationError: Build info: version: '3.3.1', revision: '5234b32', time: '2017-03-10 09:04:52 -0800' when i run my protractor 5.0.0 tests on safari.
I have a webdriver 2.48.0 extension enabled in safari.
conf file:
capabilities: {
name: 'Safari',
browserName: 'safari',
logName: 'Safari',
shardTestFiles: true,
maxInstances: 2
}
seleniumAddress: 'http://localhost:4444/wd/hub'
I'm starting the server manually by
./node_modules/.bin/webdriver-manager start
and running the spec in a different terminal
Am I supposed to run a specific version of selenium server. Any help would be appreciated.
macOS Sierra with Safari 10.0.2 needs the new Safari Driver. The Safari webdriver 2.48.0 extenson is for Safari 9 and lower.
There are some issues with the new Safari driver, see also here and search Google ;-).
Keep in mind that for example the Wait For Angular doesn't work, to avoid that use browser.ignoreSynchronization = true;

How to run protractor scripts on Android and IOS?

i'm using Protractor + Jasmine + Selenium WebdriverJS for automating angularjs application. I was able to configure and setup a sample script with all these tools to run on a desktop computer.
Now I want to run the same scripts on mobile( IOS & Android ) device / emulator.
I'm looking to use appium to run protractor scripts on IOS and Android. If anyone who has worked on protractor and appium. Please help me set up a sample script.
i'm pretty new to all these tools any Info on this is really helpful.
at https://github.com/angular/protractor/blob/master/docs/browser-setup.md you can find very detailed informations how to setup appium with protractor to test on emulators (Android/iOS)
you have to replace the webdriver of protractor with the appium webdriver. the appium webdriver is running normally at port 4723. the folloing code is for android for a web-only angualr app (no apk, pure web, running in the cromebrowser of the device which must be present)
exports.config = {
seleniumAddress: 'http://localhost:4723/wd/hub', //appium
specs: [
'spec.js'
],
capabilities: {
browserName: 'chrome',
'appium-version': '1.0',
platformName: 'Android',
platformVersion: '4.4.2',
deviceName: 'Android Emulator',
},
baseUrl: 'http://yourwebsite.com'),
};
start appium and run test with
protractor yourtest.js
edit: adapting capabilities to recent version (browserName must be present for selenium 2.43.x)
Have you tried using SauceLabs? I think you can request iOS and Android devices by specifying the platform in the capabilities section of the config.
If you don't want to use SauceLabs you can look at using Selenium's Grid functionality. You can get Selenium drivers for iOS and Android and have them connect to a centralized Selenium server that your Protractor scenarios are ran against, you just change the seleniumAddress in your config file to point to the centralized server.
Basically, you have to connect to the devices remotely and the easiest ways are as stated above.
just wanted to share that this configuration worked for me against BrowserStack.-
multiCapabilities: [
{
platformName: 'iOS',
platformVersion: '7.1',
browserName: '',
app: 'safari',
deviceName: 'iPhone Simulator',
'appium-version': "1.4.0",
username: '<username>',
accessKey: '<key>'
}
,
{
platformName: 'Android',
platformVersion: '4.4',
browserName: 'Browser',
deviceName: 'Android Emulator',
'appium-version': "1.4.0",
username: '<username>',
accessKey: '<key>'
}
],
I've found that other values for platformVersion different that the ones that I placed here, does not work, you'll get this error message like: 'Angular was not found....'
I've created a ticket for protractor team and a comment:
https://github.com/angular/protractor/issues/2247