-
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,9 +26,9 @@ To set-up a new engine instance chose the first option `Init SourceJS in this fo | |
To install SourceJS as a NPM package, first clone clean `user` configuration folder and then execute `npm install`. | ||
|
||
```html | ||
git clone https://github.com/sourcejs/init.git my-sourcejs && cd my-sourcejs | ||
git clone https://github.com/sourcejs/init.git -b npm my-sourcejs && cd my-sourcejs | ||
npm install sourcejs --save | ||
node ./node_modules/sourcejs/app | ||
npm start | ||
``` | ||
|
||
Starting from 0.6.0 we're planning to change official install path to one with NPM packages. Yeoman generator will be also replaced by [sourcejs-cli](https://github.com/sourcejs/sourcejs-cli) with commands like `run`, `install` (plugin), `init`, `create`. | ||
|
@@ -37,40 +37,40 @@ Starting from 0.6.0 we're planning to change official install path to one with N | |
|
||
If you're running Windows and have some issues with [JSDom](https://github.com/tmpvar/jsdom) dependencies compilation, please check this [topic](https://github.com/sourcejs/Source/issues/23). | ||
|
||
Alternatively with 0.5.4 we prepared a special build without JSDom, until it's full removal from core at 0.6.0. | ||
Alternatively with 0.5.5 we prepared a special build without JSDom, until it's full removal from core at 0.6.0. | ||
|
||
```html | ||
npm install -g yo generator-sourcejs | ||
mkdir sourcejs && cd sourcejs | ||
yo sourcejs --branch 0.5.4-no-jsdom | ||
yo sourcejs --branch 0.5.5-no-jsdom | ||
``` | ||
|
||
Please note that Clarify feature is not available in `no-jsdom` version. If you had generator installed before, run `npm update -g generator-sourcejs` (v.0.4.2+ required). | ||
|
||
And installing same build from NPM: | ||
|
||
```html | ||
git clone https://github.com/sourcejs/init.git my-sourcejs && cd my-sourcejs | ||
npm install [email protected].4-no-jsdom --save | ||
node .\node_modules\sourcejs\app | ||
git clone https://github.com/sourcejs/init.git -b npm my-sourcejs && cd my-sourcejs | ||
npm install [email protected].5-no-jsdom --save | ||
npm start | ||
``` | ||
|
||
## Commands | ||
|
||
### Run | ||
|
||
Installation wizard will offer to start SourceJS right after initialization. To run it manually, trigger this command in newly created folder: | ||
Installation wizard will offer to start SourceJS right after initialization. To run it manually, trigger this command in newly created folder with SourceJS app: | ||
|
||
```html | ||
node app | ||
npm start | ||
``` | ||
|
||
To set an alternative server port, pass `-p 8081` option. | ||
To set an alternative server port, pass `-- -p 8081` option. | ||
|
||
Other configuration arguments are described in the help section: | ||
|
||
```html | ||
node app -h | ||
npm start -- -h | ||
``` | ||
|
||
### Build | ||
|
@@ -88,7 +88,7 @@ It will trigger `npm i` and `grunt default` commands for updating dependencies a | |
For updating SourceJS to a newer version, just pull the latest changes and trigger build: | ||
|
||
```html | ||
git pull && npm install | ||
git pull && npm run build | ||
``` | ||
|
||
## Creating First Spec | ||
|
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.