Error code 135, Error message Could not fingd update-config.json. Run webdriver-manager update to download the binaries - node.js

I am trying to execute my tests in nodejs using protractor.
Example protractor protractor.conf
When I run protractor protractor.conf, I get error Error code 135, Error message Could not fingd update-config.json. Run webdriver-manager update to download the binaries
I ran the following command but still get the above error message
webdriver-manager update -- proxy http://
protractor.conf.js
/*global jasmine */
var SpecReporter = require('jasmine-spec-reporter');
var TfsReporter = require('jasmine-tfs-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/tests/*spec.js'
],
capabilities: {
'browserName': 'chrome',
/*'browserName': 'phantomjs',
'phantomjs.binary.path': require('phantomjs-prebuilt').path,
'phantomjs.ghostdriver.cli.args': ['--loglevel=DEBUG']*/
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
useAllAngular2AppRoots: false,
beforeLaunch: function() {
require('ts-node').register({
project: '../PartyAndIndustryDataMigration'
});
},
onPrepare: function() {
jasmine.getEnv().addReporter(new SpecReporter());
jasmine.getEnv().addReporter(new TfsReporter());
}
};

I'm not 100% sure (and cannot it check now), but shouldn't command look like that:
webdriver-manager update --proxy http:// (without space between -- and proxy)?

I guess chrome driver & update-config.json couldn't downloaded at the time of webdriver-manager update.
Just for verification go to
node_modules\protractor\node_modules\webdriver-manager\selenium\
location and look if everything downloaded properly?
If there is problem on downloading chrome driver you can check chrome-response.xml in same location for reason. One reason could be chrome driver website is in blacklisted or behind the proxy.

1.Open Command prompt or terminal.
2.Go to your project root directory.
3.Enter the below command and hit Enter key.
node node_modules/protractor/bin/webdriver-manager update
This command will update the WebDriver Manager.

Related

Prtractor Error with Gitlab CI/CD Pipeline

We have a secured network and Protractor test suite runs locally. But when running the Gitlab CI/CD pipeline with headless chrome it returns network errors
This is my conf.js
exports.config = {
framework : "jasmine2",
multiCapabilities : [
{
browserName: "chrome",
chromeOptions: {
args: [
"--incognito",
"--headless",
"--no-sandbox",
"--disable-gpu",
"--window-size=1920,1080",
"--disable-dev-shm-usage",
"--allow-insecure-localhost"
],
},
},
],
specs: [
'./tests/sample.ts',
],
seleniumServerJar: '../node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.141.59.jar',
seleniumAddress: 'http://localhost:4444/wd/hub',
chromeDriver: './node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_98.0.4758.102',
directConnect: true,
onPrepare: function(){
void browser.manage().timeouts().implicitlyWait(10000);
void browser.waitForAngularEnabled(false);
require("ts-node").register({
project: require("path").join(__dirname, "./tsconfig.json"),
})
},
plugins: [{
package: 'protractor-screenshoter-plugin',
screenshotPath: './outputJS/reports/e2e',
screenshotOnExpect: 'failure+success',
takeScreenshots:'true',
withLogs: 'true',
writeReportFreq: 'asap',
imageToAscii: 'none',
clearFoldersBeforeTest: true
}]
}
Error appears
$ npm run e2e-headless-run
> e2e#1.0.0 e2e-headless-run /var/gitlab-runner/-8xgu1of/0/team-iron/ebba/pco-front-end/e2e
> node node_modules/protractor/bin/protractor ./headless_conf.js
[09:46:36] W/driverProviders - Using driver provider directConnect, but also found extra driver provider parameter(s): seleniumAddress, seleniumServerJar
[09:46:37] I/launcher - Running 1 instances of WebDriver
[09:46:37] I/direct - Using ChromeDriver directly...
Activated Protractor Screenshoter Plugin, ver. 0.10.3 (c) 2016 - 2022 [object Object] and contributors
Started
Creating reporter at ./outputJS/reports/e2e/
FF
Failures:
1) Google Sample Test loading web page
Message:
Expected '**Network Error**' to contain 'PCO'.
Stack:
Error: Failed expectation
at helper.verifyPageTitle (/var/gitlab-runner/-8xgu1of/0/team-iron/ebba/pco-front-end/e2e/helper/helper.ts:151:36)
at loginPage.verify_page_title (/var/gitlab-runner/-8xgu1of/0/team-iron/ebba/pco-front-end/e2e/pages/loginpage.ts:55:23)
I tried adding webDriverProxy and proxy. But same result appears.

How to configure Nightwatch.js with geckodriver to install metamask on browser startup

