Skip to main content

UseAngular

Instructs the Actor to enable or disable automated synchronisation between Protractor and Angular 1.x application.

Useful when a test scenario needs to interact with both Angular-based and non-Angular web apps, e.g. use an external sign-in form.

Please note if your tests interact with a non-Angular app you can disable synchronisation altogether in protractor.conf.js.

Warning: this interaction is Protractor-specific, so using it in your tests will reduce their portability across test integration tools.

Disabling synchronisation temporarily

import { actorCalled } from '@serenity-js/core'
import { UseAngular } from '@serenity-js/protractor'
import { Navigate } from '@serenity-js/web'
import { protractor } from 'protractor'

await actorCalled('Angie')
.whoCan(BrowseTheWeb.using(protractor.browser))
.attemptsTo(
UseAngular.disableSynchronisation(),
Navigate.to('https://mycompany.com/login'),
// navigate to a non-Angular app, perform some activities...

UseAngular.disableSynchronisation(),
Navigate.to('https://myapp.com'),
// navigate to an Angular app, perform some more activities...
)

Disabling synchronisation with Angular in protractor.conf.js

exports.config = {
onPrepare: function () {
return browser.waitForAngularEnabled(false);
},
// ... other config
}

Learn more

Index

Constructors

constructor

Methods

staticdisableSynchronisation

  • disableSynchronisation(): Interaction
  • Produces an Interaction that instructs the Actor to disable synchronisation between Protractor and an Angular 1.x app.


    Returns Interaction

staticenableSynchronisation

  • enableSynchronisation(): Interaction
  • Produces an Interaction that instructs the Actor to enable synchronisation between Protractor and an Angular 1.x app.


    Returns Interaction