test: fix flaky test (#2259)

This commit is contained in:
Nolan Lawson 2022-11-25 12:24:59 -08:00 committed by GitHub
parent abc39ef982
commit 098da30f2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -1,7 +1,7 @@
import {
getActiveElementTagName,
getUrl,
searchButton, searchInput, searchNavButton
searchButton, searchInput, searchNavButton, sleep
} from '../utils'
import { loginAsFoobar } from '../roles'
import { Selector as $ } from 'testcafe'
@ -40,6 +40,8 @@ test('Pressing / without logging in just goes to the search page', async t => {
await t
.expect(getUrl()).eql('http://localhost:4002/')
.expect($('.main-content h1').innerText).eql('Pinafore')
await sleep(500) // wait for keyboard shortcuts to be active
await t
.pressKey('/')
.expect(getUrl()).contains('/search')
.expect(getActiveElementTagName()).notMatch(/input/i)