-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
small restructure of roots.watch and tests
- integration tests through selenium and phantomjs/chrome - watch command now returns a promise
- Loading branch information
Jeff Escalante
committed
May 27, 2014
1 parent
2da59be
commit 29c282e
Showing
13 changed files
with
117 additions
and
99 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
node_modules | ||
docs/_build | ||
.*.sw* | ||
phantomjsdriver.log |
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,44 @@ | ||
Driver = require 'selenium-webdriver' | ||
chaidriver = require 'chai-webdriver' | ||
CLI = require '../lib/cli' | ||
fs = require 'fs' | ||
|
||
cli = new CLI(debug: true) | ||
driver = new Driver.Builder().withCapabilities(Driver.Capabilities.phantomjs()).build() | ||
chai.use(chaidriver(driver)) | ||
basic_path = path.join(base_path, 'compile/basic') | ||
|
||
describe 'browser', -> | ||
|
||
it 'should compile and serve the site on watch', (done) -> | ||
cli.run("watch #{basic_path} --no-open").then (res) -> | ||
driver.get('http://localhost:1111') | ||
.then -> chai.expect('p').dom.to.have.text('hello worlds') | ||
.then -> | ||
sentinel = 0 | ||
deferred = W.defer() | ||
|
||
res.project.once 'start', -> | ||
sentinel++ | ||
# this happens too fast for selenium to reliably handle | ||
# chai.expect('#roots-compile-loader').dom.to.be.visible() | ||
|
||
res.project.once 'done', -> | ||
setTimeout -> | ||
chai.expect('p').dom.to.have.text('wow') | ||
sentinel.should.equal(1) | ||
fs.writeFileSync(path.join(basic_path, 'index.jade'), 'html\n body\n p= #$%#$T') | ||
, 500 | ||
|
||
res.project.once 'error', -> | ||
setTimeout -> | ||
chai.expect('#roots-error').dom.to.be.visible() | ||
fs.writeFileSync(path.join(basic_path, 'index.jade'), 'html\n body\n p hello worlds') | ||
deferred.resolve() | ||
, 500 | ||
|
||
fs.writeFileSync(path.join(basic_path, 'index.jade'), 'html\n body\n p wow') | ||
|
||
return deferred.promise | ||
.then -> res.server.close() | ||
.then -> done() |
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 |
---|---|---|
@@ -1,6 +1,3 @@ | ||
doctype html | ||
html | ||
head | ||
title testing | ||
body | ||
p hello worlds |
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