This repository has been archived by the owner on Dec 30, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed the test app. Fixed test pass/fail update. (Was reporting pass for everything.) Added sauce-utils to handle app upload. Added desired caps to handle app uploads. added test apps to the repo.
- Loading branch information
Showing
10 changed files
with
185 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
### Node template | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directory | ||
# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git | ||
node_modules | ||
|
||
# Created by .ignore support plugin (hsz.mobi) | ||
.idea/ | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,13 @@ | ||
var makeSuite = require('./helpers').makeSuite; | ||
|
||
makeSuite('Test Suite 2', function() { | ||
makeSuite('Test Suite Email', function() { | ||
|
||
it('should compute different sum', function() { | ||
driver | ||
.elementByAccessibilityId('TextField1') | ||
.sendKeys(13) | ||
.elementByClassName('UIATextField') | ||
.sendKeys(8) | ||
.elementByAccessibilityId('ComputeSumButton') | ||
.click() | ||
.elementByClassName('UIAStaticText') | ||
.should.eventually.equal(21); | ||
it('enter and read email back correctly', function() { | ||
return driver | ||
.elementById('fbemail') | ||
.sendKeys('[email protected]') | ||
.elementById('fbemail') | ||
.getValue().should.eventually.equal('[email protected]'); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
var makeSuite = require('./helpers').makeSuite; | ||
|
||
makeSuite('Test Suite 1', function() { | ||
makeSuite('Test Suite Comments', function() { | ||
|
||
it('should compute a sum', function() { | ||
driver | ||
.elementByAccessibilityId('TextField1') | ||
.sendKeys(12) | ||
.elementByClassName('UIATextField') | ||
.sendKeys(8) | ||
.elementByAccessibilityId('ComputeSumButton') | ||
.click() | ||
.elementByClassName('UIAStaticText') | ||
.should.eventually.equal(20); | ||
}); | ||
it('enter comments, submit and read back correctly', function() { | ||
return driver | ||
.elementById('comments') | ||
.sendKeys('I am a comment!') | ||
.elementById('H1Text') | ||
.click() | ||
.elementById('submit') | ||
.click() | ||
.elementById('comments') | ||
.getValue().should.eventually.equal(''); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
var request = require("request"); | ||
var util = require("util"); | ||
var fs = require("fs"); | ||
var crypto = require('crypto'); | ||
|
||
function getMD5(file) { | ||
return new Promise( function(resolve, reject) { | ||
try{ | ||
var hash = crypto.createHash('md5'); | ||
var stream = fs.createReadStream(file); | ||
stream.on('data', function(data){ | ||
hash.update(data, 'utf8') | ||
}); | ||
|
||
stream.on('end', function() { | ||
resolve(hash.digest('hex')); | ||
}); | ||
} catch (e) { | ||
reject(e); | ||
} | ||
}); | ||
} | ||
|
||
function getFilename(path) { | ||
return new Promise( function(resolve, reject) { | ||
try{ | ||
resolve(path.replace(/^.*[\\\/]/, '')); | ||
} catch (e) { | ||
console.error(e); | ||
reject(e); | ||
} | ||
}); | ||
} | ||
|
||
function uploadToSS(file) { | ||
return new Promise( function(resolve, reject) { | ||
try{ | ||
|
||
getFilename(file) | ||
.then( function(fileName) { | ||
var uriTemplate = "https://saucelabs.com/rest/v1/storage/%s/%s?overwrite=true"; | ||
var uri = util.format(uriTemplate, process.env.SAUCE_USERNAME, fileName) | ||
//console.log(uri); | ||
fs.createReadStream(file).pipe(request.post({ | ||
url: uri, | ||
auth: { | ||
user: process.env.SAUCE_USERNAME, | ||
pass: process.env.SAUCE_ACCESS_KEY, | ||
}, | ||
}, | ||
function (error, response, body) { | ||
if (error) { | ||
console.error("Upload failed:", error); | ||
resolve(error); | ||
} else { | ||
//console.log("Upload successful! Server responded with:", body); | ||
resolve(JSON.parse(body)["md5"]); | ||
} | ||
})); | ||
}); | ||
} catch (e) { | ||
reject(e); | ||
} | ||
}); | ||
} | ||
|
||
|
||
function uploadFileToSauceStorage(file){ | ||
return new Promise(function(resolve, reject) { | ||
try{ | ||
uploadToSS(file).then( function(md5) { | ||
getMD5(file).then( function(localMd5) { | ||
if (localMd5 === md5){ | ||
//console.log("Upload confirmed!"); | ||
resolve(true); | ||
} else { | ||
console.error("Checksum failed!"); | ||
resolve(false); | ||
} | ||
}); | ||
}); | ||
} catch (e){ | ||
console.error(e); | ||
reject(e); | ||
} | ||
}); | ||
} | ||
|
||
exports.uploadFileToSauceStorage = uploadFileToSauceStorage; |