Dose Karate framework support headless execution for MS Edge browser on Linux? - microsoft-edge

I want to execute my test scripts on Microsoft Edge browser on Linux server.
I have tried using headless: true in driver configuration. However, it's not working.
Also, tried with driver configuration
* configuration driver: {type: 'msedgedriver', executable:'/edgedriver_linux64/msedgedriver', webDriverSession: { capabilities: { browserName: 'edge', edgeOptions: { args: ['-headless'] }} }}
I am expecting to run test scripts in headless mode.
Is there any way to execute test scripts in headless mode?

Based on my research, Karate framework doesn't support headless mode for Edge at present. You can refer to this doc. You can find the following information in the Driver Configuration table:
headless mode only applies to { type: 'chrome' } for now, also see DockerTarget and webDriverSession

Related

Playwright tests inside docker fails to load fonts

Currently I have Playwright tests that I am running inside Docker container both locally and in the CI. Unfortunately the tests fail on the CI with screenshot comparison error.
Upon investigation I can see that the fonts on the CI screenshots are different from the ones used to generate the expected images (also run inside docker). But this doesn't happen consistently - sometimes it happens, sometimes it doesn't. Using sharding shows that some shards pass fine and others don't inside the same job run.
Figured it out - after reviewing the trace file - it turned out that the fonts are loaded from our CDN which is on a different domain from the local one inside the Docker container where the tests are running. This results in the following CORS error and the fonts are not applied.
Access to font at 'https://mycdn.com/fonts/my-font.woff2' from origin 'http://localhost:8003' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Furthermore this issue was strangely affecting only the tests running on chromium and the ones on webkit.
After some more research I found out this Playwright issue suggesting some parameters when running tests in chromium browser which actually did the job!
So the final solution was to change the chromium configuration to:
{
name: 'chromium',
use: {
browserName: 'chromium',
bypassCSP: true,
launchOptions: {
args: ['--disable-web-security'],
},
},
},

How to start browserstack locale as a background process in jenkins using WINDOWS for protractor end to end testing in jenkins