So we are trying to configure NightWatch so that the resulting opened firefox browser window, comes pre-installed with a extension (MetaMask) - so that tests can use Metamask to test out simple wallet transactions.
I'm fairly certain this is possible using geckodriver.
Our current nightwatch.conf.js file is:
const pathToGeckoDriver = require('geckodriver').path;
module.exports = {
src_folders: ['src/tests'],
page_objects_path: ['src/pages'],
custom_commands_path: ['src/custom-commands'],
webdriver: {
start_process: true,
server_path: pathToGeckoDriver,
},
test_settings: {
default: {
launch_url: 'https://some-website.com',
end_session_on_fail: false,
desiredCapabilities: {
browserName: 'firefox',
acceptInsecureCerts: true,
javascriptEnabled: true,
firefoxOptions: {
args: ['-profile', 'nightwatch'], // tried making a "nightwatch" profile for firefox and setting this profile at startup. no luck. :(
add_extension: ['metamask-10.2.2-an+fx.xpi'], // tried various versions of this line, no luck. :(
},
},
},
},
};
We have downloaded the extension XPI file and placed it in the same dir as the nightwatch.conf.js file.
Has anyone managed to get geckodriver to boot with an extension installed via Nightwatch config?

Unable to run specific spec file using protractor

I am trying to organize the "test files" into folders and run a specific spec file using protractor . For that i created below files.
heroes_spec.js file contains below code
var HeroesHomePage = require('C:\Users\agudla\Desktop\VSCodeWorkSpace\my-app\e2e\Heroes\heros_po.js');
describe('Heroes page tests' , function(){
var heroespage = new HeroesHomePage();
heroespage.heroesLinkClickEvent();
browser.driver.sleep(3000);
});
hero_po.js file contains below code
var heroesLinkClickEvent;
var hero_page = function() {
this.heroesLinkClickEvent= function(){
element(by.linkText('Heroes')).click();
}
};
hero_po.js is as below
module.exports = hero_page;
My protractor.conf.js file code is below
exports.config = {
allScriptsTimeout: 11000,
suites: {
heroespage : 'C:\Users\agudla\Desktop\VSCodeWorkSpace\my-app\e2e\Heroes\heroes_spec.js'
},
capabilities:
{
'browserName': 'chrome',
'seleniumAddress':'http://localhost:4444/wd/hub'
},
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
includeStackTrace: true
},
onPrepare() {
require('ts-node').register({
project: 'e2e/tsconfig.e2e.json'
});
},
}
When i run protractor protractor.conf.js --suite heroespage command after starting "selenium server".
No specs found message is displaying.
Can any one help me to solve this issue.
Are you aware, that Javascript uses forward-slashes / for paths and not backslashes \?
With a backslash you basically just exit the next character.
So try either with / instead of \
heroespage : 'C:/Users/agudla/Desktop/VSCodeWorkSpace/my-app/e2e/Heroes/heroes_spec.js'
Do this in all your paths within Protractor.
That should do the trick.
Give relative path to your project root folder.
suites: {
heroespage: ['e2e\Heroes\heroes_spec.js']
}
This is the command passed:
protractor src/test/javascript/protractor.conf.js --specs src/test/javascript/e2e/entities\points\points.spec.t
s
which is protractor conf files and then command line parameters followed by value.

Appium Webdriverio Setup

I need help understanding how to set up a testing framework to using Appium, Webdriverio, Node.js, Jasmine. I have the wdio.conf.js file set up:
host: '127.0.0.1',
port: 4723,
path: '/wd/hub',
....
specs: [
'./spec/wdtest/test.js'
],
....
capabilities: [
{
automationName: "appium",
browserName: 'iOS',
commandTimeout: '7200',
sessionOverride: true,
debugLogSpacing: true,
platformVersion: '10.1',
platformName: 'iOS',
showIosLog: true,
deviceName: 'iPhone 6s',
nativeInstrumentsLib: true,
isolateSimDevice: true,
autoLaunch: true,
app: '/Users/fodgerl/Library/Developer/Xcode/...../Debug-iphonesimulator/myapp.app'
}
],
....
services: ['appium'],
appium: {
args: {
address: '127.0.0.1',
commandTimeout: '7200',
sessionOverride: true,
debugLogSpacing: true,
platformVersion: '10.1',
platformName: 'iOS',
deviceName: 'iPhone 6s',
showIosLog: true,
nativeInstrumentsLib: true,
isolateSimDevice: true,
app: '/Users/fodgerl/Library/...../Products/Debug-iphonesimulator/myapp.app'
}
},
framework: 'jasmine',
My package.json file has:
"scripts": {
"test": "wdio wdio.conf.js"
},
And I have a test js file that has this:
describe('test', function() {
it('test', function () {
//how do I interact with the app?
console.log("HEREEEEE");
});
});
When I run npm test, the simulator launches and the app launches within it. What I don't know is where to go to next? How do I open app/interact with elements/etc.
I have seen examples like:
var client = webdriverio.remote({
port: 4723,
logLevel: 'verbose',
desiredCapabilities: {
platformName: 'iOS',
platformVersion: '8.4',
deviceName: 'iPhone 6',
app: webviewApp
}
});
But do I need to do that if I already have the simulator up and running from the stuff in the conf file? I was trying to find some documentation on what .remote(), init(), etc does. Also, I looked in the Launcher for webdriverio but I couldn't determine where/how it was being used in the example here: https://github.com/webdriverio/webdriverio/blob/master/examples/wdio/runner-specs/jasmine.spec.js
Any help would be appreciated to get me started!! Thanks!
On running $ npm test, it executes $ ./node_modules/.bin/wdio wdio.conf.js. So you have the wdio test runner up and running.
Now, as mentioned in The Browser Object subsection:
If you use the wdio test runner you can access the webdriver instance through the global browser object. The session is initialized by the test runner so you don’t need to call init command. The same goes for ending the session. This is also done by the test runner process.
That's it! You can access the driver instance via the global variable browser as illustrated in the aforementioned example.
Hope that helps!
webdriver.io is just for running the tests. Not interacting with the app. Use appium to app/interact with elements/etc. Appium will record the step and elements path/s. From here you can create your test cases which can be run using wedriver.io

