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) {
casper.test.begin('getFormValues() tests', 2, function(test) {
var fpath = fs.pathJoin(phantom.casperPath, 'README.md');
var fileValue = 'README.md';
if (phantom.casperEngine === 'phantomjs') {
fileValue = 'C:\\fakepath\\README.md'; // phantomjs/webkit sets that;
}
casper.start('tests/site/form.html', function() {
this.fill('form[action="result.html"]', {
......@@ -179,7 +183,7 @@ casper.test.begin('getFormValues() tests', 2, function(test) {
"choice": "no",
"content": "Am watching thou",
"email": "chuck@norris.com",
"file": "C:\\fakepath\\README.md", // phantomjs/webkit sets that
"file": fileValue,
"password": "chuck",
"submit": "submit",
"language": "english",
......@@ -206,7 +210,7 @@ casper.test.begin('getFormValues() tests', 2, function(test) {
"choice": "yes",
"content": "Am watching thou",
"email": "chuck@norris.com",
"file": "C:\\fakepath\\README.md", // phantomjs/webkit sets that
"file": fileValue,
"password": "chuck",
"language": "english",
"submit": "submit",
......
......@@ -95,6 +95,11 @@ casper.test.begin('Tester.assertField(): filled inputs', 7, function(test) {
casper.test.begin('Tester.assertField(): unfilled inputs', 7, function(test) {
var fpath = fs.pathJoin(phantom.casperPath, 'README.md');
var fileValue = 'README.md';
if (phantom.casperEngine === 'phantomjs') {
fileValue = 'C:\\fakepath\\README.md'; // phantomjs/webkit sets that;
}
casper.start('tests/site/form.html', function() {
this.fill('form[action="result.html"]', {
'email': 'chuck@norris.com',
......@@ -110,7 +115,7 @@ casper.test.begin('Tester.assertField(): unfilled inputs', 7, function(test) {
test.assertField('check', true, 'Tester.assertField() works as expected with checkboxes');
test.assertField('choice', 'no', 'Tester.assertField() works as expected with radios');
test.assertField('topic', 'bar', 'Tester.assertField() works as expected with selects');
test.assertField('file', "C:\\fakepath\\README.md", // phantomjs/webkit sets that
test.assertField('file', fileValue,
'Tester.assertField() works as expected with file inputs');
test.assertField('checklist[]', ['1', '3'], 'Tester.assertField() works as expected with check lists');
}).run(function() {
......