-
Notifications
You must be signed in to change notification settings - Fork 4k
Expand file tree
/
Copy pathhappy-login.js
More file actions
86 lines (78 loc) · 2.53 KB
/
happy-login.js
File metadata and controls
86 lines (78 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
const { By, Key, until, Builder } = require('selenium-webdriver')
require('chromedriver')
const assert = require('assert')
const { buildDriver, goToHome, captureScreensFor, teardown, idpLoginPage, log } = require('../../utils')
const SSOHomePage = require('../../pageobjects/SSOHomePage')
const OverviewPage = require('../../pageobjects/OverviewPage')
describe('An user with administrator tag', function () {
let driver
let homePage
let idpLogin
let overview
let captureScreen
before(async function () {
driver = buildDriver()
await goToHome(driver)
homePage = new SSOHomePage(driver)
idpLogin = idpLoginPage(driver)
overview = new OverviewPage(driver)
captureScreen = captureScreensFor(driver, __filename)
})
it('can log in with OAuth 2.0', async function () {
await homePage.clickToLogin()
await idpLogin.login('rabbit_admin', 'rabbit_admin')
if (!await overview.isLoaded()) {
throw new Error('Failed to login')
}
await overview.logout()
})
it('can log in with Basic Auth', async function () {
await homePage.toggleBasicAuthSection()
await homePage.basicAuthLogin('guest', 'guest')
if (!await overview.isLoaded()) {
throw new Error('Failed to login')
}
await overview.logout()
})
describe("and logged in via OAuth 2.0", function() {
before(async function() {
await homePage.clickToLogin()
await idpLogin.login('rabbit_admin', 'rabbit_admin')
if (!await overview.isLoaded()) {
throw new Error('Failed to login via OAuth 2.0')
}
})
it ('can reload page without being logged out', async function() {
log("About to refresh page")
await overview.refresh()
if (!await overview.isLoaded()) {
throw new Error('Failed to keep session opened')
}
})
after(async function () {
await overview.logout()
})
})
describe("and logged in via basic auth", function() {
before(async function() {
await homePage.toggleBasicAuthSection()
await homePage.basicAuthLogin('guest', 'guest')
if (!await overview.isLoaded()) {
throw new Error('Failed to login')
}
})
it ('can reload page without being logged out', async function() {
log("About to refresh page")
await overview.refresh()
if (!await overview.isLoaded()) {
throw new Error('Failed to keep session opened')
}
})
after(async function () {
await overview.logout()
})
})
after(async function () {
await teardown(driver, this, captureScreen)
})
})