forked from mdn/learning-area
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add automation examples, ad update README
- Loading branch information
1 parent
4d25e4d
commit 79b1eec
Showing
3 changed files
with
59 additions
and
1 deletion.
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 |
---|---|---|
@@ -1,2 +1,9 @@ | ||
# learning-area | ||
Github repo for the [MDN Learning Area](https://developer.mozilla.org/en-US/Learn). | ||
Github repo for the [MDN Learning Area](https://developer.mozilla.org/en-US/Learn). | ||
|
||
Most of the code examples shown and discussed in the Learning Area can be found here; the directories in the repo match the module structure of the articles. | ||
|
||
The one exception is the [Server-side website programming](https://developer.mozilla.org/en-US/docs/Learn/Server-side) examples — we broke these out into separate repos to make them easier to deal with: | ||
|
||
* https://github.com/mdn/express-locallibrary-tutorial | ||
* https://github.com/mdn/django-locallibrary-tutorial |
23 changes: 23 additions & 0 deletions
23
tools-testing/cross-browser-testing/automation/call_bstack.js
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,23 @@ | ||
var request = require("request"); | ||
|
||
var bsUser = "BROWSERSTACK_USERNAME"; | ||
var bsKey = "BROWSERSTACK_ACCESS_KEY"; | ||
var baseUrl = "https://" + bsUser + ":" + bsKey + "@www.browserstack.com/automate/"; | ||
|
||
function getPlanDetails(){ | ||
request({uri: baseUrl + "plan.json"}, function(err, res, body){ | ||
console.log(JSON.parse(body)); | ||
}); | ||
/* Response: | ||
{ | ||
automate_plan: <string>, | ||
parallel_sessions_running: <int>, | ||
team_parallel_sessions_max_allowed: <int>, | ||
parallel_sessions_max_allowed: <int>, | ||
queued_sessions: <int>, | ||
queued_sessions_max_allowed: <int> | ||
} | ||
*/ | ||
} | ||
|
||
getPlanDetails(); |
28 changes: 28 additions & 0 deletions
28
tools-testing/cross-browser-testing/automation/call_sauce.js
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,28 @@ | ||
var SauceLabs = require('saucelabs'); | ||
|
||
var myAccount = new SauceLabs({ | ||
username: "your-sauce-username", | ||
password: "your-sauce-api-key" | ||
}); | ||
|
||
myAccount.getAccountDetails(function (err, res) { | ||
console.log(res); | ||
myAccount.getServiceStatus(function (err, res) { | ||
// Status of the Sauce Labs services | ||
console.log(res); | ||
myAccount.getJobs(function (err, jobs) { | ||
// Get a list of all your jobs | ||
for (var k in jobs) { | ||
if ( jobs.hasOwnProperty( k )) { | ||
myAccount.showJob(jobs[k].id, function (err, res) { | ||
var str = res.id + ": Status: " + res.status; | ||
if (res.error) { | ||
str += "\033[31m Error: " + res.error + " \033[0m"; | ||
} | ||
console.log(str); | ||
}); | ||
} | ||
} | ||
}); | ||
}); | ||
}); |