Open lpinca opened 7 years ago
Sure, that would be cool. Out of curiosity, why do you say it wouldn't be backwards compatible? Presumably if it didn't find a ..
, it would just assume a single version, no?
Also, I assume this technique would need to query the Sauce Labs API to see what versions/platforms are available. Is that what zuul
does?
Well currently you have an array of arrays. The new config will be an array of objects. Maybe we can check if the first element is an array and determine how to handle the config based on this info.
Yes zuul
get all browsers from https://saucelabs.com/rest/v1/info/browsers/webdriver
, see https://github.com/defunctzombie/zuul/blob/8f8adf0ae0c4ebf196a65b92173dfcacd0c7a64b/lib/scout_browser.js.
I published sauce-browsers
. It works like this:
const browsers = [
{ name: 'firefox', version: 50, platform: 'Mac 10.9'},
{ name: 'chrome', version: ['oldest', 'latest'] },
{ name: 'safari', version: 'oldest..latest' }
];
sauceBrowsers(browsers).then((platforms) => {
platforms = browsers.map((el) => [el.os, el.api_name, el.short_version]);
// `platforms` can now be used in `easy-sauce`.
}).catch((err) => console.error(err.stack));
Support for https://github.com/ai/browserslist would be great. Tools such as https://github.com/babel/babel-preset-env use it.
@rtsao yeah I thought that but afaik there is no way to specify the OS in browserlist and it doesn't query Sauce Labs to actually know what browsers are available.
Would you be interested in adding a more flexible syntax to specify the platforms/browsers/versions? For example:
What I'm thinking is the same syntax used in
zuul
. The advantage is that you don't have to update the config if a new version of a browser is added in SauceLabs. The same applies for removed versions.Converting this syntax to the required format is easy (the code can be extracted from zuul) and can be done in a separate npm module.
The only problem I see is that it isn't backward compatible.
Thoughts?