Merge pull request #3025 from BryceLTaylor/Skip-Flakey-Tests

Skip flakey tests
This commit is contained in:
Ray Schamp 2019-06-19 21:48:04 -04:00 committed by GitHub
commit 94c7bb827a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 42 additions and 19 deletions

View file

@ -6,9 +6,9 @@
"start": "make start", "start": "make start",
"stop": "make stop", "stop": "make stop",
"test": "make test", "test": "make test",
"smoke": "tap ./test/integration/smoke-testing/*.js --timeout=3600", "smoke": "tap ./test/integration/smoke-testing/*.js --timeout=3600 --no-coverage -R classic",
"smoke-verbose": "tap ./test/integration/smoke-testing/*.js --timeout=3600 -R spec", "smoke-verbose": "tap ./test/integration/smoke-testing/*.js --timeout=3600 --no-coverage -R spec",
"smoke-sauce": "SMOKE_REMOTE=true tap ./test/integration/smoke-testing/*.js --timeout=60000", "smoke-sauce": "SMOKE_REMOTE=true tap ./test/integration/smoke-testing/*.js --timeout=60000 --no-coverage -R classic",
"watch": "make watch", "watch": "make watch",
"build": "make build", "build": "make build",
"dev": "make watch && make start &", "dev": "make watch && make start &",
@ -110,7 +110,7 @@
"slick-carousel": "1.6.0", "slick-carousel": "1.6.0",
"source-map-support": "0.3.2", "source-map-support": "0.3.2",
"style-loader": "0.12.3", "style-loader": "0.12.3",
"tap": "7.1.2", "tap": "14.2.0",
"url-loader": "0.5.6", "url-loader": "0.5.6",
"watch": "0.16.0", "watch": "0.16.0",
"webpack": "2.7.0", "webpack": "2.7.0",

View file

