Commit eb83dddc eb83dddc032dc61d43a8ee08e44aee88c2e4864a by Nicolas Perriault

fixes #149 - fill() searches local form fields again

1 parent 7e41ae04
...@@ -4,13 +4,14 @@ CasperJS Changelog ...@@ -4,13 +4,14 @@ CasperJS Changelog
4 XXXX-XX-XX, v0.6.11 4 XXXX-XX-XX, v0.6.11
5 ------------------- 5 -------------------
6 6
7 - closed [#132](https://github.com/n1k0/casperjs/issues/132) - added ability to include js/coffee files using a dedicated option when using the `casper test` command 7 - fixed [#132](https://github.com/n1k0/casperjs/issues/132) - added ability to include js/coffee files using a dedicated option when using the [`casper test` command](http://casperjs.org/testing.html)
8 - fixed [#140](https://github.com/n1k0/casperjs/issues/140) - `casper test` now resolves local paths urls 8 - fixed [#140](https://github.com/n1k0/casperjs/issues/140) - `casper test` now resolves local paths urls
9 - fixed [#148](https://github.com/n1k0/casperjs/issues/148) - `utils.isWebPage()` was broken 9 - fixed [#148](https://github.com/n1k0/casperjs/issues/148) - [`utils.isWebPage()`](http://casperjs.org/api.html#utils.isWebPage) was broken
10 - fixed [#149](https://github.com/n1k0/casperjs/issues/149) - `ClientUtils.fill()` was searching elements globally 10 - fixed [#149](https://github.com/n1k0/casperjs/issues/149) - [`ClientUtils.fill()`](http://casperjs.org/api.html#casper.fill) was searching elements globally
11 - closed [#144](https://github.com/n1k0/casperjs/issues/144) - added a `safeLogs` option to blur password values in debug logs. **This option is set to `true` by default.** 11 - fixed [#144](https://github.com/n1k0/casperjs/issues/144) - added a [`safeLogs` option](http://casperjs.org/api.html#casper.options) to blur password values in debug logs. **This option is set to `true` by default.**
12 - added [`Casper.userAgent()`](http://casperjs.org/api.html#casper.userAgent) to ease a more dynamic setting of user-agent string 12 - added [`Casper.userAgent()`](http://casperjs.org/api.html#casper.userAgent) to ease a more dynamic setting of user-agent string
13 - added `Tester.assertTitleMatch()` method 13 - added [`Tester.assertTitleMatch()`](http://casperjs.org/api.html#tester.assertTitleMatch) method
14 - added experimental support of custom headers sending in outgoing request (refs [#137](https://github.com/n1k0/casperjs/issues/137) - PhantomJS 1.6 required)
14 - switched to more standard `.textContent` property to get a node text; this allows a better compatibility of the clientutils bookmarklet with non-webkit browsers 15 - switched to more standard `.textContent` property to get a node text; this allows a better compatibility of the clientutils bookmarklet with non-webkit browsers
15 - casper modules now all use [javascript strict mode](http://www.nczonline.net/blog/2012/03/13/its-time-to-start-using-javascript-strict-mode/) 16 - casper modules now all use [javascript strict mode](http://www.nczonline.net/blog/2012/03/13/its-time-to-start-using-javascript-strict-mode/)
16 17
......
...@@ -212,7 +212,7 @@ ...@@ -212,7 +212,7 @@
212 if (!vals.hasOwnProperty(name)) { 212 if (!vals.hasOwnProperty(name)) {
213 continue; 213 continue;
214 } 214 }
215 var field = this.findAll('[name="' + name + '"]'); 215 var field = this.findAll('[name="' + name + '"]', form);
216 var value = vals[name]; 216 var value = vals[name];
217 if (!field) { 217 if (!field) {
218 out.errors.push('no field named "' + name + '" in form'); 218 out.errors.push('no field named "' + name + '" in form');
......
...@@ -285,7 +285,7 @@ var Tester = function Tester(casper, options) { ...@@ -285,7 +285,7 @@ var Tester = function Tester(casper, options) {
285 details: "Subject didn't match the provided pattern", 285 details: "Subject didn't match the provided pattern",
286 values: { 286 values: {
287 subject: subject, 287 subject: subject,
288 pattern: pattern 288 pattern: pattern.toString()
289 } 289 }
290 }); 290 });
291 }; 291 };
...@@ -403,7 +403,7 @@ var Tester = function Tester(casper, options) { ...@@ -403,7 +403,7 @@ var Tester = function Tester(casper, options) {
403 details: "Page title does not match the provided pattern", 403 details: "Page title does not match the provided pattern",
404 values: { 404 values: {
405 subject: currentTitle, 405 subject: currentTitle,
406 pattern: pattern 406 pattern: pattern.toString()
407 } 407 }
408 }); 408 });
409 }; 409 };
...@@ -444,7 +444,7 @@ var Tester = function Tester(casper, options) { ...@@ -444,7 +444,7 @@ var Tester = function Tester(casper, options) {
444 details: "Current url did not match the provided pattern", 444 details: "Current url did not match the provided pattern",
445 values: { 445 values: {
446 currentUrl: currentUrl, 446 currentUrl: currentUrl,
447 pattern: pattern 447 pattern: pattern.toString()
448 } 448 }
449 }); 449 });
450 }; 450 };
......
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Multiple forms test</title>
5 </head>
6 <body>
7 <form name="f1">
8 <input type="hidden" name="f" value="f1">
9 <input type="text" name="yo">
10 </form>
11 <form name="f2">
12 <input type="hidden" name="f" value="f2">
13 <input type="text" name="yo">
14 </form>
15 </body>
16 </html>
...@@ -52,6 +52,18 @@ casper.then(function() { ...@@ -52,6 +52,18 @@ casper.then(function() {
52 this.test.assertUrlMatch(/topic=bar/, 'Casper.fill() select field was submitted'); 52 this.test.assertUrlMatch(/topic=bar/, 'Casper.fill() select field was submitted');
53 }); 53 });
54 54
55 // multiple forms
56 casper.thenOpen('tests/site/multiple-forms.html', function() {
57 this.test.comment('Multiple forms');
58 this.fill('form[name="f2"]', {
59 yo: "ok"
60 }, true);
61 });
62
63 casper.then(function() {
64 this.test.assertUrlMatch(/\?f=f2&yo=ok$/, 'Casper.fill() handles multiple forms');
65 }),
66
55 casper.run(function() { 67 casper.run(function() {
56 this.test.done(); 68 this.test.done();
57 }); 69 });
......