I want to know whether the serenity/js can be used for other JavaScript frameworks or it just only for Angular/js?
1 Answers
Protractor is a wrapper around Selenium WebDriver, which means that it can test anything WebDriver could.
To test any non-Angular project though you'll need to disable Angular-specific test synchronisation, which you can do using either:
Protractor configuration file
If your tests are only ever going to execute non-Angular projects, you can disable Angular-specific synchronisation for all the tests by adding browser.ignoreSynchronization = true
to the onPrepare
block in your protractor.conf.js file:
exports.config = {
// ... other config
onPrepare: function() {
browser.ignoreSynchronization = true; // <-- disables synchronisation
}
};
Serenity/JS task
If your tests need to support both Angular and non-Angular projects, you can toggle the synchronisation using the UseAngular.disableSynchronisation()
and UseAngular.enableSynchronisation()
tasks like this:
actor.attemptsTo(
UseAngular.disableSynchronisation(),
// ... interact with a non-Angular app
UseAngular.enableSynchronisation(),
// ... interact with an Angular app
)
You can learn more about the second approach in my article on "Cross-application testing"
If this answer helps, please mark it as accepted, thank you!
-
Thanks! As I know Serenity supports mocha, is there any way to use Jasmine with serenity? – Mani May 15 '17 at 08:08
-
Not yet, I'm afraid. The reporting information provided by Jasmine is quite rudimentary compared to Mocha, which makes writing custom reporters a bit more tricky. Also, Jasmine doesn't seem to support promise-based asynchronous tests and requires you to explicitly call the `done` callback, which is also better handled in Mocha. This being said, if there's a huge demand for Jasmine support (or a nice pull request ;-) ) I'd be happy to add it in. – Jan Molak May 15 '17 at 12:51