Dismiss firefox update popup with WebdriverIO - javascript

I want to dismiss this popup when I'm running my tests with webdriverIO but I'm not able to do it.
I'm using chimp to run my tests
I tried with browser.alertdismiss() but it didn't work. Also, I tried using this NPM package and adding this configuration but seems that firefox it's not taking that profile
My configuration file
// wdio.conf.js
const config = {
// ...
services: ['firefox-profile'],
firefoxProfile: {
"app.update.enabled": true,
"app.update.auto": true,
"app.update.silent": true,
"privacy.popups.firstTime": true,
"update.showSlidingNotification": false,
"update_notifications.enabled": false ,
},
// ...
};
module.export = config;

Related

Angular/ Protractor E2E Test fails when run in Azure DevOps Pipeline. Passes locally

I am trying to run e2e tests on my angular application. My tests pass locally when I run ng e2e but not in my pipeline. I'm going to share my protractor.conf, the pipeline tasks and the output I get from the task that fails below.
Some more background:
I am trying to run e2e code from an otherwise empty angular app. The
test I am trying to run simply logs into AD by navigating to my
website, entering a username/ password and then checking the that the
user is redirected to my website.
I am running this from a release
pipeline where the repo containing the e2e tests is added as an
artifact.
I am using xpaths to find elements on the page
I've omitted my jasmine code because I do not think it is relevant since the tests pass locally. However, if I'm wrong on this point let me know and I will post it.
protractor.conf.js
const { SpecReporter } = require('jasmine-spec-reporter');
process.env.CHROME_BIN = process.env.CHROME_BIN || require("puppeteer").executablePath();
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
capabilities: {
chromeOptions: {
args: ["--headless", "--disable-gpu", "--window-size=1200,900"],
binary: process.env.CHROME_BIN
},
'browserName': 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 120000,
print: function() {}
},
onPrepare() {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.e2e.json')
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
};
Pipeline Tasks:
Failed Task Output:
Please help me get these tests to pass in azure
Thanks!
EDIT: I have that 'Update Webdriver' task because I read I should do it somewhere, it doesn't actually change the outcome if it is there or not
Have you tried to increase your allScriptsTimeout?
The timeout in milliseconds for each script run on the browser. This should be longer than the maximum time your application needs to stabilize between tasks.

BrowserSync Gulp doesn't open in Chrome

I try to open my website on localhost using BrowserSync and Gulp in Chrome, but it doesn't work. Default, it open in Firefox and everything works well. But, when I change params in gulpfile.js to open website in Chrome - I have this information:
[Browsersync] Couldn't open browser (if you are using BrowserSync in a
headless environment, you might want to set the open option to false)
My config in gulpfile.js:
// browser-sync options
// see: https://www.browsersync.io/docs/options/
var browserSyncOptions = {
browser: "google chrome",
proxy: "localhost",
notify: false
};
I tried "chrome", "chrome-browser", nothing happend. What I should to do?
Notice: I have Ubuntu 17.04, Chrome is my default browser.
I think the issue is with your port, try to change your proxy to below :
var browserSyncOptions = {
browser: "google chrome",
proxy: "localhost:3001",
notify: false
};
and check your website in chrome with this port :
http://localhost:3001
Update :
Also try to use the same port in browserSync :
browserSync({
proxy: 'localhost:3001'
});
Try dropping Google from browser sync call...
var browserSyncOptions = {
browser: "google chrome",
proxy: "localhost:3001",
notify: false
};
So you just have chrome.
var browserSyncOptions = {
browser: "chrome",
proxy: "localhost:3001",
notify: false
};

How to setup Flow to monitor file changes with WebPack 2.0

Is there a way to setup Flow to run with WebPack 2 watch. So that Flow would run a 'flow status' command on each WebPack successful build ?
Currently I tried:
webpack-shell-plugin.
It allows me to run shell commands before and after WebPacks build. But once a flow finds an error, it terminates the watch process.
code:
...
plugins: [
new WebpackShellPlugin({
onBuildEnd:['npm run --silent flow']
})
]
flow-status-webpack-plugin
For me it does not work. It doesn't produce nothing inside the console.
flow-babel-webpack-plugin
While this plugin did work, sadly on each build it restarts the flow server, making the flow type chasing extremely long. Also because of the server restart native flow support form Visual Studio Code and InteliJ stops working.
I solved this issue using
'flow-status-webpack-plugin'
the webpack.config looks like this:
var FlowStatusWebpackPlugin = require('flow-status-webpack-plugin');
{
...
plugins: [
new FlowStatusWebpackPlugin({
onError: function(stdout) {
console.log(stdout)
},
onSuccess: function(stdout){
console.log(stdout)
},
restartFlow: false,
failOnError: true,
binaryPath: './node_modules/.bin/flow'
})
]
}

