From dac4d120f3f41e5c5bb08cd77858b822494c9a1f Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Tue, 10 Apr 2018 20:56:42 -0700 Subject: [PATCH] travis: try to fix flaky tests --- .travis.yml | 2 ++ bin/restore-mastodon-data.js | 1 + tests/utils.js | 7 ++++--- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3dd606ac..4b7a2161 100644 --- a/.travis.yml +++ b/.travis.yml @@ -68,3 +68,5 @@ branches: cache: directories: - $HOME/.npm + - $HOME/.rvm + - $HOME/.bundle \ No newline at end of file diff --git a/bin/restore-mastodon-data.js b/bin/restore-mastodon-data.js index 3383b9eb..f38c39b0 100644 --- a/bin/restore-mastodon-data.js +++ b/bin/restore-mastodon-data.js @@ -45,6 +45,7 @@ export async function restoreMastodonData () { let internalIdsToIds = {} for (let action of actions) { console.log(JSON.stringify(action)) + await new Promise(resolve => setTimeout(resolve, 100)) // sleep because otherwise order may not be preserved let accessToken = users[action.user].accessToken if (action.post) { diff --git a/tests/utils.js b/tests/utils.js index d628bf01..af13310c 100644 --- a/tests/utils.js +++ b/tests/utils.js @@ -48,15 +48,15 @@ export const sleep = timeout => new Promise(resolve => setTimeout(resolve, timeo export const getUrl = exec(() => window.location.href) export const getActiveElementClass = exec(() => - document.activeElement ? document.activeElement.getAttribute('class') : '' + (document.activeElement && document.activeElement.getAttribute('class')) || '' ) export const getActiveElementInnerText = exec(() => - document.activeElement && document.activeElement.innerText + (document.activeElement && document.activeElement.innerText) || '' ) export const getActiveElementAriaLabel = exec(() => - document.activeElement ? document.activeElement.getAttribute('aria-label') : '' + (document.activeElement && document.activeElement.getAttribute('aria-label')) || '' ) export const getActiveElementInsideNthStatus = exec(() => { @@ -67,6 +67,7 @@ export const getActiveElementInsideNthStatus = exec(() => { } element = element.parentElement } + return '' }) export const goBack = exec(() => window.history.back())