E2E Testing Angular with Karma - ng-scenario 'Module is not defined'

I've been trying to run some e2e tests with Karma.
It's not working for me at all.
Right now I'm getting the following error:
Firefox 28.0.0 (Windows 7) ERROR
ReferenceError: module is not defined
at C:/MYPATH/Test/node_modules/karma-ng-scenario/lib/ind
ex.js:12
Firefox 28.0.0 (Windows 7) ERROR
ReferenceError: browser is not defined
at C:/MYPATH/Test/e2e/scenarios.js:12
My config file looks like this:
module.exports = function(config){
config.set({
basePath : './',
frameworks: ['ng-scenario'],
files : [
'./node_modules/karma-ng-scenario/lib/*.js',
'./e2e/*.js'
],
autoWatch : true,
singleRun : true,
browsers : ['Firefox'],
plugins : [
'karma-ng-scenario',
'karma-chrome-launcher',
'karma-firefox-launcher'
],
junitReporter : {
outputFile: 'test_out/unit.xml',
suite: 'unit'
},
urlRoot : '/__karma/',
proxies : {
'/public/' : 'http://localhost:8080'
}
});
};
My scenarios file just tests to see if the base path redirects.
I've already done a lot of messing with npm to get to this point, most recently "npm install karma-ng-scenario --save-dev" but no luck unfortunately.
In files[] specify path to angular.js as a very first, then any other angular modules you use (angular-mocks.js, angular-resource.js, angular-cookies.js), then any library you use, then your own code.
In files:[...] array you have to specify all the files that contain the actual code to which you are writing tests, if your module is using other modules, then you should add files of all the modules on which your module depends.
suppose you are testing 'someModule' module you have to include the 'someModule' controllers, views, services, directives and other modules if your module depends on them
Note: Assuming your files are in their specific directories
files: [
... //angularjs, angular-mocks, karma, protractor and other files you need
...
'scripts/someModule/controllers/*.js',
'scripts/someModule/services/*.js',
'scripts/someModule/directives/*.js',
'views/someModule/*.html'
]
or simply
files: [
... //angularjs, angular-mocks, karma, protractor and other files you need
...
'scripts/someModule/**/*.js',
'views/someModule/*.html'
]
And make sure to install and include all the testing libraries you depend on (i.e, angularjs, angular-mocks, protrator, karma etc) in the files array
So the configuration I finally got my E2E tests to work with was this:
// Karma configuration
// Generated on Fri Apr 11 2014 02:35:20 GMT+0800 (China Standard Time)
module.exports = function(config) {
config.set({
// base path, that will be used to resolve files and exclude
basePath: '..',
// frameworks to use
frameworks: ['jasmine'],
// list of files / patterns to load in the browser
files: [
ANGULAR_SCENARIO,
ANGULAR_SCENARIO_ADAPTER,
'test/e2e/*.js',
],
// list of files to exclude
exclude: [
],
// test results reporter to use
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
reporters: ['progress'],
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera (has to be installed with `npm install karma-opera-launcher`)
// - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`)
// - PhantomJS
// - IE (only Windows; has to be installed with `npm install karma-ie-launcher`)
//browsers: ['PhantomJS', 'Firefox', 'Chrome'],
browsers: ['Firefox', 'Chrome'],
// If browser does not capture in given timeout [ms], kill it
captureTimeout: 60000,
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: false,
proxies : {
"/": "http://localhost:8080"
},
urlRoot : "/__karma/"
});
};
It seems that a better solution for running end to end tests is to use protractor. NG-SCENARIO is depreciated and will cause warnings but this should still run. https://github.com/angular/protractor

Resources