Commit 0ab79095 authored by Tamlyn Rhodes's avatar Tamlyn Rhodes

Fix integration test

Wait for h2 because nav is rendered first so could cause test to fail
Add placeholder to keep db directory
Silence logs when testing
parent e2fdecc7
Pipeline #2465 failed with stage
in 1 minute and 46 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