I have a project that has Protractor tests which are executed by TravisCI via SauceLabs.
One of the tests involve "uploading" a file:
it('should not allow "image/jpeg" file', function () {
pathToFile = path.resolve(__dirname, 'file.jpg');
elem.sendKeys(pathToFile);
expect(elem.getAttribute('class')).toMatch('ng-invalid');
});
This works fine locally, however Travis produces an error:
. . . ./file.jpg' does not exist on the file system
I think this is because file.png
doesn't exist on SauceLabs.
My question is, how can I get this to work?
The directive in question is this one: https://github.com/GrumpyWizards/ngValidation/blob/master/wizValidation/src/file/file.dir.js