Skip to content

Commit

Permalink
Many changes: Diff images are now generated. Animations can be turned…
Browse files Browse the repository at this point in the history
… off. Updated README.
  • Loading branch information
James Cryer committed Feb 21, 2013
1 parent 61a2fbf commit 0accc5b
Show file tree
Hide file tree
Showing 24 changed files with 3,764 additions and 1,929 deletions.
261 changes: 261 additions & 0 deletions CasperJs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,266 @@
CasperJS Changelog
==================

2012-01-17, v1.0.1
------------------

- fixed [#336](https://github.com/n1k0/casperjs/issues/336) - Test result duration may have an exotic value
- Added `casper.mouse.doubleclick()`
- fixed [#343](https://github.com/n1k0/casperjs/issues/343) - Better script checks
- fixed an edge case with xunit export when `phantom.casperScript` may be not defined

2012-12-24, v1.0.0
------------------

### Important Changes & Caveats

- PhantomJS 1.6.x support has been dropped. Both PhantomJS [1.7](http://phantomjs.org/release-1.7.html) & [1.8](http://phantomjs.org/release-1.8.html) will be supported.
- the deprecated `injector` module has been removed from the codebase (RIP dude)
- a [`1.0` maintenance branch](https://github.com/n1k0/casperjs/tree/1.0) has been created
- CasperJS 1.1 development is now taking place on the `master` branch

### Bugfixes & enhancements

- fixed `page.initialized` event didn't get the initialized `WebPage` instance
- fixed a bug preventing `Casper.options.onPageInitialized()` from being called
- fixed [#215](https://github.com/n1k0/casperjs/issues/215) - fixed broken `--fail-fast` option creating an endless loop on error
- fixed `Tester.renderFailureDetails()` which couldn't print failure details correctly in certain circumstances
- fixed `Casper.getHTML()` wasn't retrieving active frame contents when using `Casper.withFrame()`
- fixed [#327](https://github.com/n1k0/casperjs/issues/327) - event handler for `page.confirm` always returns true
- merged PR [#322](https://github.com/n1k0/casperjs/pull/322) - Support number in `Casper.withFrame()`
- fixed [#323](https://github.com/n1k0/casperjs/issues/323) - `thenEvaluate()` should be updated to take the same parameters as `evaluate()`, while maintaining backwards compatibility.
- merged PR [#319](https://github.com/n1k0/casperjs/pull/319), fixed [#209](https://github.com/n1k0/casperjs/issues/209) - test duration has been added to XUnit XML result file.
- `Casper.userAgent()` does not require the instance to be started anymore
- dubious tests now have dedicated color & styling
- added hint printing when a possible `casperjs` command call is detected

2012-12-14, v1.0.0-RC6
----------------------

I'm still expecting a 1.0 stable for Christmas. Feedback: bring it on.

### Important Changes & Caveats

#### Added experimental support for frames

A minimal convenient API has been added to Casper in order to ease the switch of current page context:

```js
casper.start('tests/site/frames.html', function() {
this.test.assertTitle('CasperJS frameset');
});

casper.withFrame('frame1', function() {
this.test.assertTitle('CasperJS frame 1');
});

casper.then(function() {
this.test.assertTitle('CasperJS frameset');
});
```

#### Reverted to emulated mouse events

Native mouse events didn't play well with (i)frames, because the computed element coordinates of the clicked element were erroneous.

So programmatic mouse events are reintroduced back into this corrective RC until a better solution is found.

### Bugfixes & enhancements

- merged [#269](https://github.com/n1k0/casperjs/issues/269) - Windows Batch script: fixed unsupported spaces in path and argument splitting

2012-12-10, v1.0.0-RC5
----------------------

I told you there won't be an 1.0.0-RC5? I lied. Expect 1.0 stable for Christmas, probably.

### Important Changes & Caveats

#### Casper.evaluate() signature compatibility with PhantomJS

`Casper.evaluate()` method signature is now compatible with PhantomJS' one, so you can now write:

```js
casper.evaluate(function(a, b) {
return a === "foo" && b === "bar";
}, "foo", "bar"); // true
```

The old way to pass arguments has been kept backward compatible in order not to break your existing scripts though:

```js
casper.evaluate(function(a, b) {
return a === "foo" && b === "bar";
}, {a: "foo", b: "bar"}); // true
```

#### Specification of planned tests

In order to check that every planned test has actuall been executed, a new optional `planned` parameter has been added to `Tester.done()`:

```js
casper.test.assert(true);
casper.test.assert(true);
casper.test.assert(true);
casper.test.done(4);
```

Will trigger a failure:

```
fail: 4 tests planned, 3 tests executed.
```

That's especially useful in case a given test script is abruptly interrupted leaving you with no obvious way to know it and an erroneous success status.

The whole [CapserJS test suite](https://github.com/n1k0/casperjs/tree/master/tests/) has been migrated to use this new feature.

#### Experimental support for popups

PhantomJS 1.7 ships with support for new opened pages — aka popups. CasperJS can now wait for a popup to be opened and loaded to react accordingly using the new [`Casper.waitForPopup()`](http://casperjs.org/api.html#casper.waitForPopup) and [`Casper.withPopup()`](http://casperjs.org/api.html#casper.withPopup) methods:

```js
casper.start('http://foo.bar/').then(function() {
this.test.assertTitle('Main page title');
this.clickLabel('Open me a popup');
});

// this will wait for the popup to be opened and loaded
casper.waitForPopup(/popup\.html$/, function() {
this.test.assertEquals(this.popups.length, 1);
});

// this will set the popup DOM as the main active one only for time the
// step closure being executed
casper.withPopup(/popup\.html$/, function() {
this.test.assertTitle('Popup title');
});

// next step will automatically revert the current page to the initial one
casper.then(function() {
this.test.assertTitle('Main page title');
});
```

#### `Casper.mouseEvent()` now uses native events for most operations

Native mouse events from PhantomJS bring a far more accurate behavior.

Also, `Casper.mouseEvent()` will now directly trigger an error on failure instead of just logging an `error` event.

### Bugfixes & enhancements

- fixed [#308](https://github.com/n1k0/casperjs/issues/308) & [#309](https://github.com/n1k0/casperjs/issues/309) - proper module error backtraces
- fixed [#306](https://github.com/n1k0/casperjs/issues/306) - Raise an explicit error on invalid test path
- fixed [#300](https://github.com/n1k0/casperjs/issues/300) - Ensure that `findOne()` and `findAll()` observe the scope for XPath expressions, not just when passed CSS selectors
- fixed [#294](https://github.com/n1k0/casperjs/issues/294) - Automatically fail test on any runtime error or timeout
- fixed [#281](https://github.com/n1k0/casperjs/issues/281) - `Casper.evaluate()` should take an array as context not object
- fixed [#266](https://github.com/n1k0/casperjs/issues/266) - Fix `tester` module and its self tests
- fixed [#268](https://github.com/n1k0/casperjs/issues/266) - Wrong message on step timeout
- fixed [#215](https://github.com/n1k0/casperjs/issues/215) - added a `--fail-fast` option to the `casper test` command, in order to terminate a test suite execution as soon as any failure is encountered
- fixed [#274](https://github.com/n1k0/casperjs/issues/274) - some headers couldn't be set
- fixed [#277](https://github.com/n1k0/casperjs/issues/277) - multiline support in `ClientUtils.echo()`
- fixed [#282](https://github.com/n1k0/casperjs/issues/282) - added support for remote client scripts loading with a new `remoteScripts` casper option
- fixed [#290](https://github.com/n1k0/casperjs/issues/#290) - add a simplistic RPM spec file to make it easier to (un)install casperjs
- fixed [`utils.betterTypeOf()`](http://casperjs.org/api.html#casper.betterTypeOf) to properly handle `undefined` and `null` values
- fixed `Casper.die()` and `Casper.evaluateOrDie()` were not printing the error onto the console
- added JSON support to `require()`
- added [`Tester.assertTruthy()`](http://casperjs.org/api.html#tester.assertTruthy) and [`Tester.assertFalsy()`](http://casperjs.org/api.html#tester.assertFalsy)
- added [`Casper.sendKeys()`](http://casperjs.org/api.html#casper.sendKeys) to send native keyboard events to the element matching a given selector
- added [`Casper.getFormValues()`](http://casperjs.org/api.html#casper.getFormValues) to check for the field values of a given form
- added [`Tester.assertTextDoesntExist()`](http://casperjs.org/api.html#tester.assertTextDoesntExist)
- added `Tester.assertFalse()` as an alias of `Tester.assertNot()`
- added `page.resource.requested` and `page.resource.received` events
- added [`translate.js`](https://github.com/n1k0/casperjs/tree/master/samples/translate.js) and [`translate.coffee`](https://github.com/n1k0/casperjs/tree/master/samples/translate.coffee) samples

2012-10-31, v1.0.0-RC4
----------------------

Next version should be 1.0.0 stable.

- fixed [#261](https://github.com/n1k0/casperjs/issues/261) - Impossible to require CoffeeScript modules
- fixed [#262](https://github.com/n1k0/casperjs/issues/262) - Injecting clientScripts is not working
- fixed [#259](https://github.com/n1k0/casperjs/issues/259) - enhanced `Tester.assertField()` method, which can now tests for other field types than `input`s.
- fixed `Casper.getCurrentUrl()` could misbehave with encoded urls
- added [`Casper.echo()`](http://casperjs.org/api.html#clientutils.echo) to print a message to the casper console from the remote DOM environment
- added [`Casper.waitForText()`](http://casperjs.org/api.html#casper.waitForText) to wait for a given text to be present in page HTML contents
- added [`ClientUtils.getFieldValue()`](http://casperjs.org/api.html#clientutils.getFieldValue)
- Local CoffeeScript version has been upgraded to 1.4.0

2012-10-23, v1.0.0-RC3
----------------------

### Important Changes & Caveats

- the `injector` module is now deprecated, but kept for backward compatibility purpose.
- **BC BREAK**: fixes [#220](https://github.com/n1k0/casperjs/issues/220), [#237](https://github.com/n1k0/casperjs/issues/237) - added a `waitTimeout` options, removed `defaultWaitTimeout` option.
- **BC BREAK** (for the better): fixes [#249](https://github.com/n1k0/casperjs/issues/249) - default timeout functions don't `die()` anymore in tests
- **BC BREAK** (for the better): merged [#188](https://github.com/n1k0/casperjs/issues/188) - Easy access to current response object;
You can now access the current response object as the first parameter of step callbacks:

```javascript
require('casper').create().start('http://www.google.fr/', function(response) {
require('utils').dump(response);
}).run();
```

That gives:

```
$ casperjs dump-headers.js
{
"contentType": "text/html; charset=UTF-8",
"headers": [
{
"name": "Date",
"value": "Thu, 18 Oct 2012 08:17:29 GMT"
},
{
"name": "Expires",
"value": "-1"
},
// ... lots of other headers
],
"id": 1,
"redirectURL": null,
"stage": "end",
"status": 200,
"statusText": "OK",
"time": "2012-10-18T08:17:37.068Z",
"url": "http://www.google.fr/"
}
```

To fetch a particular header by its name:

```javascript
require('casper').create().start('http://www.google.fr/', function(response) {
this.echo(response.headers.get('Date'));
}).run();
```

That gives:

```javascript
$ casperjs dump-single-header.js
Thu, 18 Oct 2012 08:26:34 GMT
```

The documentation has been [updated accordingly](http://casperjs.org/api.html#casper.then.callbacks).

### Bugfixes & enhancements

- merged [#234](https://github.com/n1k0/casperjs/issues/234) - New Windows Loader written in Batch. Python is no more a requirement for using CasperJS on Windows. New installation instructions are [available](http://casperjs.org/installation.html#windows).
- a new `onWaitTimeout` option has been added, to allow defining a default behavior when a `waitFor*` function times out.
- [Casper.resourceExists()](http://casperjs.org/api.html#casper.resourceExists) and related functions now checks for non HTTP-404 received responses.
- fixed [#167](https://github.com/n1k0/casperjs/issues/167) - fixed opening truncated/uncomplete root urls may give erroneous HTTP statuses
- closes [#205](https://github.com/n1k0/casperjs/issues/205) - [`debugHTML()`](http://casperjs.org/api.html#casper.debugHTML) can have a selector passed; added [`getHTML()`](http://casperjs.org/api.html#casper.getHTML)
- closes [#230](https://github.com/n1k0/casperjs/issues/230) - added [`ClientUtils.getElementsBound()`](http://casperjs.org/api.html#clientutils.getElementsBounds) and [`Casper.getElementsBound()`](http://casperjs.org/api.html#casper.getElementsBounds)
- fixed [#235](https://github.com/n1k0/casperjs/issues/235) - updated `Casper.evaluate()` to use phantomjs >= 1.6 native one. As a consequence, **the `injector` module is marked as deprecated**.
- fixed [#250](https://github.com/n1k0/casperjs/issues/250) - prevent self tests to be run using the standard `casper test` command
- fixed [#254](https://github.com/n1k0/casperjs/issues/254) - fix up one use of qsa, hit when filling forms with missing elements
- [fixed](https://github.com/n1k0/casperjs/commit/ef6c1828c7b64e1cf99b98e27600d0b63308cad3) edge case when current document url couldn't be properly decoded

2012-10-01, v1.0.0-RC2
----------------------

Expand Down Expand Up @@ -33,6 +293,7 @@ CasperJS Changelog
- fixed [#231](https://github.com/n1k0/casperjs/pull/231) - added `--pre` and `--post` options to the `casperjs test` command to load test files before and after the execution of testsuite
- fixed [#232](https://github.com/n1k0/casperjs/issues/232) - symlink resolution in the ruby version of the `casperjs` executable
- fixed [#236](https://github.com/n1k0/casperjs/issues/236) - fixed `Casper.exit` returned `this` after calling `phantom.exit()` which may caused PhantomJS to hang
- fixed [#252](https://github.com/n1k0/casperjs/issues/252) - better form.fill() error handling
- added [`ClientUtils.getDocumentHeight()`](http://casperjs.org/api.html#clientutils.getDocumentHeight)
- added [`toString()`](http://casperjs.org/api.html#casper.toString) and [`status()`](http://casperjs.org/api.html#casper.status) methods to `Casper` prototype.

Expand Down
22 changes: 22 additions & 0 deletions CasperJs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,28 @@ Subscribe to the [project mailing-list](https://groups.google.com/forum/#!forum/

Follow the CasperJS project [on twitter](https://twitter.com/casperjs_org) and [Google+](https://plus.google.com/b/106641872690063476159/).

## Show me some code!

Sample test to see if some dropdown can be opened:

```javascript
casper.start('http://twitter.github.com/bootstrap/javascript.html#dropdowns', function() {
this.test.assertExists('#navbar-example');
this.click('#dropdowns .nav-pills .dropdown:last-of-type a.dropdown-toggle');
this.waitUntilVisible('#dropdowns .nav-pills .open', function() {
this.test.pass('Dropdown is open');
});
});

casper.run(function() {
this.test.done();
});
```

Run the script:

![](http://cl.ly/image/112m0F2n162i/Capture%20d%E2%80%99%C3%A9cran%202012-10-19%20%C3%A0%2016.37.15.png)

## Contributing

### Contributing code
Expand Down
Loading

0 comments on commit 0accc5b

Please sign in to comment.