behave_manners.pagelems.scopes module

class Angular5App(parent, templates=None)

Bases: behave_manners.pagelems.scopes.WaitScope

Scope of an application using Angular 5+

wait_js_conditions = ["if (document.readyState != 'complete') { return 'document'; }", "if (window.jQuery && window.jQuery.active) { return 'jQuery'; }", "if(!window.getAllAngularTestabilities) { return 'angular-startup';}", "if(window.getAllAngularTestabilities().findIndex(function(x) { return !x.isStable(); }) >= 0) {return 'angular';}"]
class AngularJSApp(parent, templates=None)

Bases: behave_manners.pagelems.scopes.WaitScope

Scope of an application using AngularJS (1.x)

wait_js_conditions = ["if (document.readyState != 'complete') { return 'document'; }", "if (window.jQuery && window.jQuery.active) { return 'jQuery'; }", "if (!angular) { return 'angularjs-startup'; }", "if (angular.element(document).injector().get('$http').pendingRequests.length > 0) { return 'angularjs';}"]
class Fresh(comp)

Bases: object

Keep a component fresh, recovering any stale children under it

class GenericPageScope(parent, templates=None)

Bases: behave_manners.pagelems.scopes.WaitScope

Default page scope

Page scope is the one attached to the remote DOM ‘page’, ie the <html> element. A good place to define page-wide properties, such as waiting methods.

Wait for JS at least

class RootDOMScope(templates=None, site_config=None)

Bases: behave_manners.pagelems.base_parsers.DOMScope

Default scope to be used as parent of all scopes

Such one would be the parent of a ‘page’ scope.

Given that scopes can use the attributes of parent ones, this is where global attributes (such as site-wide config) can be set.

component_class

alias of behave_manners.pagelems.dom_components.ComponentProxy

class WaitScope(parent, templates=None)

Bases: behave_manners.pagelems.base_parsers.DOMScope

class Page

Bases: object

wait_all(timeout)
isready_all(driver)

Signal that all actions are settled, page is ready to contine

Override this to add any custom logic besides isready_js() condition.

isready_js(driver)

One-off check that JS is settled

Parameters:driver – WebDriver instance
resolve_timeout(timeout)
timeouts = {'long': 60.0, 'medium': 10.0, 'short': 2.0}
wait(timeout='short', ready_fn=None, welem=None, webdriver=None)

Waits until ‘ready_fn()` signals completion, times out otherwise

wait_all(timeout='short', welem=None, webdriver=None)

Waits for all conditions of isready_all()

wait_js_conditions = ["if (document.readyState != 'complete') { return 'document'; }", "if (window.jQuery && window.jQuery.active) { return 'jQuery'; }"]