Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tarquas/testlab
NodeJS Mocha + PhantomJS Testing Module
https://github.com/tarquas/testlab
Last synced: about 2 months ago
JSON representation
NodeJS Mocha + PhantomJS Testing Module
- Host: GitHub
- URL: https://github.com/tarquas/testlab
- Owner: tarquas
- License: mit
- Created: 2014-10-29T13:22:30.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-02-11T07:59:22.000Z (almost 10 years ago)
- Last Synced: 2024-11-13T08:47:23.839Z (2 months ago)
- Language: JavaScript
- Homepage:
- Size: 148 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
TestLab
=======NodeJS Mocha + PhantomJS e2e Testing Module
This is official code repository of this project.
## Project Official Website
http://194.44.203.87/projects/testlab/
# Installation
$ `npm i testlab`
# Quick Usage
`test/test-google.js`
```javascript
var TestLab = require( 'testlab' );describe( 'slow: phantom: e2e tests', function() {
this.timeout( 20000 );
var browser = new TestLab.WebBrowser( TestLab.WebBrowser.FAST );
describe( 'google: test google.com search', function() {
this.timeout( 2000 );it( 'should show the search prompt as we type the text', function( done ) {
browser.pageOpenSuccessAll( 'http://google.com/', function( page ) {expectPage();
function expectPage() {
console.log( '* expecting search textbox to appear' );
page.expectClientSelector( 'form[action="/search"] input[name="q"]', fillForm );
}function fillForm() {
console.log( '* filling form' );
page.clientReadyFormFill(
{
form : 'form[action="/search"]',
values : {
q: 'test',
},
submit : false,
},
sendSearchRequest
);
}function sendSearchRequest() {
console.log( '* submitting form' );
page.clientTest(
function() {
document.querySelector( 'form[action="/search"]' ).submit();
},
{ },
expectSearchResults
);
}function expectSearchResults() {
console.log( '* expecting search results to appear' );
page.expectClientSelector( '#topstuff', page.thenClose( done ) );
}
} )
} )
} )
} )```
$ `mocha`
# Developer Guidelines
Javascript Coding Guideline: http://jscode.org/readable