I wrote an automated test using dijit robot - but in order to be able to use relative paths within our web application, I created an OSGi service for our tests and put the test code in a velocity template. When I try to run the tests, nothing happens. If I use the same script in an html file and access it directly from windows explorer (not via localhost), it works fine. I find that there are many cases that will make the dijit robot tests just not run - has anyone ran into this and found out all the little gotchas to make dijit tests run?
Check out dijit.initRobot(), that might take care of some things for you.
One thing that was screwing up a lot of my tests is described in this blog post - basically the robot was not initializing because I was obscuring a special div that the robot clicks to initialize.
However I have realized that there are still quite a few problems with the doh robot - it just seems very fragile. Often I will have a working test, then add 1 robot command and the test will break. When I remove the line and try it again...well the robot wont run even though it is the exact same code as before.
I've found the best thing to do when writing robot code is to just clear the cache every time and cross your fingers. Good luck.
Problem can be if you trying it with openjdk, run it on oracle java version
Related
Like the title says. I've recently gotten a hold of a Cypress codebase that I need to convert into Playwright. I'm new to both Cypress and Playwright but have experience using other automated testing systems. The last one I used made it pretty easy to set breakpoints on any line that would let me step through the code and see what each line was doing. I figured if I could do this, it would make my deciphering of the Cypress code so I could turn it into something that works with Playwright an easier prospect. Google has not been the most helpful here.
You can use Cypress' debugger to achieve something similar to setting breakpoints while executing via cypress open.
cy.get('foo').debug();
If you prefer VSCode, there is a similar SO question. It seems it require some manual setup to get debugger to work.
For IntelliJ (IDEA, WebStorm etc.), there is a paid Cypress Support Pro plugin (I'm the author). It fully integrates the IDE debugger with Cypress. See this video overview.
Having used robot framework for almost a year, it suddenly stopped working. Starting a script gives only the response
'pybot' is not recognized as an internal or external command, operable program or batch file.
Running scripts worked yesterday, and I can't remember making any changes since then. I have checked the environment variables, they haven't been changed. The installation is on a Windows Server 2012. Python is still working as usual. There is no difference between using pybot or robot.
Now I just don't know what else to look for, and I'm asking you geniuses to give some ideas on where to search for this error.
One of two things happened:
robot framework was uninstalled
something in your environment changed so that pybot is no longer on your PATH
Both of those should be very easy to verify.
It turns out that the python/scripts folder had been moved by someone into the python/Lib folder. Simply putting it back solved the issue.
P.S.: No, I do not want to debug my script. It is pretty awesome.
The problem is the application under test. If I place a few orders, it crashes. So what I want to do is: mid-execution, when I see that the application is crashed, I want to pause the test script, bring the application back up and running, and then resume the test.
I know that this is not the point of time when I should be running the test scripts as the application is not stable enough, but the developers are working on it and hopefully soon enough, they will fix it. I am just curious to know if there is a solution, because I couldn't find one. Of course I could've integrated bringing the application up again when it crashes in my tests, but that is not what I want to do.
My system:
OS: Linux Mint
Tests: Watir (Ruby) + Cucumber on Chrome
I run the tests on linux terminal using cucumber tags.
I just want to know in general if there is any way to pause and resume execution. For example, when I want to stop all the tests, I give the command line interruption Ctrl + C. So is there any such interrupt command to pause and resume?
Okay, since you want a "general" answer, here goes...
Based on your context, you are looking for a "crashed" condition in your project.
My own approach to solving this problem would involve writing a helper method that would look for this condition and, if true, it would "pause". For example...
def pause_if_crashed
sleep 30 if #browser.product_price.nil?
end
Then I would sprinkle this helper method in likely "crash" spots in my other functional methods.
Without more specifics about your needs, this is about as helpful as I can get, I think.
I am writing e2e Tests for some JS application at the moment. Since I am not a JS developer I was investigating on this theme for a while and ended up with the following setup:
Jasmine2 as testing framework
grunt as "build-tool"
protractor as test runner
jenkins as CI server (already in use for plenty java projects)
Although the application under tests is not written in angular I decided to go for protractor, following a nice guide on howto make protractor run nicely even without angular.
Writing some simple tests and running them locally worked like a charm. In order to implicitly wait for some elements to show up in den DOM I used the following code in my conf.js:
onPrepare: function() {
browser.driver.manage().timeouts().implicitlyWait(5000);
}
All my tests were running as expected and so I decided to go to the next step, i.e. installation in the CI server.
The development team of the aplication I want to tests was already using grunt to build their application so I decided to just hook myself into that. The goal of my new grunt task is to:
assemble the application
start a local webserver running the application
run my protractor test
write some test reports
Finally I accomplished all of the above steps, but I am dealing with a problem now I cannot solve and did not find any help googling it. In order to run the protractor test from grunt I installed the grunt-protractor-runner.
The tests are running, BUT the implicit wait is not working, causing some tests to fail. When I added some explicit waits (browser.sleep(...)) everything is ok again but that is not what I want.
Is there any chance to get implicitly waiting to work when using the grunt-protractor-runner?
UPDATE:
The problem does not have anything to do with the grunt-protractor-runner. When using a different webserver I start up during my taks its working again. To be more precisley: Using the plugin "grunt-contrib-connect" the tests is working using the plugin "grunt-php" the test fails. So I am looking for another php server for grunt now. I will be updating this question.
UPDATE 2:
While looking for some alternatives I considered and finally decided to mock the PHP part of the app.
Can I use Selenium IDE on a Drupal system?
I found http://drupal.org/project/selenium but that involves downloading Core and not using my current machine.
Does anybody know of a way to use the IDE with Drupal, or if not what do you suggest I do?
You can, in the same way that you can use selenium on just about any web page.
From what I can see (though I haven’t' used it) the selenium module seems to be more about using Drupal to store and run selenium tests, which is useful, but will not explicitly test your Drupal site. (edit: this module dosn't look like it is currently maintained)
Drupal comes with it's own testing framework which uses simpletest. This can do a lot of the testing that you will need. It can handle form submissions and check for text in a page. There are two cases that I personally have found that it is not very useful for:
Data integrity, where you would like to check that the content of a particular page is correct where you know what to expect on your system
Two is checking the site layout, where you wish to check your live site that certain elements appear as they should do.
Selenium can be used for both of these, in the simplest case you can record tests against your site and play them back to check it. You can check for an elements existence and style. You can check that elements have the text you would expect. Even a few of these can be useful as a tool for checking the configuration of your site.
It is also possible to integrate selenium with simplest so that while running your simpletests through Drupal it will run selenium tests, however this can get very complicated and confusing.
There's a nice new module that takes Selenium exports (in PHP) and converts them to Drupal SimpleTest suites. http://drupal.org/project/simpletest_selenium
This is nice because you can then do continuous integration testing by using Drush to script the running of your tests.
The question is what do you want to achieve?
testing a Drupal site?
saving / playing back configuration settings (automation through the browser)?
The Firefox & Selenium IDE (FF extension) combination works great with Drupal for functional testing.
It also works great if you want to capture some Drupal configuration settings (that you'd like to play back e.g. in another environment) but there are better ways - Patterns and Strongarm modules - to achieve that.
A couple of tips & tricks:
while capturing clicks be careful with timings (between clicks), sometimes you need to add "pause" lines to your test case,
for HTML form checkboxes Selenium often records the "click" action instead of the much safer "check" or "uncheck" action (this is important if you run your test case several times against the same page / form),
if your page reloads when you click a certain link, use "clickAndWait" instead of the simple "click" action,
use "verifyTextPresent" often, especially if you're running your tests "blindly", using Selenium RC.
I use selenium IDE all the time. It's an awesome tool for productivity and communication.
But Drupal's Simpletest framework has a built in browser for user testing. So you probably won't that module.
See:
http://www.lastcraft.com/web_tester_documentation.php
http://drupal.org/node/265762
http://www.lullabot.com/articles/drupal-module-developer-guide-simpletest
You can test Drupal 7 with SeLite, which extends Selenium IDE. It allows your tests to access (read and write to) a test DB (isolated from the DB of the tested application).
It's especially good for Drupal 7, which can have its data in (separate) SQLite DB. So if your test environment can use SQLite, your test data lifecycle will be very easy. However, you can benefit from SeLite even if your test Drupal instance uses other type of DB.
See https://code.google.com/p/selite/wiki/ProjectHome and https://code.google.com/p/selite/wiki/DrupalTutorial.