cicd: Reduce test flake and add lots more debugging info (#290)
This commit is contained in:
parent
a3aee3603f
commit
318d4fe0d0
|
|
@ -0,0 +1,3 @@
|
|||
logLevel: DEBUG
|
||||
|
||||
authHttpHeaderUsername: "X-User"
|
||||
|
|
@ -78,8 +78,14 @@ class OliveTinTestRunnerStartLocalProcess extends OliveTinTestRunner {
|
|||
}
|
||||
|
||||
async stop () {
|
||||
await this.ot.kill()
|
||||
console.log(" OliveTin local process killed")
|
||||
if ((await this.ot.exitCode) != null) {
|
||||
console.log(" OliveTin local process tried stop(), but it already exited with code", this.ot.exitCode)
|
||||
} else {
|
||||
await this.ot.kill()
|
||||
console.log(" OliveTin local process killed")
|
||||
}
|
||||
|
||||
await new Promise((res) => setTimeout(res, 100))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { describe, it, before, after } from 'mocha'
|
|||
import { expect } from 'chai'
|
||||
import { By, until, Condition } from 'selenium-webdriver'
|
||||
//import * as waitOn from 'wait-on'
|
||||
import { getRootAndWait } from '../lib/elements.js'
|
||||
import { getRootAndWait, getActionButtons } from '../lib/elements.js'
|
||||
|
||||
describe('config: general', function () {
|
||||
before(async function () {
|
||||
|
|
@ -39,7 +39,7 @@ describe('config: general', function () {
|
|||
it('Default buttons are rendered', async function() {
|
||||
await getRootAndWait()
|
||||
|
||||
const buttons = await webdriver.findElement(By.id('root-group')).findElements(By.tagName('button'))
|
||||
const buttons = await getActionButtons(webdriver)
|
||||
|
||||
expect(buttons).to.have.length(8)
|
||||
})
|
||||
|
|
@ -69,7 +69,7 @@ describe('config: general', function () {
|
|||
})
|
||||
|
||||
it('Start date action (passive)', async function() {
|
||||
await webdriver.get(runner.baseUrl())
|
||||
await getRootAndWait()
|
||||
|
||||
const buttons = await webdriver.findElements(By.css('[title="date-passive"]'))
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
import { expect } from 'chai'
|
||||
|
||||
describe('config: trustedHeader', function () {
|
||||
before(async function () {
|
||||
await runner.start('trustedHeader')
|
||||
})
|
||||
|
||||
after(async () => {
|
||||
await runner.stop()
|
||||
})
|
||||
|
||||
it('req with X-User', async () => {
|
||||
const req = await fetch(runner.baseUrl() + '/api/WhoAmI', {
|
||||
headers: {
|
||||
"X-User": "fred",
|
||||
}
|
||||
})
|
||||
|
||||
if (!req.ok) {
|
||||
console.log(req)
|
||||
}
|
||||
|
||||
expect(req.ok, 'WhoAmI Request is ' + req.status).to.be.true
|
||||
|
||||
const json = await req.json()
|
||||
|
||||
expect(json).to.not.be.null
|
||||
expect(json).to.have.own.property('authenticatedUser')
|
||||
|
||||
expect(json['authenticatedUser']).to.be.equal('fred')
|
||||
})
|
||||
})
|
||||
Loading…
Reference in New Issue