Method acceptAlert() doesn't work in Intern/Leadfoot -
i can't understand how use acceptalert() method. doesn't work me. try accept pop-up alert 2 buttons: ok , cancel.
here piece of testing code.
querydatasource: function (kibiurl, title, description, datasource, query) { return this.remote .get(require.tourl(kibiurl)) .setfindtimeout(3000) .sleep(3000) .findbycssselector('input[ng-model="query.title"]') .clearvalue() .type(title) .end() .findbycssselector('input[ng-model="query.description"]') .type(description) .end() .findbycssselector('option[label="'+ datasource +'"]') .click() .end() .findbyname('sqlquery') .findbyclassname('ace_text-input') .type(query) .end() .findbyxpath('//button[@class="btn btn-success"]') .click() .end() .sleep(1000) .acceptalert() .then(function (text) { console.log(text); }); }
and following error:
>> fail: chrome on platform - query mysql datasource (3844ms) unexpectedalertopen: [post http://localhost:4444/wd/hub/session/0c7cbf33-8724-4cfd-8e9c-4434d4570dbb/element / {"using":"css selector","value":"input[ng-model=\"query.title\"]"}] unexpected alert open: {alert text : sure want overwrite mysql datasource?} (session info: chrome=51.0.2704.106) (driver info: chromedriver=2.21.371461 (633e689b520b25f3e264a2ede6b74ccc23cb636a),platform=linux 4.2.0-41-generic x86_64) (warning: server did not provide stacktrace information) command duration or timeout: 1 milliseconds: null build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 17:00:58' system info: host: 'latitude-e5510', ip: '127.0.1.1', os.name: 'linux', os.arch: 'amd64', os.version: '4.2.0-41-generic', java.version: '1.8.0_91' driver info: org.openqa.selenium.chrome.chromedriver capabilities [{applicationcacheenabled=false, rotatable=false, mobileemulationenabled=false, chrome={chromedriverversion=2.21.371461 (633e689b520b25f3e264a2ede6b74ccc23cb636a), userdatadir=/tmp/.com.google.chrome.cxlvym}, takesheapsnapshot=true, databaseenable d=false, handlesalerts=true, hastouchscreen=false, version=51.0.2704.106, platform=linux, browserconnectionenabled=false, nativeevents=true, acceptsslcerts=true, locationcontextenabled=true, webstorageenabled=true, browsername=chrome, takesscreenshot=true, javascriptenabled=true, cssselectorsenabled=true}] session id: e9d5caeb7c3f4e3e0819b6b65711aa32 * element info: {using=css selector, value=input[ng-model="query.title"]} @ runrequest <node_modules/intern/node_modules/leadfoot/session.js:88:40> @ <node_modules/intern/node_modules/leadfoot/session.js:109:39> @ new promise <node_modules/intern/node_modules/dojo/promise.ts:411:3> @ proxiedsession._post <node_modules/intern/node_modules/leadfoot/session.js:63:10> @ proxiedsession.session.find <node_modules/intern/node_modules/leadfoot/session.js:1125:15> @ command.<anonymous> <node_modules/intern/node_modules/leadfoot/command.js:42:36> @ <node_modules/intern/node_modules/dojo/promise.ts:393:15> @ run <node_modules/intern/node_modules/dojo/promise.ts:237:7> @ <node_modules/intern/node_modules/dojo/nexttick.ts:44:3> @ nexttickcallbackwith0args <node.js:415:9> @ command.find <node_modules/intern/node_modules/leadfoot/command.js:23:10> @ command.prototype.(anonymous function) [as findbycssselector] <node_modules/intern/node_modules/leadfoot/lib/strategies.js:24:16> @ datasource.querydatasource </home/trex/development/siren/kibi-integration/tests/functional/support/page/datasource.js:53:9> @ test.query mysql datasource [as test] </home/trex/development/siren/kibi-integration/tests/functional/community/index.js:83:11> @ <node_modules/intern/lib/test.js:181:24> @ <node_modules/intern/browser_modules/dojo/promise.ts:393:15> @ runcallbacks <node_modules/intern/browser_modules/dojo/promise.ts:11:11> @ <node_modules/intern/browser_modules/dojo/promise.ts:317:4> @ run <node_modules/intern/browser_modules/dojo/promise.ts:237:7> @ <node_modules/intern/browser_modules/dojo/nexttick.ts:44:3> >> 1/2 tests failed >> 1/2 tests failed
the unexpectedalertopen error means alert box opened before 1 of find calls; find call couldn't proceed because blocked modal alert dialog.
also note acceptalert
works native browser alert boxes, not arbitrary framework-generated dialogs (probably not relevant here, keep in mind).
Comments
Post a Comment