Protractor UI Tests fail with Jenkins, successful on WinServer on cmd run -
i have jenkins configured on windows server nightly builds, compilations etc.. , ui test (e2e tests) automation i'am having problems. have web application runs on chrome , need jenkins run these tests using protractor (with selenium).
with manual run windows cmd console, tests finish successfully.
-------here console output;
***c:\jenkins\jobs\ui automation\workspace> protractor e2e-tests/protractor.conf.js using chromedriver directly... [launcher] running 1 instances of webdriver warning - more 1 element found locator by.repeater("attachment in pos t_item.attachments") - first result used . finished in 68.394 seconds 1 test, 8 assertions, 0 failures [launcher] 0 instance(s) of webdriver still running [launcher] chrome #1 passed***
-----here output of run jenkins;
c:\jenkins\jobs\ui automation\workspace>protractor e2e-tests/protractor.conf.js using chromedriver directly... [launcher] running 1 instances of webdriver warning - more 1 element found locator by.repeater("attachment in post_item.attachments") - first result used [31mf[0m failures: 1) new_message_with_attachment should send new message attachment message: [31melementnotvisibleerror: element not visible (session info: chrome=47.0.2526.111) (driver info: chromedriver=2.13.307647 (5a7d0541ebc58e69994a6fb2ed930f45261f3c29),platform=windows nt 6.0 sp2 x86_64)[0m stacktrace: elementnotvisibleerror: element not visible (session info: chrome=47.0.2526.111) (driver info: chromedriver=2.13.307647 (5a7d0541ebc58e69994a6fb2ed930f45261f3c29),platform=windows nt 6.0 sp2 x86_64) @ new bot.error (c:\users\x\appdata\roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:113:18) @ object.bot.response.checkresponse (c:\users\x\appdata\roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\response.js:106:9) @ c:\users\x\appdata\roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:362:20 @ c:\users\x\appdata\roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\base.js:1582:15 @ [object object].webdriver.promise.controlflow.runinnewframe_ (c:\users\x\appdata\roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:1654:20) @ notify (c:\users\x\appdata\roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:465:12) @ notifyall (c:\users\x\appdata\roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:442:7) @ resolve (c:\users\x\appdata\roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:420:7) @ [object object].fulfill (c:\users\x\appdata\roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:535:5) @ c:\users\x\appdata\roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:1520:10 ==== async task ==== webelement.click() @ [object object].webdriver.webdriver.schedule (c:\users\x\appdata\roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:345:15) @ [object object].webdriver.webelement.schedule_ (c:\users\x\appdata\roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:1727:23) @ [object object].webdriver.webelement.click (c:\users\x\appdata\roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:1832:15) @ actionfn (c:\users\x\appdata\roaming\npm\node_modules\protractor\lib\element.js:75:32) @ c:\users\x\appdata\roaming\npm\node_modules\protractor\lib\element.js:393:17 @ array.foreach (native) @ actionresults.getwebelements.then.then.e.stack (c:\users\x\appdata\roaming\npm\node_modules\protractor\lib\element.js:392:9) @ c:\users\x\appdata\roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\base.js:1582:15 @ [object object].webdriver.promise.controlflow.runinnewframe_ (c:\users\x\appdata\roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:1654:20) ==== async task ==== asynchronous test function: it() @ [object object].<anonymous> (c:\users\x\appdata\roaming\npm\node_modules\protractor\node_modules\jasminewd\index.js:93:33) @ [object object].<anonymous> (c:\users\x\appdata\roaming\npm\node_modules\protractor\node_modules\minijasminenode\lib\async-callback.js:45:37) @ [object object].jasmine.block.execute (c:\users\x\appdata\roaming\npm\node_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:1174:17) @ [object object].jasmine.queue.next_ (c:\users\x\appdata\roaming\npm\node_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:2209:31) @ [object object]._ontimeout (c:\users\x\appdata\roaming\npm\node_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:2199:18) error @ [object object].elementarrayfinder.applyaction_ (c:\users\x\appdata\roaming\npm\node_modules\protractor\lib\element.js:389:21) @ [object object].self.(anonymous function) [as click] (c:\users\x\appdata\roaming\npm\node_modules\protractor\lib\element.js:77:19) @ [object object].self.(anonymous function) [as click] (c:\users\x\appdata\roaming\npm\node_modules\protractor\lib\element.js:697:11) @ [object object].<anonymous> (c:\jenkins\jobs\ui automation\workspace\e2e-tests\new_message_with_attachment.js:223:62) @ c:\users\x\appdata\roaming\npm\node_modules\protractor\node_modules\jasminewd\index.js:94:14 @ [object object].webdriver.promise.controlflow.runinnewframe_ (c:\users\x\appdata\roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:1654:20) @ [object object].webdriver.promise.controlflow.runeventloop_ (c:\users\x\appdata\roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:1518:8) error @ [object object].<anonymous> (c:\jenkins\jobs\ui automation\workspace\e2e-tests\new_message_with_attachment.js:76:3) @ [object object].jasmine.env.describe_ (c:\users\x\appdata\roaming\npm\node_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:913:21) @ [object object].jasmine.env.describe (c:\users\x\appdata\roaming\npm\node_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:898:15) @ describe (c:\users\x\appdata\roaming\npm\node_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:658:27) @ object.<anonymous> (c:\jenkins\jobs\ui automation\workspace\e2e-tests\new_message_with_attachment.js:75:1) finished in 59.756 seconds [31m1 test, 8 assertions, 2 failures [0m [launcher] 0 instance(s) of webdriver still running build step 'execute windows batch command' marked build failure discard old builds... sending e-mails to: me@home.com finished: failure*
-------here protractor.conf.js;
*exports.config = { allscriptstimeout: 20000, specs: [ 'new_message_with_attachment.js', ], capabilities: { 'browsername': 'chrome', 'chromeoptions': { prefs: {'profile.managed_default_content_settings.notifications': 1}}, shardtestfiles: true, maxsessions: 1 }, directconnect: true, jasminenodeopts: { defaulttimeoutinterval: 1000000 } };*
any comments?
it has been happened once me when integrate protractor jenkins ci. according question, make suggestions increase stability of e2e test.
as seem not having single problems here. , sure solve of problems may not solve of it.
and errors "element not found" because of uncompleted webpage install..
...i getting different errors on every run
this common issue protractor, there many cause happen. fortunately can avoid simple method combine page object.
this page object:
var mypage = function () { // set ng-view or ui-view this.view = $('.view'); // set interactable components this.button = element(by.css('button')); }; mypage.prototype.get = function () { browser.setlocation('myroute/something'); }; mypage.prototype.waitforpresent = function() { var ec = protractor.expectedconditions; browser.wait(ec.presenceof(this.button), 10000); };
in test suite/spec:
it("should test something", function() { var page = new mypage(); page.get(); browser.waitforangular(); page.waitforpresent(); page.button.click(); });
the trick here using expected conditions , wrote prototype page object waitforpresent
, waiting component(s) presented. pick 1 think last 1 got rendered on view/page. (note: don't need use page objects, quite pain manage when suites getting bigger)
but tests running fast, , errors "element not found" because of uncompleted webpage install..sometimes can enter login username missing characters.
it seem have resources there (cpu , ram), point said missed characters when logging in. mean still lack of resource else where, , suspecting graphic's resources. graphic reources lacking of servers, because don't need render something. , deal this, there no code adjustment, trick or work-around use. must @ least try either of these (or both):
- find away run headless test. because render browser quite heavy. (use chrome or firefox, because phantomjs not recommended protractor)
- try increase graphic resource.
edit : there issue on github calling element.sendkeys() seems not send keys first suspecting on old version of webdriver. people used latest version of webdriver got too. unknow cause, highly doubt due lacking of sort of resources. anyways informations. hope helped :)
Comments
Post a Comment