I have a suite of cypress tests for an online application. Some of my tests only tests what is on the final page of the application or decision pages and hence do not want to always fill the initial pages each time I run these tests. I am hence trying to see if I can load state and which auto populates all the initial pages and loads the page I have the tests or require to test
I tried using cy.session like in the login scenario but not making headway with this.
Please does anyone know how this can be done.
Related
I am currently working on a Laravel CRUD application and I was wondering why PHPUnit does not support crawling the browser (anymore, as I read). I already covered the basement of my project via PHPUnit, but I do also want to test links, a tags, button clicks etc. So I do already have a strong basement of unit tests.
Now I read about Dusk providing a crawler for DOM tests. Shall I use both together (is it even possible?) or should I migrate to Dusk? I'm not sure whether Dusk provides the same functionality as PHPUnit does and as stated, I do already have a strong phpunit testing base.
From now on I'm kinda stuck, because of 50:50 testcases, as I do also need to test whether the DOM does provide the correct information.
Appreciate any help or expert advice.
Thank you in advance!
Dusk is not a crawler but a browser driver, it can control a (headless) browser.
Specifically designed on top of PHPunit to do E2E (end to end) testing.
So convert to Dusk what is browser tests (html/javascript), but everything else keep as unit tests.
API tests for example you don't need dusk at all.
I'm using Cucumber and Watir in my web automation project (written in Ruby).
I've a set of feature files with scenarios that I am constantly running.
I've received a task to add an additional global check that makes sure that a set of strings does not show up on any of the DOM of any of the pages in any of the scenarios that I run.
For example, I've a scenario called 'Login to environment'. While running through that scenario and the normal flow for logging into the environment, I need something that also checks that some string bla doesn't show up in any of the HTML DOM. Also, I need this to happen for every other scenario that I have.
What is the correct way to implement such functionality in Cucumber/Watir/Ruby?
I have a Ruby program that uses a webdriver (Watir) to walk a page and perform tests alongside a BDD suite called RSpec.
I'm trying to optimize it for a slow server by improving its ability to navigate efficiently. Thus far It has been creating a new browser session for each test package, then closing it afterwards. This is very inefficient because it hits the login page again for every instance.
Of course, I don't want to hard-code navigation instructions into the tests because adding new spec files may change the order they are executed in, and not every page of the webapp has the main navigation bar, so navigation may need to change based on the page the last spec left the browser on.
I need some kind of master library or module that will take what page the program is at and what page it wants to go to, then bring the browser to that page so it can begin testing. What is the best way to do this?
I'm not fantastically experienced so I'd love input from more seasoned developers. Should I have each page be a class? Should I just stick with closing browsers after each test packet? Should I manually code brute-force methods (gotoPage1FromPage2)?
Okay, that last one was a joke. Seriously though, what is the best way to do this?
You are exactly correct about the difficulties of maintaining state in your tests. Shutting down a browser between each session is the best way to make sure that you always know the state of the browser at all times for a test. Saucelabs goes so far as to spin up a new virtual machine for each of the tests they run. Ideally you decrease test time by running multiple tests in parallel.
I'm not certain I know what you mean by "test package" or how many times that means you are starting a new browser and logging in, but... another thing to consider investigating is whether you can set a cookie or use oauth to log in without having to use the navigation. I've worked at places that allowed admin logins for their staging environments by passing a parameter in an url.
Your tests should be clear in their intention, which typically means your Page Object implementation does not know about what comes before or after the actions you are taking. You should be able to look at the RSpec code and reproduce exactly what it is testing. Abstracting methods for taking you from one place to another magically in the background is not a good idea.
Best practice used to be having methods from one Page Object return new Page Objects. So users could write methods like this in their tests: LoginPage.new.login.view_account.edit_address. Many of us have been bitten by this approach. Plus it isn't as easy to read as doing something like this:
LoginPage.new.login
HomePage.new.view_account
AccountPage.new.edit_address
This doesn't prevent you from using #visit methods as needed to navigate between Page Objects.
I have recorded script for atlassian confluence system. Purpose of this recording is to perform load test on confluence. Below scenarios are recorded
Login
Browse a Space
Create a wiki page
Edit a wiki page
Commenting on page
Logout
I have modified the script and those scenarios are worked fine when i run the script. Then when i record the script again and did the same modifications the edit action is not working as before. I have tried page editing action on multiple environments and sometimes it works and all the time it's not works. Why this is happening?
This is very high level information that you have shared. Please share more info about what kind error do you get in case of failures. You might be able to trace down your problem & solution by looking into following points.
Is your login request successful (valid login session)
Are you using cookie manager
Have you used assertions to verify valid/invalid responses
Have you used debug sampler and View Tree Results listener
Please use above to narrow down your problem and then share it over here.
i m doing selenium testing against an gwt wizard application, as a wizard, there are multiple steps, once user finish one step and click next, it transfer to next step, as gwt application, all steps are refreshed in the same page.
now i need to use selenium RC (java client) to write test against that gwt wizard and have 2 questions:
1. each time i start the wizard it require user login first, how can i avoid that login step to test the wizard directly?
2. since all steps are hold on the same page, how can i separate the test, say one test method for each step, without put the test in one big method?
Thanks.
I would suggest using Selenium2/Webdriver. Selenium 2 has the concept of page objects which allow you to create test objects which map to different pages within your app. I assume that you are enabling ensureDebugId in your gwt app (which allows you to access elements based on a predictable dom id). The combination of debugIds and selenium2 will allow you to quickly create a clean test representation of your pages and then allow your unit tests to simply drive the pages to where you need. The last bit of advice I would give for selenium2 and gwt is make sure that your page objects are created via AjaxElementLocatorFactory.