Skip to content
This repository has been archived by the owner on Oct 10, 2021. It is now read-only.

Need to update saucelabs job info after test otherwise saucelabs won't work #288

Open
dzcpy opened this issue Jun 12, 2016 · 1 comment
Open

Comments

@dzcpy
Copy link

dzcpy commented Jun 12, 2016

Currently if we use zuul + saucelabs to test, regardless if all tests pass or not, saucelabs always show an unknown barge.

See this project to prove:
https://github.com/algolia/faux-jax

After tried many time, I have found the reason. Here is the reason from saucelabs' documentation:

All you have to do is add either markdown or HTML code to your GitHub README or project site that references your Sauce Labs username and access key, and annotate your tests with the REST or WebDriver API.

What we need here is to use saucelabs api to update the job with an 'passed' field to indicate whether the test has passed on client site and it must be updated explicitly during a separate API call.
And here is how karma-runner module did it:

@dzcpy dzcpy changed the title Update saucelabs job info with annotation after test ( for makeing saucelabs badge work) Need to update saucelabs job info after test otherwise saucelabs won't work Jun 12, 2016
@dzcpy
Copy link
Author

dzcpy commented Jun 12, 2016

Here is an example code on how to update it on my own:

#!/usr/bin/env node
const Promise = require('bluebird');
const jsome = require('jsome');
const axios = require('axios');
const SauceLabs = require('saucelabs');

const cred = {
  username: process.env.SAUCE_USERNAME,
  password: process.env.SAUCE_ACCESS_KEY
};

const sauce = Promise.promisifyAll(
  new SauceLabs(cred)
);

sauce
  .getJobsAsync()
  .then(result => {
    result = result.map(item => item.id);
    return Promise.map(result, id => {
      return sauce.updateJobAsync(id, {passed:true, name:'transliteration browser test', public: 'public', build: 1, 'tags':[]})
    }, { concurrency: 10 })
    .then(result => {
      jsome(result);
    });
  });

@dzcpy dzcpy mentioned this issue Jun 12, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant