Commit 1c4a5a49 1c4a5a49be7897ba968c4cd02ba59b9ebf38dc7f by Laurent Jouanneau

Refs #482: fixes tests formfill.js on input type=file

In gecko, value of <input type=file> is only the filename. It
does not contain this c:\fakepath\ path.
1 parent 4e49f01b
...@@ -158,6 +158,10 @@ casper.test.begin('field array', 1, function(test) { ...@@ -158,6 +158,10 @@ casper.test.begin('field array', 1, function(test) {
158 158
159 casper.test.begin('getFormValues() tests', 2, function(test) { 159 casper.test.begin('getFormValues() tests', 2, function(test) {
160 var fpath = fs.pathJoin(phantom.casperPath, 'README.md'); 160 var fpath = fs.pathJoin(phantom.casperPath, 'README.md');
161 var fileValue = 'README.md';
162 if (phantom.casperEngine === 'phantomjs') {
163 fileValue = 'C:\\fakepath\\README.md'; // phantomjs/webkit sets that;
164 }
161 165
162 casper.start('tests/site/form.html', function() { 166 casper.start('tests/site/form.html', function() {
163 this.fill('form[action="result.html"]', { 167 this.fill('form[action="result.html"]', {
...@@ -179,7 +183,7 @@ casper.test.begin('getFormValues() tests', 2, function(test) { ...@@ -179,7 +183,7 @@ casper.test.begin('getFormValues() tests', 2, function(test) {
179 "choice": "no", 183 "choice": "no",
180 "content": "Am watching thou", 184 "content": "Am watching thou",
181 "email": "chuck@norris.com", 185 "email": "chuck@norris.com",
182 "file": "C:\\fakepath\\README.md", // phantomjs/webkit sets that 186 "file": fileValue,
183 "password": "chuck", 187 "password": "chuck",
184 "submit": "submit", 188 "submit": "submit",
185 "language": "english", 189 "language": "english",
...@@ -206,7 +210,7 @@ casper.test.begin('getFormValues() tests', 2, function(test) { ...@@ -206,7 +210,7 @@ casper.test.begin('getFormValues() tests', 2, function(test) {
206 "choice": "yes", 210 "choice": "yes",
207 "content": "Am watching thou", 211 "content": "Am watching thou",
208 "email": "chuck@norris.com", 212 "email": "chuck@norris.com",
209 "file": "C:\\fakepath\\README.md", // phantomjs/webkit sets that 213 "file": fileValue,
210 "password": "chuck", 214 "password": "chuck",
211 "language": "english", 215 "language": "english",
212 "submit": "submit", 216 "submit": "submit",
......
...@@ -95,6 +95,11 @@ casper.test.begin('Tester.assertField(): filled inputs', 7, function(test) { ...@@ -95,6 +95,11 @@ casper.test.begin('Tester.assertField(): filled inputs', 7, function(test) {
95 95
96 casper.test.begin('Tester.assertField(): unfilled inputs', 7, function(test) { 96 casper.test.begin('Tester.assertField(): unfilled inputs', 7, function(test) {
97 var fpath = fs.pathJoin(phantom.casperPath, 'README.md'); 97 var fpath = fs.pathJoin(phantom.casperPath, 'README.md');
98 var fileValue = 'README.md';
99 if (phantom.casperEngine === 'phantomjs') {
100 fileValue = 'C:\\fakepath\\README.md'; // phantomjs/webkit sets that;
101 }
102
98 casper.start('tests/site/form.html', function() { 103 casper.start('tests/site/form.html', function() {
99 this.fill('form[action="result.html"]', { 104 this.fill('form[action="result.html"]', {
100 'email': 'chuck@norris.com', 105 'email': 'chuck@norris.com',
...@@ -110,7 +115,7 @@ casper.test.begin('Tester.assertField(): unfilled inputs', 7, function(test) { ...@@ -110,7 +115,7 @@ casper.test.begin('Tester.assertField(): unfilled inputs', 7, function(test) {
110 test.assertField('check', true, 'Tester.assertField() works as expected with checkboxes'); 115 test.assertField('check', true, 'Tester.assertField() works as expected with checkboxes');
111 test.assertField('choice', 'no', 'Tester.assertField() works as expected with radios'); 116 test.assertField('choice', 'no', 'Tester.assertField() works as expected with radios');
112 test.assertField('topic', 'bar', 'Tester.assertField() works as expected with selects'); 117 test.assertField('topic', 'bar', 'Tester.assertField() works as expected with selects');
113 test.assertField('file', "C:\\fakepath\\README.md", // phantomjs/webkit sets that 118 test.assertField('file', fileValue,
114 'Tester.assertField() works as expected with file inputs'); 119 'Tester.assertField() works as expected with file inputs');
115 test.assertField('checklist[]', ['1', '3'], 'Tester.assertField() works as expected with check lists'); 120 test.assertField('checklist[]', ['1', '3'], 'Tester.assertField() works as expected with check lists');
116 }).run(function() { 121 }).run(function() {
......