I am creating my 1st protractor framework and I am trying run a sample test locally within my project. I can update and start webdriver fine. No issues at all. Super confused where I went wrong!
I got to project level and performed the command
npm run protractor
I got the following message from my mac terminal
Jacquelines-MacBook-Air:JSworkspace jacquelinegeorge$ cd LocatorTraining
Jacquelines-MacBook-Air:LocatorTraining jacquelinegeorge$ npm run protractor
> LocatorTraining@ protractor /Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining
> protractor configurations.js
[11:12:24] I/launcher - Running 1 instances of WebDriver
[11:12:24] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
Started
F
Failures:
1) protractor page Object training encountered a declaration exception
Message:
ReferenceError: datadrive is not defined
Stack:
ReferenceError: datadrive is not defined
at Object.<anonymous> (/Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/data.js:10:13)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Suite.<anonymous> (/Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/PageObjectLocator1.js:3:9)
Message:
WebDriverError: unknown error: failed to change window state to maximized, current state is normal
(Session info: chrome=70.0.3538.77)
(Driver info: chromedriver=2.43.600229 (3fae4d0cda5334b4f533bede5a4787f7b832d052),platform=Mac OS X 10.13.6 x86_64)
Stack:
WebDriverError: unknown error: failed to change window state to maximized, current state is normal
(Session info: chrome=70.0.3538.77)
(Driver info: chromedriver=2.43.600229 (3fae4d0cda5334b4f533bede5a4787f7b832d052),platform=Mac OS X 10.13.6 x86_64)
at Object.checkLegacyResponse (/Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/node_modules/selenium-webdriver/lib/error.js:546:15)
at parseHttpResponse (/Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/node_modules/selenium-webdriver/lib/http.js:509:13)
at doSend.then.response (/Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/node_modules/selenium-webdriver/lib/http.js:441:30)
at process._tickCallback (internal/process/next_tick.js:103:7)
From: Task: WebDriver.manage().window().maximize()
at thenableWebDriverProxy.schedule (/Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/node_modules/selenium-webdriver/lib/webdriver.js:807:17)
at Window.maximize (/Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/node_modules/selenium-webdriver/lib/webdriver.js:1686:25)
at onPrepare (/Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/configurations.js:10:37)
at q_1.Promise (/Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/node_modules/protractor/built/util.js:46:49)
at Function.promise (/Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/node_modules/q/q.js:682:9)
at Object.runFilenameOrFn_ (/Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/node_modules/protractor/built/util.js:38:16)
at plugins_.onPrepare.then (/Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/node_modules/protractor/built/runner.js:98:27)
at _fulfilled (/Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/node_modules/q/q.js:863:30)
at Promise.promise.promiseDispatch (/Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/node_modules/q/q.js:796:13)
1 spec, 1 failure
Finished in 0.136 seconds
[11:12:27] I/launcher - 0 instance(s) of WebDriver still running
[11:12:27] I/launcher - chrome #01 failed 1 test(s)
[11:12:27] I/launcher - overall: 1 failed spec(s)
[11:12:27] E/launcher - Process exited with error code 1
npm ERR! Darwin 17.7.0
npm ERR! argv "/Users/jacquelinegeorge/.nvm/versions/node/v7.2.0/bin/node" "/Users/jacquelinegeorge/.nvm/versions/node/v7.2.0/bin/npm" "run" "protractor"
npm ERR! node v7.2.0
npm ERR! npm v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! LocatorTraining@ protractor: `protractor configurations.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the LocatorTraining@ protractor script 'protractor configurations.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the LocatorTraining package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! protractor configurations.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs LocatorTraining
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls LocatorTraining
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/jacquelinegeorge/Documents/JSworkspace/LocatorTraining/npm-debug.log
So I checked the configurations.js file which looks like (that's the correct Spec.js file that I am testing):
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['PageObjectLocator1.js'],
capabilities: {
browserName: 'chrome'
},
onPrepare: function() {
browser.driver.manage().window().maximize();
//logs
//command for non angular web site
//reporting
//site Url???
}
}
Then I went to the run configurations and cli.js in the project
so I checked my Spec file I had no errors.
describe('protractor page Object training',function(){
var obj= require("./PageObjectDemo.js");
var d= require("./data.js");
beforeEach(function() {
obj.geturl();//the url on your test page is a method
});
it('Perform Simple Calculation ',function(){
// write your code here!!!
obj.firstnumber.sendKeys(d.datadrive.firstinput);//page of object properties
obj.secondnumber.sendKeys(d.datadrive.secondinput);//page object properties
obj.gobutton.click();
//Jasmine Attribute Syntax toBe. Jasmine takes care of the promise 'resolve'internally
expect(obj.result.getText()).toBe(d.datadrive.result);
//this confirm printout in console.
obj.result.getText().then(function(text){
console.log(text)
}) //end of console log message
})//end of it block
afterEach(function () {
console.log("If you can see this, test is completed. Well Done!!");
});
So I checked the data spec file :
module.exports.datadrive=
{
firstinput:"3",
secondinput:"5",
result: "8"
}
console.log(datadrive.result);
Aucun commentaire:
Enregistrer un commentaire