@ -9,6 +9,8 @@ const buildID = process.env.TRAVIS_BUILD_NUMBER;
const {SAUCE_USERNAME, SAUCE_ACCESS_KEY} = process.env; const {SAUCE_USERNAME, SAUCE_ACCESS_KEY} = process.env;
const {By, Key, until} = webdriver; const {By, Key, until} = webdriver;
const DEFAULT_TIMEOUT_MILLISECONDS = 20 * 1000;
class SeleniumHelper { class SeleniumHelper {
constructor () { constructor () {
bindAll(this, [ bindAll(this, [
@ -25,7 +27,8 @@ class SeleniumHelper {
'getDriver', 'getDriver',
'getLogs', 'getLogs',
'getSauceDriver', 'getSauceDriver',
'urlMatches' 'urlMatches',
'waitUntilGone'
]); ]);
} }
buildDriver (name) { buildDriver (name) {
@ -86,8 +89,16 @@ class SeleniumHelper {
return Key[keyName]; return Key[keyName];
} }
findByXpath (xpath) { findByXpath (xpath, timeoutMessage = `findByXpath timed out for path: ${xpath}`) {
return this.driver.wait(until.elementLocated(By.xpath(xpath), 5 * 1000)); return this.driver.wait(until.elementLocated(By.xpath(xpath)), DEFAULT_TIMEOUT_MILLISECONDS, timeoutMessage)
.then(el => (
this.driver.wait(el.isDisplayed(), DEFAULT_TIMEOUT_MILLISECONDS, `${xpath} is not visible`)
.then(() => el)
));
}
waitUntilGone (element) {
return this.driver.wait(until.stalenessOf(element));
} }
clickXpath (xpath) { clickXpath (xpath) {

View file

@ -115,7 +115,7 @@ test('Add To button should bring up a list of studios', t => {
.then(() => t.end()); .then(() => t.end());
}); });
test('+ New Studio button should take you to the studio page', t => { test('+ New Studio button should take you to the studio page', {skip: true}, t => {
clickXpath('//a[contains(@class, "mystuff-icon")]') clickXpath('//a[contains(@class, "mystuff-icon")]')
.then(() => clickXpath('//form[@id="new_studio"]/button[@type="submit"]')) .then(() => clickXpath('//form[@id="new_studio"]/button[@type="submit"]'))
.then(() => findByXpath('//div[@id="show-add-project"]')) .then(() => findByXpath('//div[@id="show-add-project"]'))

View file

@ -194,8 +194,9 @@ tap.test('clickContactUsLink', options, t => {
}); });
}); });
// skip this test since it points to an external site
// SCRATCH STORE // SCRATCH STORE
tap.test('clickScratchStoreLink', options, t => { tap.test('clickScratchStoreLink', {skip: true}, t => {
const linkText = 'Scratch Store'; const linkText = 'Scratch Store';
const expectedUrl = 'https://scratch-foundation.myshopify.com/'; const expectedUrl = 'https://scratch-foundation.myshopify.com/';
clickFooterLinks(linkText).then(url => { clickFooterLinks(linkText).then(url => {
@ -204,8 +205,9 @@ tap.test('clickScratchStoreLink', options, t => {
}); });
}); });
// skip this test since it points to an external site
// DONATE // DONATE
tap.test('clickDonateLink', options, t => { tap.test('clickDonateLink', {skip: true}, t => {
const linkText = 'Donate'; const linkText = 'Donate';
const expectedUrl = 'https://secure.donationpay.org/scratchfoundation/'; const expectedUrl = 'https://secure.donationpay.org/scratchfoundation/';
clickFooterLinks(linkText).then(url => { clickFooterLinks(linkText).then(url => {
@ -248,8 +250,9 @@ tap.test('clickDMCALink', options, t => {
// ==== SCRATCH FAMILY column ==== // ==== SCRATCH FAMILY column ====
// skip this test since it points to an external site
// SCRATCH ED (SCRATCHED) // SCRATCH ED (SCRATCHED)
tap.test('clickScratchEdLink', options, t => { tap.test('clickScratchEdLink', {skip: true}, t => {
const linkText = 'ScratchEd'; const linkText = 'ScratchEd';
const expectedUrl = 'http://scratched.gse.harvard.edu/'; const expectedUrl = 'http://scratched.gse.harvard.edu/';
clickFooterLinks(linkText).then(url => { clickFooterLinks(linkText).then(url => {
@ -258,8 +261,9 @@ tap.test('clickScratchEdLink', options, t => {
}); });
}); });
// skip this test since it points to an external site
// SCRATCH JR (SCRATCHJR) // SCRATCH JR (SCRATCHJR)
tap.test('clickScratchJrLink', options, t => { tap.test('clickScratchJrLink', {skip: true}, t => {
const linkText = 'ScratchJr'; const linkText = 'ScratchJr';
const expectedUrl = 'https://www.scratchjr.org/'; const expectedUrl = 'https://www.scratchjr.org/';
clickFooterLinks(linkText).then(url => { clickFooterLinks(linkText).then(url => {
@ -268,8 +272,9 @@ tap.test('clickScratchJrLink', options, t => {
}); });
}); });
// skip this test since it points to an external site
// SCRATCH DAY // SCRATCH DAY
tap.test('clickScratchDayLink', options, t => { tap.test('clickScratchDayLink', {skip: true}, t => {
const linkText = 'Scratch Day'; const linkText = 'Scratch Day';
const expectedUrl = 'https://day.scratch.mit.edu/'; const expectedUrl = 'https://day.scratch.mit.edu/';
clickFooterLinks(linkText).then(url => { clickFooterLinks(linkText).then(url => {
@ -288,8 +293,9 @@ tap.test('clickScratchConferenceLink', options, t => {
}); });
}); });
// skip this test since it points to an external site
// SCRATCH FOUNDATION // SCRATCH FOUNDATION
tap.test('clickScratchFoundationLink', options, t => { tap.test('clickScratchFoundationLink', {skip: true}, t => {
const linkText = 'Scratch Foundation'; const linkText = 'Scratch Foundation';
const expectedUrl = 'https://www.scratchfoundation.org/'; const expectedUrl = 'https://www.scratchfoundation.org/';
clickFooterLinks(linkText).then(url => { clickFooterLinks(linkText).then(url => {

View file

@ -9,7 +9,9 @@ const driver = helper.buildDriver('www-smoke test_sign_in_out_homepage');
const { const {
clickText, clickText,
clickXpath, clickXpath,
dragFromXpathToXpath dragFromXpathToXpath,
findByXpath,
waitUntilGone
} = helper; } = helper;
const rootUrl = process.env.ROOT_URL || 'https://scratch.ly'; const rootUrl = process.env.ROOT_URL || 'https://scratch.ly';
@ -27,14 +29,17 @@ tap.beforeEach(function () {
}); });
test('Find fullscreen button', t => { test('Find fullscreen button', t => {
clickXpath('//div[starts-with(@class, "loader_background")]') findByXpath('//div[starts-with(@class, "loader_background")]')
.then(el => waitUntilGone(el))
.then(() => clickXpath('//div[starts-with(@class, "stage_green-flag-overlay")]')) .then(() => clickXpath('//div[starts-with(@class, "stage_green-flag-overlay")]'))
.then(() => clickXpath('//img[contains(@alt, "Enter full screen mode")]')) .then(() => clickXpath('//img[contains(@alt, "Enter full screen mode")]'))
.then(() => t.end()); .then(() => t.end());
}); });
test('Open and close Copy Link modal', t => { test('Open and close Copy Link modal', t => {
clickText('Copy Link') findByXpath('//div[starts-with(@class, "loader_background")]')
.then(el => waitUntilGone(el))
.then(() => clickText('Copy Link'))
.then(() => clickXpath('//div[contains(@class, "social-label-title")]')) .then(() => clickXpath('//div[contains(@class, "social-label-title")]'))
.then(() => clickXpath('//img[contains(@alt, "close-icon")]')) .then(() => clickXpath('//img[contains(@alt, "close-icon")]'))
.then(() => clickXpath('//img[contains(@alt, "Enter full screen mode")]')) .then(() => clickXpath('//img[contains(@alt, "Enter full screen mode")]'))
@ -42,7 +47,8 @@ test('Open and close Copy Link modal', t => {
}); });
test('Dragging out of modal should not close modal', t => { test('Dragging out of modal should not close modal', t => {
clickXpath('//div[starts-with(@class, "loader_background")]') findByXpath('//div[starts-with(@class, "loader_background")]')
.then(el => waitUntilGone(el))
.then(() => clickXpath('//div[starts-with(@class, "stage_green-flag-overlay")]')) .then(() => clickXpath('//div[starts-with(@class, "stage_green-flag-overlay")]'))
.then(() => clickText('Copy Link')) .then(() => clickText('Copy Link'))
.then(() => clickXpath('//div[contains(@class, "social-label-title")]')) .then(() => clickXpath('//div[contains(@class, "social-label-title")]'))

View file

@ -13,7 +13,7 @@ const tap = require('tap');
const test = tap.test; const test = tap.test;
// Set test url through environment variable // Set test url through environment variable
const rootUrl = process.env.ROOT_URL || 'http://localhost:8333'; const rootUrl = process.env.ROOT_URL || 'https://scratch.ly';
const searchBaseUrl = `${rootUrl}/search/`; const searchBaseUrl = `${rootUrl}/search/`;
// chrome driver // chrome driver