bugfix: Login form was not displayed if only OAuth2 was configured (#457)
* bugfix: Login form was not displayed if only OAuth2 was configured * bugfix: npe in AuthOAuth2Provider * test: Try and fix flakey tests
This commit is contained in:
parent
d3ad811ac5
commit
9117163316
|
|
@ -7,9 +7,19 @@ export async function getActionButtons (webdriver) {
|
||||||
return await webdriver.findElement(By.id('contentActions')).findElements(By.tagName('button'))
|
return await webdriver.findElement(By.id('contentActions')).findElements(By.tagName('button'))
|
||||||
}
|
}
|
||||||
|
|
||||||
export function takeScreenshot (webdriver) {
|
export function takeScreenshotOnFailure (test, webdriver) {
|
||||||
|
if (test.state === 'failed') {
|
||||||
|
const title = test.fullTitle();
|
||||||
|
|
||||||
|
console.log(`Test failed, taking screenshot: ${title}`);
|
||||||
|
takeScreenshot(webdriver, title);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function takeScreenshot (webdriver, title) {
|
||||||
return webdriver.takeScreenshot().then((img) => {
|
return webdriver.takeScreenshot().then((img) => {
|
||||||
fs.writeFileSync('out.png', img, 'base64')
|
fs.mkdirSync('screenshots', { recursive: true });
|
||||||
|
fs.writeFileSync('screenshots/' + title + '.png', img, 'base64')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,11 @@
|
||||||
import { describe, it, before, after } from 'mocha'
|
import { describe, it, before, after } from 'mocha'
|
||||||
import { expect } from 'chai'
|
import { expect } from 'chai'
|
||||||
import { By, until } from 'selenium-webdriver'
|
import { By, until } from 'selenium-webdriver'
|
||||||
import { getRootAndWait, takeScreenshot } from '../lib/elements.js'
|
import {
|
||||||
|
getRootAndWait,
|
||||||
|
takeScreenshot,
|
||||||
|
takeScreenshotOnFailure,
|
||||||
|
} from '../lib/elements.js'
|
||||||
|
|
||||||
describe('config: entities', function () {
|
describe('config: entities', function () {
|
||||||
before(async function () {
|
before(async function () {
|
||||||
|
|
@ -12,6 +16,10 @@ describe('config: entities', function () {
|
||||||
await runner.stop()
|
await runner.stop()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
afterEach(function () {
|
||||||
|
takeScreenshotOnFailure(this.currentTest, webdriver);
|
||||||
|
});
|
||||||
|
|
||||||
it('Entity buttons are rendered', async function() {
|
it('Entity buttons are rendered', async function() {
|
||||||
await getRootAndWait()
|
await getRootAndWait()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,11 @@ import { describe, it, before, after } from 'mocha'
|
||||||
import { expect } from 'chai'
|
import { expect } from 'chai'
|
||||||
import { By, until, Condition } from 'selenium-webdriver'
|
import { By, until, Condition } from 'selenium-webdriver'
|
||||||
//import * as waitOn from 'wait-on'
|
//import * as waitOn from 'wait-on'
|
||||||
import { getRootAndWait, getActionButtons } from '../lib/elements.js'
|
import {
|
||||||
|
getRootAndWait,
|
||||||
|
getActionButtons,
|
||||||
|
takeScreenshotOnFailure,
|
||||||
|
} from '../lib/elements.js'
|
||||||
|
|
||||||
describe('config: general', function () {
|
describe('config: general', function () {
|
||||||
before(async function () {
|
before(async function () {
|
||||||
|
|
@ -13,6 +17,10 @@ describe('config: general', function () {
|
||||||
await runner.stop()
|
await runner.stop()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
afterEach(function () {
|
||||||
|
takeScreenshotOnFailure(this.currentTest, webdriver);
|
||||||
|
});
|
||||||
|
|
||||||
it('Page title', async function () {
|
it('Page title', async function () {
|
||||||
await webdriver.get(runner.baseUrl())
|
await webdriver.get(runner.baseUrl())
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,11 @@ import { describe, it, before, after } from 'mocha'
|
||||||
import { expect } from 'chai'
|
import { expect } from 'chai'
|
||||||
|
|
||||||
import { By } from 'selenium-webdriver'
|
import { By } from 'selenium-webdriver'
|
||||||
|
import {
|
||||||
|
getRootAndWait,
|
||||||
|
getActionButtons,
|
||||||
|
takeScreenshotOnFailure,
|
||||||
|
} from '../lib/elements.js'
|
||||||
|
|
||||||
describe('config: hiddenFooter', function () {
|
describe('config: hiddenFooter', function () {
|
||||||
before(async function () {
|
before(async function () {
|
||||||
|
|
@ -12,6 +17,10 @@ describe('config: hiddenFooter', function () {
|
||||||
await runner.stop()
|
await runner.stop()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
afterEach(function () {
|
||||||
|
takeScreenshotOnFailure(this.currentTest, webdriver);
|
||||||
|
});
|
||||||
|
|
||||||
it('Check that footer is hidden', async () => {
|
it('Check that footer is hidden', async () => {
|
||||||
await webdriver.get(runner.baseUrl())
|
await webdriver.get(runner.baseUrl())
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,11 @@
|
||||||
import { expect } from 'chai'
|
import { expect } from 'chai'
|
||||||
import { By } from 'selenium-webdriver'
|
import { By } from 'selenium-webdriver'
|
||||||
|
import {
|
||||||
|
getRootAndWait,
|
||||||
|
getActionButtons,
|
||||||
|
takeScreenshotOnFailure,
|
||||||
|
} from '../lib/elements.js'
|
||||||
|
|
||||||
|
|
||||||
describe('config: hiddenNav', function () {
|
describe('config: hiddenNav', function () {
|
||||||
before(async function () {
|
before(async function () {
|
||||||
|
|
@ -10,6 +16,10 @@ describe('config: hiddenNav', function () {
|
||||||
await runner.stop()
|
await runner.stop()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
afterEach(function () {
|
||||||
|
takeScreenshotOnFailure(this.currentTest, webdriver);
|
||||||
|
});
|
||||||
|
|
||||||
it('nav is hidden', async () => {
|
it('nav is hidden', async () => {
|
||||||
await webdriver.get(runner.baseUrl())
|
await webdriver.get(runner.baseUrl())
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,12 @@
|
||||||
import { describe, it, before, after } from 'mocha'
|
import { describe, it, before, after } from 'mocha'
|
||||||
import { expect } from 'chai'
|
import { expect } from 'chai'
|
||||||
import { By, until } from 'selenium-webdriver'
|
import { By, until } from 'selenium-webdriver'
|
||||||
import { getActionButtons, getRootAndWait } from '../lib/elements.js'
|
import {
|
||||||
|
getRootAndWait,
|
||||||
|
getActionButtons,
|
||||||
|
takeScreenshotOnFailure,
|
||||||
|
} from '../lib/elements.js'
|
||||||
|
|
||||||
|
|
||||||
describe('config: multipleDropdowns', function () {
|
describe('config: multipleDropdowns', function () {
|
||||||
before(async function () {
|
before(async function () {
|
||||||
|
|
@ -12,6 +17,10 @@ describe('config: multipleDropdowns', function () {
|
||||||
await runner.stop()
|
await runner.stop()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
afterEach(function () {
|
||||||
|
takeScreenshotOnFailure(this.currentTest, webdriver);
|
||||||
|
});
|
||||||
|
|
||||||
it('Multiple dropdowns are possible', async function() {
|
it('Multiple dropdowns are possible', async function() {
|
||||||
await getRootAndWait()
|
await getRootAndWait()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,9 @@ import { describe, it, before, after } from 'mocha'
|
||||||
import { expect } from 'chai'
|
import { expect } from 'chai'
|
||||||
|
|
||||||
import { By } from 'selenium-webdriver'
|
import { By } from 'selenium-webdriver'
|
||||||
|
import {
|
||||||
|
takeScreenshotOnFailure,
|
||||||
|
} from '../lib/elements.js'
|
||||||
|
|
||||||
let metrics = [
|
let metrics = [
|
||||||
{'name': 'olivetin_actions_requested_count', 'type': 'counter', 'desc': 'The actions requested count'},
|
{'name': 'olivetin_actions_requested_count', 'type': 'counter', 'desc': 'The actions requested count'},
|
||||||
|
|
@ -19,6 +22,10 @@ describe('config: prometheus', function () {
|
||||||
await runner.stop()
|
await runner.stop()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
afterEach(function () {
|
||||||
|
takeScreenshotOnFailure(this.currentTest, webdriver);
|
||||||
|
});
|
||||||
|
|
||||||
it('Metrics are available with correct types', async () => {
|
it('Metrics are available with correct types', async () => {
|
||||||
webdriver.get(runner.metricsUrl())
|
webdriver.get(runner.metricsUrl())
|
||||||
const prometheusOutput = await webdriver.findElement(By.tagName('pre')).getText()
|
const prometheusOutput = await webdriver.findElement(By.tagName('pre')).getText()
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import { expect } from 'chai'
|
||||||
import { By, Condition } from 'selenium-webdriver'
|
import { By, Condition } from 'selenium-webdriver'
|
||||||
import {
|
import {
|
||||||
takeScreenshot,
|
takeScreenshot,
|
||||||
|
takeScreenshotOnFailure,
|
||||||
findExecutionDialog,
|
findExecutionDialog,
|
||||||
requireExecutionDialogStatus,
|
requireExecutionDialogStatus,
|
||||||
getRootAndWait,
|
getRootAndWait,
|
||||||
|
|
@ -19,6 +20,10 @@ describe('config: sleep', function () {
|
||||||
await runner.stop()
|
await runner.stop()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
afterEach(function () {
|
||||||
|
takeScreenshotOnFailure(this.currentTest, webdriver);
|
||||||
|
});
|
||||||
|
|
||||||
it('Sleep action kill', async function() {
|
it('Sleep action kill', async function() {
|
||||||
await getRootAndWait()
|
await getRootAndWait()
|
||||||
|
|
||||||
|
|
@ -39,10 +44,6 @@ describe('config: sleep', function () {
|
||||||
|
|
||||||
await killButton.click()
|
await killButton.click()
|
||||||
|
|
||||||
console.log("env CI:", process.env.CI)
|
await requireExecutionDialogStatus(webdriver, "Completed")
|
||||||
|
|
||||||
if (process.env.CI !== 'true') {
|
|
||||||
await requireExecutionDialogStatus(webdriver, "Non-Zero Exit")
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,8 @@
|
||||||
import { expect } from 'chai'
|
import { expect } from 'chai'
|
||||||
|
import {
|
||||||
|
getRootAndWait,
|
||||||
|
takeScreenshotOnFailure,
|
||||||
|
} from '../lib/elements.js'
|
||||||
|
|
||||||
describe('config: trustedHeader', function () {
|
describe('config: trustedHeader', function () {
|
||||||
before(async function () {
|
before(async function () {
|
||||||
|
|
@ -9,7 +13,13 @@ describe('config: trustedHeader', function () {
|
||||||
await runner.stop()
|
await runner.stop()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
afterEach(function () {
|
||||||
|
takeScreenshotOnFailure(this.currentTest, webdriver);
|
||||||
|
});
|
||||||
|
|
||||||
it('req with X-User', async () => {
|
it('req with X-User', async () => {
|
||||||
|
await getRootAndWait()
|
||||||
|
|
||||||
const req = await fetch(runner.baseUrl() + '/api/WhoAmI', {
|
const req = await fetch(runner.baseUrl() + '/api/WhoAmI', {
|
||||||
headers: {
|
headers: {
|
||||||
"X-User": "fred",
|
"X-User": "fred",
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ export function marshalDashboardComponentsJsonToHtml (json) {
|
||||||
|
|
||||||
document.getElementById('username').innerText = json.authenticatedUser
|
document.getElementById('username').innerText = json.authenticatedUser
|
||||||
|
|
||||||
if (window.settings.AuthLocalLogin || window.settings.AuthLocalRegister != null) {
|
if (window.settings.AuthLocalLogin || window.settings.AuthOAuth2Providers !== null) {
|
||||||
if (json.authenticatedUser === 'guest') {
|
if (json.authenticatedUser === 'guest') {
|
||||||
document.getElementById('link-login').hidden = false
|
document.getElementById('link-login').hidden = false
|
||||||
document.getElementById('link-logout').hidden = true
|
document.getElementById('link-logout').hidden = true
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue