Skip to content

Commit

Permalink
add automation examples, ad update README
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdavidmills committed Oct 2, 2017
1 parent 4d25e4d commit 79b1eec
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 1 deletion.
9 changes: 8 additions & 1 deletion README.md
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 tools-testing/cross-browser-testing/automation/call_bstack.js
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 tools-testing/cross-browser-testing/automation/call_sauce.js
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);
});
}
}
});
});
});

0 comments on commit 79b1eec

Please sign in to comment.