laurentj/slimerjs — pull request #10 by matthewkastor (2013-02-06 22:24:23+00:00)
Title: Show test results

I've created a new branch which uses the batch file with `help` options.

This branch addresses the issue of not being able to see the test results. I've commented out calls to the exit function in the tests so that the results will stay on screen.

I also created a batch file to run the tests easily. It is in the bin directory with `slimerjs` and `slimerjs.bat` it is used like this: `run_test.bat initial-tests.js`

`run_test.bat` should show that if the environment variable `SLIMERJSLAUNCHER` is not set or is set to a non existing path then `slimerjs.bat` will attempt to find Firefox.

Here are the results of running initial-tests.js on Windows 7 x64

## initial-tests.js Results
```
Initial tests
has window object? OK
has document object? OK
has window.document object? OK
has console object? OK
has alert object? OK
has alert object? OK
Message console should be "log ok":
log ok
has phantom object? OK
has slimer object? OK
has slimer.version object? OK
slimer has the good major version OK
slimer has the good minor version OK
slimer has the good patch version OK
phantom has the good major version OK
phantom has the good minor version OK
phantom has the good patch version OK
there is a require object OK
require is a function OK
there is a module property OK
module uri OK
module id OK
is 'ex' defined? OK
value of ex.myExample OK
value of ex.myCalcFunc(2) OK
value of m.identity.firstName OK
value of ex.myExample inside injectslimer.js OK
value of injectedValue OK
value of newinjectedvalue OK

------ check yourself if following values are ok
os.architecture=64bit
os.name=winnt
os.version=6.1
--- Environment variable:
HOME=
LOGNAME=
--- Command line arguments:
0: C:\Users\kastor\Documents\GitHub\slimerjs\bin\..\test\initial-tests.js

------ test webserver

------ tests on onerror support
message of the exception OK
length of the stack OK
filename is requiredexample.js OK
line in requiredexample.js OK
filename is initial-tests.js OK
line in initial-tests.js -----> FAIL!!! given result: 141

------ tests on webpage:
Webpage loaded OK
browser should have the right url OK
retrieve title page OK

------------------- END of tests
```
## main-tests.js Results
The slimer window reports:
># 500 Internal Server Error

>_Something's broken in this server and needs to be fixed._

The console has broken markup for colorizing the results. I can't really read it.

```
Started

#0 web objects: should have a window object
←[32mPASS←[0m
#1 web objects: should have a document object
←[32mPASS←[0m
#2 web objects: should have a window.document object
←[32mPASS←[0m
#3 web objects: should have a console object
←[32mPASS←[0m
#4 web objects: should have a alert object
←[32mPASS←[0m
#5 web objects: should have a confirm object
←[32mPASS←[0m
#6 phantom object: should exists
←[32mPASS←[0m
#7 phantom object: should have a right version
←[32mPASS←[0m
#8 slimer object: should exists
←[32mPASS←[0m
#9 slimer object: should have a right version
←[32mPASS←[0m
#10 CommonJS module: should have a require function
←[32mPASS←[0m
#11 CommonJS module: should have a module object
←[32mPASS←[0m
#12 require function: should import exported variable of requiredexample module
←[32mPASS←[0m
#13 require function: should import exported variable of a/b module
←[32mPASS←[0m
#14 system module: should be in a system object
←[32mPASS←[0m
#15 system module: should have a platform property
←[32mPASS←[0m
#16 system module: should have a pid property
←[32mPASS←[0m
#17 system module: should have a os object
←[32mPASS←[0m
#18 system module: should handle command line arguments
←[32mPASS←[0m
#19 WebPage object on hello world: should be opened
←[32mPASS←[0m
#20 WebPage object on hello world: should have right url
←[32mPASS←[0m
#21 WebPage object on hello world: should be able to evaluate code
←[32mPASS←[0m
#22 WebPage object on hello world: should be able to be closed
←[32mPASS←[0m
←[31m#23 webpage with listeners: should be opened←[0m
←[31mFAIL←[0m
←[31m#24 webpage with listeners: should generate the expected trace←[0m
←[31mFAIL←[0m
←[31m#25 webpage with listeners: should have a expected request objects←[0m
←[31mFAIL←[0m

webpage with listeners should be opened
jasmine.ExpectationResult@file:///C:/Users/kastor/Documents/GitHub/slimerjs/te
st/jasmine/jasmine.js:114 jasmine.Matchers.matcherFn_/<@file:///C:/Users/kastor
/Documents/GitHub/slimerjs/test/jasmine/jasmine.js:1240
@file:///C:/Users/kastor/Documents/GitHub/slimerjs/test/test-webpage-listeners
.js:91
webpage.open/