Protractor : browser.get() doesn't function

I am a newbie using protractor for angularjs app e2e testing.
I have the latest version of protractor setup and using Visual studio 2015 as the IDE.
The function browser.get() mentioned in my tests doesn't work and only opens up a browser window with "Data:,".
Here is my config.js file :
'use strict';
exports.config = {
directConnect: true,
chromeDriver: './node_modules/protractor/selenium/chromedriver.exe',
// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'chrome'
},
// Spec patterns are relative to the current working directly when
// protractor is called.
specs: ['example_spec.js'],
framework: 'jasmine',
// Options to be passed to Jasmine-node.
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000
},
onPrepare: function () {
browser.driver.manage().window().maximize();
}
};
Here is my spec.js file :
describe('angularjs homepage', function () {
it('should have a title', function () {
browser.get('http://angularjs.org/');
expect(browser.getTitle()).toContain('AngularJS');
});
});
Am i missing out on anything? Please help! i have been trying to fix this since 3 days now.
The first thing,
chromeDriver: './node_modules/protractor/selenium/chromedriver.exe'
is not needed.Your web-driver manager manage it.
If your protractor version is >3.0 then install node > 4.0.
UPDATE :
Please fire following command :
webdriver-manager update

Output tests to browser with Karma

I am using Karma to test my project and can see tests passing an failing in the console window, however, how do I get these to show in the browser? The browser only has a green bar (even though a test is failing) with
Karma v0.10.2 - connected
Written in it.
I have tried addong singleRun :false to the karma.config.js file.
The config file looks like this:
module.exports = function (config) {
config.set({
basePath: '../',
files: [
'app/lib/angular/angular.js',
'app/lib/angular/angular-*.js',
'test/lib/angular/angular-mocks.js',
'app/js/**/*.js',
'test/unit/**/*.js'
],
autoWatch: true,
singleRun: false,
frameworks: ['jasmine'],
browsers: ['Chrome'],
plugins: [
'karma-junit-reporter',
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-jasmine'
],
junitReporter: {
outputFile: 'test_out/unit.xml',
suite: 'unit'
}
})
}
matthias-schuetz wrote a plugin that claims to produce html test output.
https://npmjs.org/package/karma-htmlfile-reporter
Along with the instructions on the plugin page I had to include a reference to the plugin in the Karma config -
plugins: [
'karma-htmlfile-reporter'
]
Accroding to Documention, even not very perfect:
If 'singleRun' is false, it will set the ci-mode on, so, make it true, and you will see some failed red status on the top bars of browers.
There is no straight forward way to do this with Karma.
The "best" way to solve this problem would be to hunker down and write a html-reporter for karma (which would make a lot of us other Karma users very happy).
If this is too much work for you, the second best thing is to use the junit reporter which generates an xml file. You can then post-process the xml file in some way that turns it into a HTML-file which you can then view in your browser
I wanted to display HTML5 Web Notifications with Karma so I wrote something quick to get it to work with Karma version 0.11. Might behave slightly different with other versions. I load this script in with the rest of my application scripts, it will store the karma test results and after completion it will determine the success of the test and then reset to the original karma functions so they're not changed when this script gets run again.
// store all my test results
var results = [];
// Wrap the karma result function
var resultFunc = window.__karma__.result;
window.__karma__.result = function(result){
// run the original function
resultFunc(result);
// push each result on my storage array
results.push(result);
}
// wrap the karma complete function
var completeFunc = window.__karma__.complete;
window.__karma__.complete = function(result){
// run the original function
completeFunc(result);
// determine success
var success = results.every(function(r){ return r.success });
if (success) {
// display a success notification
}
else {
// display a test failure notification
}
// reset the result function
window.__karma__.result = resultFunc;
// reset the complete function
window.__karma__.complete = completeFunc;
}

Categories