Can’t get Shippable to run my protractor tests - angularjs

The errors I get from shippable looks like this
Failures:
1) homepage should have the name of the app in the navbar
Message:
Error: Error while running testForAngular: Timed out waiting for async script result after 11002ms
Command duration or timeout: 11.13 seconds
Build info: version: '2.40.0', revision: 'fbe29a9', time: '2014-02-19 20:54:28'
System info: host: '61185b2d1026', ip: '172.17.18.4', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-32-generic', java.version: '1.7.0_67'
Session ID: 71602336-8ec6-44bd-a755-9fc82da1d337
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{platform=LINUX, acceptSslCerts=true, javascriptEnabled=true, cssSelectorsEnabled=true, databaseEnabled=true, browserName=firefox, handlesAlerts=true, browserConnectionEnabled=true, webStorageEnabled=true, nativeEvents=false, rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true, takesScreenshot=true, version=29.0}]
Stacktrace:
Error: Error while running testForAngular: Timed out waiting for async script result after 11002ms
Command duration or timeout: 11.13 seconds
Build info: version: '2.40.0', revision: 'fbe29a9', time: '2014-02-19 20:54:28'
System info: host: '61185b2d1026', ip: '172.17.18.4', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-32-generic', java.version: '1.7.0_67'
Session ID: 71602336-8ec6-44bd-a755-9fc82da1d337
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{platform=LINUX, acceptSslCerts=true, javascriptEnabled=true, cssSelectorsEnabled=true, databaseEnabled=true, browserName=firefox, handlesAlerts=true, browserConnectionEnabled=true, webStorageEnabled=true, nativeEvents=false, rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true, takesScreenshot=true, version=29.0}]
at Error ()
==== async task ====
WebDriver.executeScript()
at [object Object]. (/home/shippable/workspace/src/github.com/tipfortip/www/public/index-spec.js:4:13)
==== async task ====
Asynchronous test function: it()
Error
at [object Object]. (/home/shippable/workspace/src/github.com/tipfortip/www/public/index-spec.js:3:3)
at Object. (/home/shippable/workspace/src/github.com/tipfortip/www/public/index-spec.js:1:63)
2) homepage should have the name of the app in the footer
Message:
Error: Angular could not be found on the page http://localhost:8000/ : angular never provided resumeBootstrap
Stacktrace:
Error: Angular could not be found on the page http://localhost:8000/ : angular never provided resumeBootstrap
==== async task ====
WebDriver.executeScript()
at [object Object]. (/home/shippable/workspace/src/github.com/tipfortip/www/public/index-spec.js:14:13)
==== async task ====
Asynchronous test function: it()
Error
at [object Object]. (/home/shippable/workspace/src/github.com/tipfortip/www/public/index-spec.js:13:3)
at Object. (/home/shippable/workspace/src/github.com/tipfortip/www/public/index-spec.js:1:63)
I can run the tests successfully with Firefox and Chrome on my computer.

For some reason the Shippable system did not recognize the bootstrapping that my document was doing. Needed to add it in the HTML of the page that was resolving.
angular.element(document).ready -> angular.bootstrap document, ['foo']
did not work, needed
<!DOCTYPE html>
<html data-ng-app="foo">

Related

I am getting error while maximazing the chrome window

I am facing the problem while executing the code to maximize the window.
Below is the error message:
unknown error: cannot get automation extension
from unknown error: page could not be found: chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html
(Session info: chrome=58.0.3029.110)
(Driver info: chromedriver=2.25.426923 (0390b88869384d6eb0d5d09729679f934aab9eed),platform=Windows NT 6.3.9600 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 10.03 seconds
Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 16:57:40'
System info: host: 'SDN-117', ip: '172.10.189.52', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_73'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.25.426923 (0390b88869384d6eb0d5d09729679f934aab9eed), userDataDir=C:\Users\TANUJA~1\AppData\Local\Temp\scoped_dir9140_12941}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=58.0.3029.110, platform=WIN8_1, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 12757c3f618b72bfaffb8713a175d458
Kindly help me to sort out the problem.
Here is the Answer to your Question:
To maximize Google Chrome browser window it is recommended to use ChromeOptions class instead of driver.manage().window().maximize();. Here is the sample code for your reference:
System.setProperty("webdriver.chrome.driver", "C:\\Utility\\BrowserDrivers\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("test-type");
options.addArguments("start-maximized");
options.addArguments("disable-infobars");
WebDriver driver = new ChromeDriver(options);
Let me know if this Answers your Question.

I am getting 80% time error on running protractor scripts on IE 11

My protractor scripts are highly stable on chrome browser but the same scripts throws below mentioned for 20% of the test cases.
Failed: JavaScript error (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 100 milliseconds
Build info: version: '3.3.1', revision: '5234b32', time: '2017-03-10 09:04:52 -0800'
System info: host: 'LAPTOP-RNQ2JQBE', ip: '192.168.89.115', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{browserAttachTimeout=0, ie.enableFullPageScreenshot=true, enablePersistentHover=true, ie.forceCreateProcessApi=false, ie.forceShellWindowsApi=false, pageLoadStrategy=normal, ignoreZoomSetting=true, ie.fileUploadDialogTimeout=3000, version=11, platform=WINDOWS, nativeEvents=true, ie.ensureCleanSession=false, elementScrollBehavior=0, ie.browserCommandLineSwitches=, requireWindowFocus=false, browserName=internet explorer, initialBrowserUrl=http://localhost:41897/, javascriptEnabled=true, ignoreProtectedModeSettings=false, enableElementCacheCleanup=true, unexpectedAlertBehaviour=dismiss}]
Session ID: f32d0eb8-65d9-4161-9535-da5cde8b9a6c
Failed: Error while waiting for Protractor to sync with the page:
"Unable to get property '$$testability' of undefined or null
reference"

Failures: Angular js testing tool protractor error for testing a application

while compiling cfg file we getting this error.
Failures:
1) Protractor Demo App should have a title
Message:
Failed: element not visible
(Session info: chrome=55.0.2883.87)
(Driver info: chromedriver=2.26.436362 (5476ec6bf7ccbada1734a0cdec7d570bb0
42aa30),platform=Windows NT 6.3.9600 x86_64) (WARNING: The server did not provid
e any stacktrace information)
Command duration or timeout: 120 milliseconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:
03'
System info: host: 'Guest684', ip: '172.17.13.252', os.name: 'Windows 8.1',
os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_92'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulati
onEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.2
6.436362 (5476ec6bf7ccbada1734a0cdec7d570bb042aa30), userDataDir=C:\Users\miracl
e\AppData\Local\Temp\scoped_dir9992_4680}, takesHeapSnapshot=true, pageLoadStrat
egy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, ver
sion=55.0.2883.87, platform=WIN8_1, browserConnectionEnabled=false, nativeEvents
=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true,
browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssS`enter code here`electorsE
nabled=true, unexpectedAlertBehaviour=}]
Session ID: 9601e64df3743dbf5dc215bd39d4f528
Stack:
ElementNotVisibleError: element not visible
Please use protractor Configuration and Specification file for your protractor test.
Configuration file should have - Selenium Port address, Browser info and Specification file name
Specification file should have - Test Steps and Verification Part.

Edit ui-grid cell value using protractor

