Skip to end of metadata
Go to start of metadata
As part of our efforts around to help our customers understand the root cause of test failure as well increase test coverage, we are rolling 2 custom WebDriver commands 3 new log types.  

New commands - sauce:throttle,  sauce:intercept 
New log types - sauce:network, sauce:metrics, sauce:timing
 
These new tools are extensions of what we can do with Extended Debugging on top of extracting HAR Files and JS Console logs and would allow our customers to expand on the test cases that are not accessible via standard Selenium WebDriver calls. The commands are meant to expose the built-in browser features to that they can be used in the context of automated testing.
You can find out more information by following the link below  


1) Network Emulation Command 
Command -  sauce:throttle
Goal: Allow customers to test the application under various network conditions

 

client
    .init()
    .execute('sauce:throttle', {
        condition: 'GPRS'
        /**
 * other predefined conditions are
 * offline, GPRS, Regular 2G, Good 2G, Regular 3G, Good 3G, Regular 4G, DSL, Wifi
 */
    })
    .end().catch(console.error)

 

 

2) Mock API Responses & Redirect 
Command -  sauce:intercept
  
Goal: Allow customers to either redirect requests to a different place or mock up api response and eliminate the need to wait for the API to load.

Mock Up Example

.execute('sauce:intercept', {
        response: {
            headers: {
                'x-custom-header': 'foobar'
            },
            body: [{
                title: 'Hello',
                order: 1,
                completed: false,
            }, {
                title: 'Slav',
                order: 1,
                completed: false,
            }, {
                title: 'what\'s',
                order: 1,
                completed: false,
            }, {
                title: 'up?',
                order: 1,
                completed: false,
            }]
        }
    })

 Redirect  Example  

client
    .init()
    .url('https://saucecon.com/')
    .pause(2000)
    .execute('sauce:intercept', {
        url: 'https://saucecon.com/wp-content/uploads/2017/07/SauceCon-hero-img-100-2.jpg',
        redirect: 'http://www.readersdigest.ca/wp-content/uploads/2011/01/4-ways-cheer-up-depressed-cat.jpg'
    })
    .url('https://saucecon.com/')
    .pause(3000)
    .end().catch(console.error)

 


Please let us know if you have any questions by reaching out to help@saucelabs.com . 

Return to the Product Announcements and Release Notes Blog