From 456c865a0939d686906fbe98c400ff85291e2513 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Sun, 4 Mar 2018 12:46:46 -0800 Subject: [PATCH] make tests less flaky --- tests/spec/02-login-spec.js | 4 +++- tests/spec/03-basic-timeline-spec.js | 3 ++- tests/utils.js | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/spec/02-login-spec.js b/tests/spec/02-login-spec.js index 78c84b2..9b2113d 100644 --- a/tests/spec/02-login-spec.js +++ b/tests/spec/02-login-spec.js @@ -1,6 +1,6 @@ import { Selector as $ } from 'testcafe' import { - authorizeInput, emailInput, formError, getUrl, instanceInput, passwordInput, + authorizeInput, emailInput, formError, getFirstVisibleStatus, getUrl, instanceInput, passwordInput, settingsButton } from '../utils' @@ -37,6 +37,8 @@ test('Cannot log in to a fake instance', async t => { test('Logs in and logs out of localhost:3000', async t => { await manualLogin(t, 'foobar@localhost:3000', 'foobarfoobar') + .expect(getUrl()).eql('http://localhost:4002/') + .hover(getFirstVisibleStatus()) .expect($('article.status-article').exists).ok() .click(settingsButton) .click($('a').withText('Instances')) diff --git a/tests/spec/03-basic-timeline-spec.js b/tests/spec/03-basic-timeline-spec.js index c4bc9d8..c525df2 100644 --- a/tests/spec/03-basic-timeline-spec.js +++ b/tests/spec/03-basic-timeline-spec.js @@ -1,5 +1,5 @@ import { Selector as $ } from 'testcafe' -import { getFirstVisibleStatus, getUrl, validateTimeline } from '../utils' +import { getFirstVisibleStatus, getNthStatus, getUrl, validateTimeline } from '../utils' import { homeTimeline, notifications, localTimeline, favorites } from '../fixtures' import { foobarRole } from '../roles' @@ -8,6 +8,7 @@ fixture`03-basic-timeline-spec.js` test('Shows the home timeline', async t => { await t.useRole(foobarRole) + .hover(getNthStatus(0)) .expect(getFirstVisibleStatus().exists).ok() .expect(getFirstVisibleStatus().hasAttribute('aria-setsize')).ok() .expect(getFirstVisibleStatus().getAttribute('aria-posinset')).eql('0') diff --git a/tests/utils.js b/tests/utils.js index 1a7797d..63ae160 100644 --- a/tests/utils.js +++ b/tests/utils.js @@ -2,7 +2,7 @@ import { ClientFunction as exec, Selector as $ } from 'testcafe' import * as images from './images' import * as blobUtils from './blobUtils' -const SCROLL_INTERVAL = 3 +const SCROLL_INTERVAL = 2 export const settingsButton = $('nav a[aria-label=Settings]') export const instanceInput = $('#instanceInput')