Github user michellephung commented on the pull request:
https://github.com/apache/couchdb-fauxton/pull/136#issuecomment-62472667
@robertkowalski Regarding manually deleting databases after failed tests:
This is tricky.
Sometimes during a test failure, Nightwatch will just bail. It will end all
subsequent test suites, not run anything else, and when this happens, you'll
get leftover databases to clean up, since on error, it will exit the program
all together. I've noticed that this happens mostly when I am writing a
javascript callback inside a function like, .getText(), where [something went
wrong, and] the page isn't there.
Sometimes it's because of the functions we are using. Many of the browser
behaviors we use are assertions, that need to be passed in order for the rest
of the test to continue.
When I want to check if the page has a certain element or bit of text I use
client.verify.visible(".fauxton");
instead of
client.assert.visible(".fauxton");
`.verify` will fail that particular test, but will keep going and clean up,
even though that checkpoint failed,
whereas `.assert` will end the browser testing altogether, without clean up.
Also, functions like:
.waitForElementVisible('#js-new-database-name', waitTime, false)
have a third callback that is for AbortOnFailure, meaning if it is unset,
will exit Nightwatch on failure. Setting this to `false` will continue running
the program, and clean up.
Originally I set up the timestamps because Nightwatch can have multiple
browser tests running in parallel, and I didn't want to Firefox's browser test
to interfere with Chrome's test, etc. I'm not sure if we will revisit this idea
of parallel testing or not, so I've renamed all the databases used in the test
to 'fauxton-selenium-tests', per your suggestion.
I am still thinking about your other comment, of deleting a database [that
may or may not be there to delete], then creating it again....
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---