I'm a protractor learner. So, I'm trying different methods in my tests while I'm testing my application. So, I was using browser.setLocation Before Each test for cases like page redirected during the test run, instead of just using browser.driver.get
As I understand I think using of browser.setLocation resolved lots of random failures I faced while running the test. I didn't want to use a browser.sleep().
I read this Protractor documentation for more clarification and it doesn't help.
Can someone tell me the usage of this method. Any kind of information will be appreciated.
Thanks in advance. :)
browser.setLocation() uses Angular's $location. browser.driver.get is like typing in a new URL into the search bar. browser.get, which is what most people use, is a wrapped version of browser.driver.get which waits for everything to be synced.
Related
I´m currently integrating my cucumber jvm/selenium project with zalenium.
It´s easy and everything works like charm, but only one little exception.
When driver is instantiated for zalenium, I send desired capabilities like:
desiredCapabilities.setCapability("build","My release name");
desiredCapabilities.setCapability("name","My test name");
And zalenim dashboard reflects this data ok.
But....how cand I send my dynamic cucumber scenario name to this capabilities? It´s possible???
I dont know how can I do this, because at the time of desiredcapabilities definition, cucumber scenarios are not parsed yet and scenario.getName() is always null, and I cant find a way to overwrite de default zalenium scenario name with this value.....
For example, to set final tests status in dashboard, zalenium uses sendCookie to change this vaue, but i cant find any similar for test name.
May appear a silly question, and I´m sure that has a silly answer... :D
Some help??
Thanks in advance!!!
You can do this by instantiating your browser in Cucumber Before hook and then passing the name to DesiredCapabilities
Does somebody have somewhere a simple Component example of Algolia Places used with react-instantsearch ?
I am desperately trying to mix the two of them, but I can't figure out what to use : ? how ?
It's written in the docs that we should have a HTMLInputElement as a required container option, so how do you deal with React where you shouldn't be able to touch the DOM ?
Cheers
Arnaud
There is no sample available yet; However you can take a look at a few non-official implementations:
https://www.npmjs.com/package/react-places-autocomplete
https://www.npmjs.com/package/algolia-places-react
https://www.npmjs.com/package/react-algolia-places
We'll be building an official one soon.
While waiting for Algolia to develop their own stuff, a simple solution exists, built here :
Go to https://www.algolia.com/users/sign_up/places to get an API Key and an API Id (it's the most difficult part actually, as getting to this URL naturally on Algolia's website is so difficult that I didn't succeed yet).
Get algolia-places-react, which is the package most customisable.
Fill in your options as per the Read Me, and you're good to go !
I am using Selenium framework for my test cases execution.
I need an instant report of test cases that are passed while the full suite is in execution currently.
For Eg: There are 100 test cases in suite and five have run of which 3 passed, 2 failed and I need these instant report while the suite is in-progress. Can you please help me with this task?
You can use ExtentReport.
You can use it to log your test steps and once its done it will generate a report to show your results.
For what your looking for, ExtentReport uses a "flush".
If you call this flush after each test step it will amend the step and create the report.
This is something I'm looking into myself at the moment, so I wouldn't consider this an answer but something I've stumbled across myself, hope it helps.
Here is how to set up ExtentReports on your project with examples - http://www.ontestautomation.com/creating-html-reports-for-your-selenium-tests-using-extentreports/
You must use it in conjunction with a test runner eg. TestNG or JUnit.
For what you are trying to achieve is slightly different to the example. You need to call a flush after every test step so it will amend to the report after the step is completed rather than when all the tests are completed. Its not something I have done before but it was explained to me like the following
Just call .flush() after every test instead of once at the end of your test run. BUT you need to make sure the ExtentReports object itself is only initialized once, instead of being reinitialized at the start of every test. For example, I used TestNG. The ExtentReports is called once using #BeforeSuite, but the .flush() is called after every test using #AfterMethod. I hope this makes sense.
The only thing that can’t be solved via code is the HTML refresh as this is outside the control of the ExtentReports library (it doesn’t know where you’ve opened the actual HTML file). But this can be taken care of by using a simple browser plugin as I said. At least for Chrome there are a lot of them, just do a Google search for ‘chrome auto refresh’.
Hope this helps. If you need anymore advice don't hesitate to contact me.
All,
We are developing our app with AngularJS and time and again we keep running into the issue of Angular running or loading controllers twice. This becomes a little more intrusive when testing our controllers and more specifically when working with Testacular with jasmine's SpyOn's (since they get triggered before our code runs). So, our question is, is there such a thing as a constructor or init method that Angular is guaranteed to call when instantiating the controllers w/o having to hack work-arounds in the test code? TIA.
If you are specifying the controller in your router, then your template doesn't need to specify the controller via an ng-controller tag. Doing so will double load your controller.
Your controllers shouldn't be loaded twice, unless you are doing something wrong. You shouldn't have to hack any work-arounds.
You might want to provide a concrete example of how you are loading the controllers (and/or the partials which are associated with the controllers). It sounds like you probably have a routing issue which is causing your view to be loaded twice for each request.
Assuming that is a routing-related issue, unless/until you can provide more information to help people to help you, you may want to read this document. Pay particular mention to sections that mention 'redirect' and 'HTML 5' mode:
http://docs.angularjs.org/guide/dev_guide.services.$location
With so little information to go on, I can't answer your question, but perhaps that link will help you to help yourself. :)
Well, i have been struggling this for almost a day now... Yet I cant figure out why my recaptcha plugin is being called twice. I suspect, my paypal plugin is also being called twice for sure. I really have no idea why my components are being called twice coz i know it is not possible for a plugin actions to be called twice if it is loaded twice. Any inputs/ideas will be highly appreciated. please help. I hate problems that don't give me much clues on where to look first. Thank you in advanced
I had this same problem. I noticed that reCAPTCHA was always failing validation and determined that it was being called twice and the second time always failed, I assume because the reCAPTCHA library is only designed to allow for a given challenge to be validated once.
In my case, it was being called twice because I was manually calling Model::validate() before Model::save(), which also validates unless if told not to. I fixed the issue by turning off validation in the call to save (Model::save(null, false)).