Commit 9179a84f authored by Jure's avatar Jure

Merge branch 'wait-for-h2' into 'master'

Fix integration test

See merge request !9
parents e2fdecc7 0ab79095
Pipeline #2478 failed with stage
in 1 minute and 53 seconds
......@@ -3,5 +3,12 @@ const path = require('path')
module.exports = {
'pubsweet-server': {
dbPath: path.join(__dirname, '..', 'api', 'db', 'test')
},
// prevent logging from swaming test output
logger: {
debug: () => false,
info: () => false,
warn: () => false,
error: () => false
}
}
......@@ -11,16 +11,11 @@ const start = require('pubsweet/src/start/index.js')
describe('start', () => {
let server
beforeAll(async (done) => {
try {
await dbManager.setupDb(dbConfig)
logger.info('Starting server')
server = await start()
logger.info('Server started')
done()
} catch (e) {
done.fail(e)
}
beforeAll(async () => {
await dbManager.setupDb(dbConfig)
logger.info('Starting server')
server = await start()
logger.info('Server started')
})
afterAll(done => {
......@@ -38,13 +33,13 @@ describe('start', () => {
// - visit the homepage
it('should allow admin to log in', async () => {
const promise = flow()
const headingText = await flow()
.use(pubsweet.login(dbConfig))
.waitForUrl(/manage.posts/)
.wait('nav')
.waitForUrl(/manage\/posts/)
.wait('h2')
.evaluate(() => document.querySelector('h2').innerText)
.end()
await expect(promise).resolves.toBe(dbConfig.collection)
expect(headingText).toBe(dbConfig.collection)
})
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment