Giter Club home page Giter Club logo

sauceclient's Introduction

sauceclient

Python client library for Sauce Labs API.

image

Info

About sauceclient

sauceclient is a Python client library for Sauce Labs API. You can manage a Selenium test environment and retrieve test assets from Sauce.

The API gives remote access to:

  • Test Jobs & Assets (Results, Logs, Videos, Screenshots)
  • Account
  • Platform Information
  • JavaScript Unit Tests
  • Temporary Storage
  • Tunnels

Note: sauceclient is not used for running tests on Sauce Labs' services. Test execution is handled by Selenium WebDriver.

About Sauce Labs

Sauce Labs is a service for running remote Selenium WebDriver tests. It has VM's with 800+ browser/OS combinations, allowing comprehensive cross-browser cross-platform test coverage.

Install

  • with `pip`:

    pip install sauceclient

Example Usage

  • public access:

    import sauceclient
    
    sc = sauceclient.SauceClient()
    status = sc.information.get_status()
  • with authorization:

    import sauceclient
    
    sc = sauceclient.SauceClient(
        'sauce-username',
        'sauce-access-key',
    )
    jobs = sc.jobs.get_jobs(full=True, limit=5)

Compatibility Note

Due to changes in the SauceLabs REST API, some of sauceclient's classes and methods have been changed or renamed since the pre-1.0 release.

sauceclient's People

Contributors

0x1mason avatar cgoldberg avatar cpintea avatar dancio avatar enriquegh avatar mcgallaspy avatar saluk avatar tomatohater avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

sauceclient's Issues

New SauceLabs EU Data Center

Hi there,
A few days back SauceLabs have inaugurated their new EU Data Centre in Frankfurt. In order to switch to it there are some changes that need to be performed within the sauceclient.py file like:

self.apibase = apibase or 'eu-central-1.saucelabs.com'

and

def get_job_asset_url(self, job_id, filename):
"""Get details about the static assets collected for a specific job."""
return 'https://eu-central-1.saucelabs.com/rest/v1/{}/jobs/{}/assets/{}'.format(
self.client.sauce_username, job_id, filename)

I didn't have push access to propose the update as part of a new branch / pull request thus raised it as an issue!

Please have a look at this page for the new details provided by SauceLabs here

Regards,
Ray

Install uploaded apk

What's path of uploaded file?
I uploaded a second apk and i need install this app while my test is runing. how i can get the path to install it?

Proxies support for SauceClient for Python

Recently Sauce Labs and I figured that the sauceclient for python does not seem to support proxies out of the box. I am trying to run my test scripts using Behave and Python from a web server. The test start on Sauce however they do not complete properly, preventing the sauce jobs update to send pass/fail information or custom data to Sauce for the job. The tests display as Complete, but not identified as passed or failed.

Full API support?

Hey @cgoldberg,

I made some big updates to my branch of sauceclient:
https://github.com/tomatohater/sauceclient/tree/support-for-full-api

it now supports the full Sauce API set. All the tests are mocked, so they run without actually hitting Sauce. Tests have 100% coverage.

TravisCI is wired up and passing:
https://travis-ci.org/tomatohater/sauceclient

A few things... I added requests and six as dependencies... just easier. Also, and more importantly, there are a few (not not many) backwards incompatible changes. There are still a few more things I'm cleaning up (some docs and utility functions).

I'd love to get your feedback before I submit a big pull request.

SauceClient.request raises base Exception

Which is not recommended, because it means that if I want to catch the exception I have to inspect the error message. Can you please create a new class derived from Exception and raise that instead? Examples of why I might wish to catch the exception

import sauceclient as sc
sauce = sc.SauceClient("mycoolusername", "myawesomeaccesskey")

# Run my tests
# ...

sauce.jobs.update_job("mysessionid", passed=True)
# Raises:
# Exception: 404: Not Found. Sauce Status NOT OK

What I would like:

try:
    sauce.jobs.update_job("myjobid", passed=True)
except SauceException as e:
    # Try again, or otherwise try to handle based on the status code
    if e.status == 404:
        # handle it
    else:
        raise

Ability to download asset objects

Hello! Wanted to run something by the maintainers before doing any work on this.
Currently, there are the get_job_assets and get_job_asset_url methods that get a list of available assets and get you the correct asset URL respectively.
There is, however, no way to actually download the file (screenshot, log file, har file, etc) to your machine.

This is something that could be done pretty easily. It would involve either refactoring the request method or creating a separate request method for this since we would get the content itself and save it.

Is this something that would be welcome as a PR?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.