I have an integration test that is failing for the reason:
"Timeout::Error: timeout while waiting for angular"
I have run the test with selenium so that I can see what happens, and the page loads perfectly fine. I threw a debugger in my test so that I can browse around the app with the test fixtures-- and everything works perfectly...
Yet in the debugger, as soon as I type "page", to query what capybara thinks it sees, I get:
[5] pry(#<RSpec::Core::ExampleGroup::Nested_1>)> page
Timeout::Error: timeout while waiting for angular
from /Users/me/.rvm/gems/ruby-2.0.0-p451#my_app/gems/capybara-angular-0.0.4/lib/capybara/angular/waiter.rb:30:in `timeout!'
So basically it's lying to me because angular is fully loaded, api calls are happening and responding with json, the templates are getting interpolated... What the... ?
This gem has been updated to 0.1.0, which fixes the problem you are describing. Cheers!
Issue & Pull Request: https://github.com/wrozka/capybara-angular/issues/11
Related
While running multiple test suits on CBT via jenkins parallel, Jenkins get slower and page takes more time to load on CBT and hence it shows below error(which is intermittent)
Error: Angular could not be found on the page Https:xxx.xyz.com If this is not an Angular application, you may need to turn off waiting for Angular.
If is not angular application, you need to turn of wait for angular. Usually login pages are not angular:
browser.waitForAngularEnabled(false);
To check if is angular, open dev tools and in console just write "angular", if page is angular will return object, if not will return "Uncaught ReferenceError: angular is not defined".
just started working with reactjs recently, month or two..not a pro but can find my way around.. I am using create ract app (quickie ,that ships with service-worker) and my setup is such that I am deploying react app in the root of my java REST application, so all my service rest calls are in relative format, e.g /rest/myservice/123 etc.. and they work just fine..
but recently I started getting strange errors, and rest calls stopped working..
if I execute RET URL from browser .... nothing happens index loads... when I test with postman REST works just fine it also works in safari or if url is localhost... ...so after hours of frustration i discovered that service worker doing its .... caching . my rest calls are getting intercepted and they never make it to server... and there is nowhere that it mentions about how to overcome it, neither in service worker docs nor in create-react-app docs ...nothing is mentioned about this use case...... this is so pathetic...
I figured it out after numerous trail and errors... but it did not stop there..
I went ahead and deleted the service-worker registration entry from index.js also deleted service-worker file and rebuild the app. well service-worker.js file is still there... it showed up in build folder after I rebuild the project..... what is it with create-react-app did they got paid by google to include service-worker? or what is going on? why can not I remove it? and how do I prevent it from canceling my rest url calls?
when I type : https://xxxx.io/x/referal/refCode/3429878 it just loads application...
what else am I missing?
got the answer over #Redit needed to unregister worker...
details #:
https://www.reddit.com/r/reactjs/comments/8hovvb/removal_of_serviceworker_from_reactjs_app/
I have an Angular application that is leveraging template caching (part of our Gulp build process). The application runs fine, the cached views load... Except when rendered through PhantomJS (or Google's Pagespeed or Fetch as Google for that matter).
After much investigation, I found that routing is throwing this error:
Error: [$compile:tpload] Failed to load template: /static/app/public/views/about.html (HTTP status: undefined undefined)
I am assuming the HTTP status of undefined is related to the fact that no round trip is occurring... but I can't find any information on why this would fail, and especially why only when using the above mentioned tools.
To summarize:
App runs fine on Chrome, IE, Firefox, Opera
The cached template .js file contains the necessary path and html content
The path fails to resolve when loading through PhantomJS, Speedtest renderer, or Google's "Fetch as Google" tools
I have reviewed the Angular documentation on why this error is thrown, but it still doesn't make sense, the template has been populated (as the file template .js has been loaded)
Edit
I added the following line for debugging:
var about = $templateCache.get('/static/app/public/views/about.html');
console.log('about', about);
... and I see the proper output in the console log, even with PhantomJS.
It turns out that I was ignoring another error message:
Error: undefined is not a constructor (evaluating 'newUrl.startsWith(target)')
... happening due to PhantomJS's ES5. I didn't think the two issues were related, but after providing a polyfill for String.prototype.startsWith, the issue went away.
I'm writing a suite of Protractor tests from the ground up for a new Angular webapp. My team has asked me to run my tests against their Test server instance. I've got my config file and a basic test spec set up, but as soon as I hit the main page and do a simple expect() statement, I get "Timed out waiting for Protractor to synchronize with the page after 11 seconds."
Here's my test:
describe('the home page', function() {
it('should display the correct user name', function(){
expect(element(by.binding('user.name')).getText()).toContain(browser.params.login.user);
});
});
I cloned the dev team's git repo, set it up on my localhost, changed my baseUrl and ran my Protractor test against it locally. Passed without a hitch.
After some conversation with the dev team, I've determined that it's not a $http or $timeout issue. We use both of those services, but not repeatedly (I don't think they're "polling"). None of them should happen more than once, and all the timeouts are a half-second long.
What else could cause Protractor to time out like that? I wish it failed on my localhost so I could go tweak the code until I find out what's causing the problem, but it doesn't.
I have discovered the solution: check for console errors.
Turns out, one of our $http requests wasn't coming back because my Protractor tests were accessing the page via https, but one of our xhtml endpoints was at a non-secured location. This resulted in a very helpful console error which I had not yet seen, because it only occurred when accessing the site with WebDriver.
The error text: "The page at [url] was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint. This request has been blocked; the content must be served over HTTPS."
I modified my baseUrl to access the site via regular http, and now everything is working fine.
I've found fantastic unit/e2e test tools karma.
And I wrote simple chrome extension with angular. I want to write automated tests for it, but not only unit tests, end-to-end tests too.
I wrote something like this (will open my angular extension-options page):
it('Go to options page', function() {
browser().navigateTo('chrome-extension://aopgehikihpnclbfeohobanjecpiefho/html/application.html#/options');
});
I removed '--user-data-dir' and '--disable-default-apps' for karma-chrome-launcher, (because I want that my extension stays in chrome during "karma tests")
but I've got next error message "Sandbox Error: Application document not accessible.":
browser navigate to 'chrome-extension://aopgehikihpnclbfeohobanjecpiefho/html/application.html#/options'
http://localhost:9876/base/tests/e2e/scenario.js?1372429335000:9:5:
Sandbox Error: Application document not accessible.
Chrome 27.0 (Windows): Executed 2 of 2 (2 FAILED) (0.254 secs / 0.139 secs)
Chrome option --no-sandbox deprecated long time ago.
I'm sure I'm not wrong, the options page opens ok, but from chrome "omnibox".
chrome-extension://aopgehikihpnclbfeohobanjecpiefho/html/application.html#/options
Sandbox Error means no way for end-to-end tests for google chrome extensions via karma?
Can I set chrome to special "non-secure" mode just for tests?
Thanks,
i don't think karma scenario runner is capable to do that. You can try Protractor, it uses WebDriver and karma scenario runner will be replaced with it.
What if you tried setting a proxy? Like
proxies = {
'/': 'chrome-extension://aopgehikihpnclbfeohobanjecpiefho/'
};
in your karma-e2e.conf.js file and then
browser().navigateTo('/html/application.html#/options');
in the test?