-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #171 from sourcejs/0.5.5-dev
0.5.5
- Loading branch information
Showing
14 changed files
with
338 additions
and
26 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
var appPort = casper.cli.get("app-port") || 8080; | ||
var url = 'http://127.0.0.1:' + appPort; | ||
|
||
casper.options.viewportSize = {width: 1024, height: 768}; | ||
|
||
var urlsToCheck = [ | ||
url, | ||
url + '/docs/spec/', | ||
url + '/docs/' | ||
]; | ||
|
||
var error = {}; | ||
|
||
casper.on("page.error", function(msg, trace) { | ||
error.msg = msg; | ||
|
||
this.echo("Error: " + msg, "ERROR"); | ||
this.echo("file: " + trace[0].file, "WARNING"); | ||
this.echo("line: " + trace[0].line, "WARNING"); | ||
this.echo("function: " + trace[0]["function"], "WARNING"); | ||
}); | ||
|
||
urlsToCheck.forEach(function(item){ | ||
casper.test.begin('Check availability and JS errors on ' + item, 2, function(test) { | ||
error = {}; | ||
|
||
casper.start(item).then(function(response) { | ||
|
||
casper.wait(500, function(){ | ||
// Slow down a bit, because of strange API bug | ||
}); | ||
|
||
if (response.status !== 200) { | ||
test.fail("Page load error, expected status 200, got " + response.status); | ||
} else { | ||
test.pass("Status 200 OK"); | ||
} | ||
}).then(function() { | ||
if (typeof error.msg === 'string') { | ||
test.fail("JS errors found: "+ error.msg); | ||
} else { | ||
test.pass("No JS errors"); | ||
} | ||
|
||
}).run(function() { test.done() }).clear(); | ||
}); | ||
}); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
var appPort = casper.cli.get('app-port') || 8080; | ||
var url = 'http://127.0.0.1:' + appPort + '/docs/'; | ||
|
||
casper.options.viewportSize = {width: 1024, height: 768}; | ||
|
||
casper.test.begin('Check navigaton page', 3, function suite(test) { | ||
casper.start(url).then(function() { | ||
var _this = this; | ||
var nav = '.source_catalog_list .source_catalog_list_i'; | ||
|
||
this.waitForSelector(nav, | ||
function pass() { | ||
test.assertEval(function (nav) { | ||
return document.querySelectorAll(nav).length > 5; | ||
}, 'Should have more than 5 nav items', [nav]); | ||
|
||
test.assertEval(function (nav) { | ||
return !!document.querySelector(nav + ' .source_catalog_a[href="/docs/base"]') && | ||
!!document.querySelector(nav + ' .source_catalog_a[href="/docs/clarify"]') && | ||
!!document.querySelector(nav + ' .source_catalog_a[href="/docs/starting"]'); | ||
}, 'Right nav items in set', [nav]); | ||
}, | ||
function fail() { | ||
test.fail(nav); | ||
} | ||
); | ||
|
||
}).then(function(){ | ||
this.click('.source_catalog_image-tumbler'); | ||
test.assertExists('.source_catalog.__show-preview', 'Show preview toggled'); | ||
|
||
}).run(function() { test.done() }).clear(); | ||
}); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
var appPort = casper.cli.get('app-port') || 8080; | ||
var url = 'http://127.0.0.1:' + appPort; | ||
|
||
casper.options.viewportSize = {width: 1024, height: 768}; | ||
|
||
casper.test.begin('Checking search', 3, function suite(test) { | ||
casper.start(url).then(function() { | ||
var _this = this; | ||
var input = '.source_search .source_search_it'; | ||
var autoComplete = '.autocomplete-wrapper .autocomplete-suggestion:first-child a'; | ||
var searchField = '.source_search_it[data-initialized]'; | ||
|
||
test.assertExists(input, 'Search input exists'); | ||
|
||
this.waitForSelector(searchField, | ||
function pass() { | ||
casper.sendKeys(searchField, 'main', {keepFocus: true}); | ||
|
||
_this.waitForSelector(autoComplete, | ||
function pass() { | ||
this.click(autoComplete); | ||
}, | ||
function fail() { | ||
test.fail(autoComplete); | ||
} | ||
); | ||
}, | ||
function fail() { | ||
test.fail(searchField); | ||
} | ||
); | ||
|
||
}).then(function() { | ||
|
||
this.waitFor( | ||
function check() { | ||
return (this.getCurrentUrl() === url+'/docs/base/'); | ||
}, | ||
function then() { // step to execute when check() is ok | ||
test.assertExists('.source_main > h1', 'Spec header exists'); | ||
|
||
test.assertEquals(this.getCurrentUrl(), url+'/docs/base/', 'New page URL is right') | ||
}, | ||
function timeout() { // step to execute if check has failed | ||
this.echo('Failed to navigate to search result'); | ||
} | ||
); | ||
|
||
}).run(function() { test.done() }).clear(); | ||
}); |
Oops, something went wrong.