Can anyone please help me to start browserstack locale as a background process in jenkins using WINDOWS for protractor end to end testing .
I was going through this link but this is for linux,I need for windows .
https://janmolak.com/jenkins-2-0-pipelines-and-browserstack-bd5a4ed3010d#.gf9pxyhgc
I have already installed browserstack binary for win 32 in jenkins.
Have you tried the Jenkins plugin for BrowserStack? You can refer to the details here - https://www.browserstack.com/automate/jenkins.
Since you are not using Java you will not be able to use the reporting functionality of the plugin. You can however use the following features that the plugin offers.
1) Manage your BrowserStack credentials globally or per build job.
2) Set up and teardown BrowserStackLocal for testing internal, dev or staging environments.
Here's how I got it working:
Install the BrowserStackLocal binary from their website.
Install the Jenkins Browserstack Plugin how to
Configure the plugin with your username and access key and point it at the downloaded binary.
In order for the session to route ip traffic locally, we have to pass a local identifier from the binary into our desired capabilities when the test runs. (as Ashwin Gonsalves pointed out.)
public DesiredCapabilities GetCapabilities(Browser browser, bool isBSLocal)
{
DesiredCapabilities capability = new DesiredCapabilities();
// Get BSID for local ip routing
if (isBSLocal)
{
string BSID = System.Environment.GetEnvironmentVariable("BROWSERSTACK_LOCAL_IDENTIFIER");
capability.SetCapability("browserstack.localIdentifier", BSID);
}
switch (browser.ToString())
{
case "Chrome":
capability.SetCapability("os", "Windows");
capability.SetCapability("os_version", "10");
capability.SetCapability("browser", "Chrome");
capability.SetCapability("browser_version", ChromeVersion);
capability.SetCapability("browserstack.chrome.driver", "2.42");
capability.SetCapability("resolution", "1920x1200");
capability.SetCapability("project", TestOps.GetParent);
capability.SetCapability("name", TestOps.GetTestName);
capability.SetCapability("browserstack.local", "true");
capability.SetCapability("browserstack.debug", "true");
capability.SetCapability("browserstack.selenium_version", ChromeSeleniumVersion);
capability.SetCapability("browserstack.user", USERNAME);
capability.SetCapability("browserstack.key", AUTOMATE_KEY);
break;

How to configure Atom to run Dart in Dartium?

How to set up the launch of web applications written in Dart, as it does WebStorm in Atom?
In the Atom, he tries to run itself Dart script rather than index.html
Launch configurations stored in folder .atom/launches.
Eg. console (cli) configuration:
type: cli
path: test\test.dart
cli:
args:
cwd:
checked: true
debug: true
Launch of the web scripts (type: web) is not implemented yet.
dartlang/lib/launch/launch_web.dart
lib/plugin.dart

Is there a way to get JUnit code coverage when running in the browser?

We are currently working on getting better code coverage for one of our JS libraries. I have the The Intern up and running, and can run tests in the browser. However, our libraries create DOM elements in some of their functions, making it so we can't run JUnit from the terminal because Node.js doesn't allow for DOM construction in tests. Is there a way we can get JUnit code coverage on the html and console output we get when we run The Intern in the browser?
I found the answer. From this link: https://theintern.github.io/intern/#local-selenium
Using ChromeDriver (Chrome-only)
If you’re just looking to have a local environment for developing functional tests, a stand-alone ChromeDriver installation works great.
1. Download the latest version of ChromeDriver
2. Set tunnel to 'NullTunnel'
3. Run chromedriver --port=4444 --url-base=wd/hub
4. Set your environments capabilities to [ { browserName: 'chrome' } ]
5. Run the test runner
Once you have that setup and running, you can run
node_modules/intern/bin/intern-runner.js config=tests/intern reporters=JUnit filename=junit.xml
This will allow the tests to run in a chrome instance, and then output the results to a report that can then be upload somewhere.

How to setup Appium Environment for Android Automation?

I am working as SD in Test. I am new to Appium Automation tool, this tool is very tricky to set up environment for me.
I referred following link: http://unmesh.me/category/appium/
This link helped me to install Node.js and appium through command line. But I am not sure this right way to do.
I got following message from command line :
mani-kandans-MacBook-Pro:platform-tools manikandan$ info: Welcome to Appium v0.8.2 (REV e9cc66197ad6a3496322bd77a8699509fc761b69)
info: Appium REST http interface listener started on 0.0.0.0:4723
info - socket.io started
After this I don't have any idea. How to write testcase and run it through Appium?
If your interest to share your knowledge about Appium tool. Please guide me.
How to Install Appium?
How to run testcase through Appium tool?
Part One:-. You appear to have launched the appium server using node server.js
- You can check the server by going to localhost:4723/wd/hub/status in your browser this will return a few details of the server. You have already done this.
The command output will look like this confirming that the server is started:
info: Welcome to Appium v0.8.1 (REV ***********************************)
info: Appium REST http interface listener started on 0.0.0.0:4723
info - socket.io started
Part Two:-. Next you use the selenium RC for Python, Java, or c# or whatever your language choice. I used c# and can provide examples this should be similar for your tests.
To add the selenium to a c# class: using OpenQA.Selenium.Remote;
You pass all your data to a selenium desired capabilities object.
Some custom desired capabilities exist such as:
'app-package' this is the app package name such as com.myapp.main,
'app-activity' which is the apps main activity to be called which will also launch the app. This is often a splash activity or main activity,
'wait-activity' is the activity that Appium will check for once launched, this would be the app-activity but for me it is different if for some tests a new activity is launched than is called,
'version' taking the android version,
'device ID' taking your attached device or AVD to command and app which will have a local path to the apk you wish to install. This is signed and installed on start-up if a resigned app already exists it will skip this for you.
DesiredCapabilities caps = new DesiredCapabilities();
caps.SetCapability("app-package", "com.myapp.test");
caps.SetCapability("browserName", "");
caps.SetCapability("device", "Android");
caps.SetCapability("app-activity", "com.myapp.SplashActivity");
caps.SetCapability("takesScreenshot", true);
caps.SetCapability("version", "4.1.2");
caps.SetCapability("device ID", "uniquedeviceid");
caps.SetCapability("app", #"C:\path to\app\on\pc\app.apk");
Following the Capabilities you create create a remote web driver object passing the hub url that you've used e.g http://localhost:4723/wd/hub and the Desired Capabilities you've created.
RemoteWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4723/wd/hub/"), caps);
This line uses the ip or host of the Appium server to begin listening for requests.
For me this step signs installs and launches the app on the attached device hopefully this will work for you the same.
This is where the selenium tests you write are connected to the Appium server.
Now using the created driver object you can access the selenium rc commands of which Appium has implemented many alternatives for android testing.
During each of these your Appium server console window should show you if there is any issues.
Output will be colour coded to assist in identifying failures from this window but you can handle these your own way and output to a file if needed.
Update for multiple devices
I am unsure on the use of multiple devices, I would consider selenium grid my previous attempts to add 2 devices to one machine and test had confusion where adb was unable to distinguish regardless of the device id addition to the configuration and commands.
The Appium team have been making improvements to add grid functionality to the server, I recommend you have a look into Appium Grid (link updated)
I apologize for my lack the experience with grid to assist you further.
Regards, Brian
It seems to be late reply, but still I guess this post can help some one, who are looking for step by step by guide to install Appium on Windows platform
http://qaautomationworld.blogspot.in/2014/12/appium-setup-for-android-windows.html
This link mainly deals with the following sections
JDK Installation
Android SDK Installation path setup
Appium Installation
a) Using node.js
b) Using Appium.exe
Here's my env.rb file for appium android.
require 'rubygems'
require 'appium_lib'
# Start Android driver
apk = {
device: :android,
app_path: (true && ENV['apk']) || 'path to apk',
app_package: (true && ENV['package']) || 'com.foo.cam',
app_activity: (true && ENV['activity']) || '.SplashActivity',
app_wait_activity: (true && ENV['activity']) || '.MainActivity',
}
Appium::Driver.new(apk).start_driver
Appium.promote_appium_methods Object
log = Logger.new(STDOUT)
case ENV['log']
when 'WARN'
log.level = Logger::WARN
when 'DEBUG'
log.level = Logger::DEBUG
when 'INFO'
log.level = Logger::INFO
when 'ERROR'
log.level = Logger::ERROR
when 'FATAL'
log.level = Logger::FATAL
when 'UNKNOWN'
log.level = Logger::UNKNOWN
else
log.level = Logger::DEBUG
end
log.debug('starting suite')
Before do
#test_env = {
device: driver,
main_activity: (true && ENV['main_activity']) || 'grid.GridLoginActivity',
logger: log
}
end
# Optional--clears alerts
After ('#rate_limit') do |scenario|
log = #test_env[:logger]
device = #test_env[:device]
if scenario.failed?
begin
wait = Selenium::WebDriver::Wait.new :timeout => 1
wait.until { device.alert_accept }
log.debug('cleared rate limit dialog')
rescue
log.error("dialog didn't pop.")
end
end
log.debug('rate_limit finished')
end
After ('#network_connection') do |scenario|
log = #test_env[:logger]
device = #test_env[:device]
if scenario.failed?
begin
wait = Selenium::WebDriver::Wait.new :timeout => 1
wait.until { device.alert_accept }
log.debug('cleared network connection issue')
rescue
log.error("dialog didn't pop.")
end
end
log.debug('network_connection finished')
end
To install Appium first up all Download Required Tools:
Android Studio
Appium Jar Files For Java
Java Selenium Client Plugin
Appium Server
Java SDK
After downloading all these tools follow step by step process mention in this blog:
Installation Process of Appium in Android Studio
Here I have tried to explain full end to end set up instruction to Configure and run Android Mobile Automation Testcases using Appium
Download Java and set Java_Home in environmental variables
Download Android STUDIO from below link
https://developer.android.com/studio/index.html
Check Android installation path in Machine
Set Android_Home Environmental variables path to SDK location and include bin folder paths in PATH variable
Open Android Studio and configure Virtual device/Emulator
Open Emulator and check if it is working.
Download Node.js
https://nodejs.org/en/download/
Set Node_Home Environmental variables path
Set npm Environmental variables path
Download Appium Server from Node
Download Appium and Selenium Java client library
Install Eclipse – Create a Project in Eclipse - configure Appium libraries
Add All dependencies
//You can download any node module only using npm
npm install – g appium – Latest Stable release version 1.16.0 – Android 10+ version
npm uninstall -g appium // g stands for global
Appium – starts the server

Resources