Skip to content
Snippets Groups Projects
Unverified Commit 9becb7f7 authored by Paul Kaplan's avatar Paul Kaplan Committed by GitHub
Browse files

Merge pull request #2233 from paulkaplan/sauce-smoke-test

Add IE11 and Safari 9/10 tests to browser smoke test using Sauce
parents 6d167219 bcb32eda
No related branches found
No related tags found
Loading
......@@ -13,6 +13,7 @@
"test:integration": "jest --runInBand test[\\\\/]integration",
"test:lint": "eslint . --ext .js,.jsx",
"test:unit": "jest test[\\\\/]unit",
"test:smoke": "jest --runInBand test[\\\\/]smoke",
"watch": "webpack --progress --colors --watch"
},
"author": "Massachusetts Institute of Technology",
......
......@@ -17,6 +17,7 @@ class SeleniumHelper {
'findByText',
'findByXpath',
'getDriver',
'getSauceDriver',
'getLogs',
'loadUri',
'rightClickText'
......@@ -50,6 +51,21 @@ class SeleniumHelper {
return this.driver;
}
getSauceDriver (username, accessKey, configs) {
this.driver = new webdriver.Builder()
.withCapabilities({
browserName: configs.browserName,
platform: configs.platform,
version: configs.version,
username: username,
accessKey: accessKey
})
.usingServer(`http://${username}:${accessKey
}@ondemand.saucelabs.com:80/wd/hub`)
.build();
return this.driver;
}
findByXpath (xpath) {
return this.driver.wait(until.elementLocated(By.xpath(xpath), 5 * 1000));
}
......
import SeleniumHelper from '../helpers/selenium-helper';
const {SAUCE_USERNAME, SAUCE_ACCESS_KEY, SMOKE_URL} = process.env;
const {
getSauceDriver,
findByText
} = new SeleniumHelper();
// Make the default timeout longer, Sauce tests take ~30s
jasmine.DEFAULT_TIMEOUT_INTERVAL = 60 * 1000; // eslint-disable-line
const SUPPORTED_MESSAGE = 'Welcome to the Scratch 3.0 Preview';
const UNSUPPORTED_MESSAGE = 'Scratch 3.0 does not support Internet Explorer';
// Driver configs can be generated with the Sauce Platform Configurator
// https://wiki.saucelabs.com/display/DOCS/Platform+Configurator
describe('Smoke tests on older browsers', () => {
let driver;
afterEach(async () => await (driver && driver.quit()));
test('Credentials should be provided', () => {
expect(SAUCE_USERNAME && SAUCE_ACCESS_KEY && SMOKE_URL).toBeTruthy();
});
test('IE 11 should be unsupported', async () => {
const driverConfig = {
browserName: 'internet explorer',
platform: 'Windows 10',
version: '11.103'
};
driver = await getSauceDriver(
process.env.SAUCE_USERNAME,
process.env.SAUCE_ACCESS_KEY,
driverConfig);
await driver.get(process.env.SMOKE_URL);
const el = await findByText(UNSUPPORTED_MESSAGE);
const isDisplayed = await el.isDisplayed();
return expect(isDisplayed).toEqual(true);
});
// Safari 9 has always been blank screened due to lack of Intl polyfill
test.skip('Safari 9 should not be unsupported', async () => {
const driverConfig = {
browserName: 'safari',
platform: 'OS X 10.11',
version: '9.0'
};
driver = await getSauceDriver(
process.env.SAUCE_USERNAME,
process.env.SAUCE_ACCESS_KEY,
driverConfig);
await driver.get(process.env.SMOKE_URL);
const el = await findByText(SUPPORTED_MESSAGE);
const isDisplayed = await el.isDisplayed();
return expect(isDisplayed).toEqual(true);
});
test('Safari 10 should not be unsupported', async () => {
const driverConfig = {
browserName: 'safari',
platform: 'OS X 10.11',
version: '10.0'
};
driver = await getSauceDriver(
process.env.SAUCE_USERNAME,
process.env.SAUCE_ACCESS_KEY,
driverConfig);
await driver.get(process.env.SMOKE_URL);
const el = await findByText(SUPPORTED_MESSAGE);
const isDisplayed = await el.isDisplayed();
return expect(isDisplayed).toEqual(true);
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment