Last active
December 16, 2015 16:09
-
-
Save zachsnow/5461429 to your computer and use it in GitHub Desktop.
An AngularJS e2e scenario runner DSL construct for immediately accessing the tested application's document. Maybe.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Return `document` for running application. | |
angular.scenario.dsl('doc', function(){ | |
return function(){ | |
return this.application.getWindow_().document; | |
}; | |
}); | |
// Return `jQuery(document.body)` for running application; | |
// requires you to have included your own copy of jQuery. | |
var body = function(){ | |
return return $(doc().body); | |
}; | |
// Using `doc`. | |
it('should allow immediate access to the document', function(){ | |
if(body().find('#hello').length){ | |
// Test one thing. | |
} | |
else { | |
// Test another thing. | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a test.