I am using protractor to test angular 1.3.13 and ui-grid 3.0. All cells in grid are editable. In my tests I can get cell using following method:
dataCell: function( gridId, fetchRow, fetchCol ) {
var row = this.getGrid( gridId ).element(by.css('.ui-grid-render-container-body')).element( by.repeater('(rowRenderIndex, row) in rowContainer.renderedRows track by $index').row( fetchRow ) );
return row.element( by.repeater('(colRenderIndex, col) in colContainer.renderedColumns track by col.colDef.name').row( fetchCol ));
}
from https://github.com/angular-ui/ng-grid/blob/master/test/e2e/gridTestUtils.spec.js.
After I get first cell from first row, when I try to send value to cell
cell.click();
cell.sendKeys("newCellValue");
test breaks. I get following error message:
- Failed: unknown error: cannot focus element
(Session info: chrome=40.0.2214.115)
(Driver info: chromedriver=2.14.313457
(3d645c400edf2e2c500566c9aa096063e707c9cf),platform=Linux 3.13.0-49-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 35 milliseconds
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
System info: host: 'xxxxxxxxx', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-49-generic', java.version: '1.8.0_40'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={userDataDir=/tmp/.com.google.Chrome.LHfq2F}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, version=40.0.2214.115, platform=LINUX, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 50857fdfa10a4bc75444d21f2d04359e
(Session info: chrome=40.0.2214.115)
(Driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf),platform=Linux 3.13.0-49-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 35 milliseconds
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
System info: host: 'xxxxxxxxx', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-49-generic', java.version: '1.8.0_40'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={userDataDir=/tmp/.com.google.Chrome.LHfq2F}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, version=40.0.2214.115, platform=LINUX, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 50857fdfa10a4bc75444d21f2d04359e
at /usr/lib/node_modules/protractor/node_modules/jasminewd2/index.js:102:16
at [object Object].promise.ControlFlow.runInFrame_ (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1877:20)
at [object Object].promise.Callback_.goog.defineClass.notify (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:2464:25)
at [object Object].promise.Promise.notify_ (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:563:12)
The problem occurs when sendKeys method is called. Does anyone know the correct way to change cell value using protractor?
Solved it. You need to focus cell and access input element:
cell.click();
cell.element(by.css(".ui-grid-cell-focus input")).sendKeys("newCellValue");
EDIT:
Has some issues on older browser versions, better to use:
cell.click();
cell.element(by.css("input")).sendKeys("newCellValue");
EDIT:
Another issue is with Firefox where cell.click() is not working properly.
Workaround/hack: https://stackoverflow.com/a/23370177

Protractor browser.get() throwing exception in IE11

I'm trying to run a simple protractor test in IE11 on Win 8.1.
My test:
it("should navigate to from the homepage to the add contact page", function () {
browser.get("http://localhost:4000/");
// ... it already crashes here
});
My config:
exports.config = {
// run in multiple browsers
multiCapabilities:[
{
'browserName': 'internet explorer',
}
],
specs: ['./**/*js'],
// Options to be passed to Jasmine-node.
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000
},
onPrepare: function () {
require('jasmine-reporters');
jasmine.getEnv().addReporter(
new jasmine.JUnitXmlReporter('xmloutput', true, true)
);
}
};
The error:
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://169.254.80.80:31289/wd/hub
[31mF[0m
Failures:
1) add new contact page should navigate to from the homepage to the add contact page
Message:
[31mUnknownError: JavaScript error (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 63 milliseconds
Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:02:37'
System info: host: 'Florian-Lenovo', ip: '169.254.80.80', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_25'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{browserAttachTimeout=0, enablePersistentHover=true, ie.forceCreateProcessApi=false, ie.usePerProcessProxy=false, ignoreZoomSetting=false, handlesAlerts=true, version=11, platform=WINDOWS, nativeEvents=true, ie.ensureCleanSession=false, elementScrollBehavior=0, ie.browserCommandLineSwitches=, requireWindowFocus=false, browserName=internet explorer, initialBrowserUrl=http://localhost:22540/, takesScreenshot=true, javascriptEnabled=true, ignoreProtectedModeSettings=false, enableElementCacheCleanup=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=dismiss}]
Session ID: 2b2e9619-3eb8-493f-bc9d-5354a91f7f8b[0m
Stacktrace:
UnknownError: JavaScript error (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 63 milliseconds
Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:02:37'
System info: host: 'Florian-Lenovo', ip: '169.254.80.80', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_25'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{browserAttachTimeout=0, enablePersistentHover=true, ie.forceCreateProcessApi=false, ie.usePerProcessProxy=false, ignoreZoomSetting=false, handlesAlerts=true, version=11, platform=WINDOWS, nativeEvents=true, ie.ensureCleanSession=false, elementScrollBehavior=0, ie.browserCommandLineSwitches=, requireWindowFocus=false, browserName=internet explorer, initialBrowserUrl=http://localhost:22540/, takesScreenshot=true, javascriptEnabled=true, ignoreProtectedModeSettings=false, enableElementCacheCleanup=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=dismiss}]
Session ID: 2b2e9619-3eb8-493f-bc9d-5354a91f7f8b
at new bot.Error (C:\Users\Florian\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:113:18)
at Object.bot.response.checkResponse (C:\Users\Florian\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\response.js:106:9)
at C:\Users\Florian\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:362:20
at C:\Users\Florian\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\base.js:1582:15
at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (C:\Users\Florian\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:1654:20)
at notify (C:\Users\Florian\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:465:12)
at notifyAll (C:\Users\Florian\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:442:7)
at resolve (C:\Users\Florian\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:420:7)
at [object Object].fulfill (C:\Users\Florian\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:535:5)
at C:\Users\Florian\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:1520:10
==== async task ====
Protractor.get(http://localhost:4000/) - reset url
at [object Object].webdriver.WebDriver.schedule (C:\Users\Florian\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:345:15)
at [object Object].Protractor.executeScript_ (C:\Users\Florian\AppData\Roaming\npm\node_modules\protractor\lib\protractor.js:223:22)
at [object Object].Protractor.get (C:\Users\Florian\AppData\Roaming\npm\node_modules\protractor\lib\protractor.js:440:8)
at [object Object].<anonymous> (C:\OneDrive\Projects\Gyst\Gyst.Web\Scripts\tests\e2e\contacts\addNewContactSpecs.ts:10:17)
at C:\Users\Florian\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd\index.js:94:14
at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (C:\Users\Florian\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:1654:20)
at [object Object].webdriver.promise.ControlFlow.runEventLoop_ (C:\Users\Florian\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:1518:8)
==== async task ====
Asynchronous test function: it()
at [object Object].<anonymous> (C:\Users\Florian\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd\index.js:93:33)
at [object Object].<anonymous> (C:\Users\Florian\AppData\Roaming\npm\node_modules\protractor\node_modules\minijasminenode\lib\async-callback.js:45:37)
at [object Object].jasmine.Block.execute (C:\Users\Florian\AppData\Roaming\npm\node_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:1174:17)
at [object Object].jasmine.Queue.next_ (C:\Users\Florian\AppData\Roaming\npm\node_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:2209:31)
at onComplete (C:\Users\Florian\AppData\Roaming\npm\node_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:2205:18)
at [object Object].jasmine.WaitsForBlock.execute (C:\Users\Florian\AppData\Roaming\npm\node_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:2704:5)
at [object Object]._onTimeout (C:\Users\Florian\AppData\Roaming\npm\node_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:2718:12)
Error
at [object Object].<anonymous> (C:\OneDrive\Projects\Gyst\Gyst.Web\Scripts\tests\e2e\contacts\addNewContactSpecs.ts:9:5)
at [object Object].jasmine.Env.describe_ (C:\Users\Florian\AppData\Roaming\npm\node_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:913:21)
at [object Object].jasmine.Env.describe (C:\Users\Florian\AppData\Roaming\npm\node_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:898:15)
at describe (C:\Users\Florian\AppData\Roaming\npm\node_modules\protractor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:658:27)
at Object.<anonymous> (C:\OneDrive\Projects\Gyst\Gyst.Web\Scripts\tests\e2e\contacts\addNewContactSpecs.ts:1:34)
Finished in 1.015 seconds
[31m1 test, 1 assertion, 1 failure
[0m
Shutting down selenium standalone server.
[launcher] 0 instance(s) of WebDriver still running
[launcher] internet explorer #1 failed 1 test(s)
[launcher] overall: 1 failed spec(s)
[launcher] Process exited with error code 1
I'm still pretty new to protractor and I don't have a clue what to do with this.
My tests run fine in Chrome and Firefox.
Any ideas?
try this one, for me it helped with a similar error saying A Jasmine spec timed out. Resetting the WebDriver Control Flow.
protractor-conf.js
{"browserName": "internet explorer",
"ie.forceCreateProcessApi": true,
"ie.browserCommandLineSwitches": "-private",
"ie.ensureCleanSession": "true",
"seleniumAddress": 'http://10.0.1.XXX:4444/wd/hub'
}
Ensure that TabProcGrowth" = dword: 00000000 in Path HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main is set.
IEExplorerDriver is expected to implement asynchronous script executions except that there are a couple of known issues, that the driver can be slow and often times out waiting for page load:
http://angular.github.io/protractor/#/browser-setup
https://github.com/angular/protractor/issues/1052
In your case as per the logs you provided, the lines somehow indicates a timeout has happen.
It's still an open issue for the Protactor team and hopefully, they will come up with a solution soon.
Another thing to possibly consider is that, Protactor uses Promises in order to execute scripts asynchronously, which in terms of browser support is currently still in Preview release in IE11
https://status.modern.ie/promiseses6
For none angular sites instead of driver.get use below code .
browser.driver.get("https://material.angularjs.org/latest/demo/radioButton");
Also go Internet options in IE>IE options and enable protected mode for all the zones
I managed to solve this with below capabilities in my config,js
onPrepare: function () {
browser.driver.ignoreSynchronization = true;// for non-angular set true. default value is false
browser.waitForAngularEnabled(false); // for non-angular set false. default value is true
browser.driver.manage().window().setSize(1280, 1024);
},
capabilities: {
browserName: 'internet explorer',
platform: 'ANY',
version: '11'
},

Resources