1
1
const { By, Key, until, Builder } = require ( 'selenium-webdriver' )
2
2
require ( 'chromedriver' )
3
3
const assert = require ( 'assert' )
4
- const { buildDriver, goToHome, captureScreensFor, teardown, idpLoginPage } = require ( '../utils' )
4
+ const { buildDriver, goToHome, captureScreensFor, teardown, delay } = require ( '../utils' )
5
5
6
- const SSOHomePage = require ( '../pageobjects/SSOHomePage ' )
6
+ const LoginPage = require ( '../pageobjects/LoginPage ' )
7
7
const OverviewPage = require ( '../pageobjects/OverviewPage' )
8
8
9
9
describe ( 'An user without management tag' , function ( ) {
@@ -15,38 +15,38 @@ describe('An user without management tag', function () {
15
15
before ( async function ( ) {
16
16
driver = buildDriver ( )
17
17
await goToHome ( driver )
18
- homePage = new SSOHomePage ( driver )
19
- idpLogin = idpLoginPage ( driver )
18
+ login = new LoginPage ( driver )
20
19
overview = new OverviewPage ( driver )
21
20
captureScreen = captureScreensFor ( driver , __filename )
22
21
23
- await homePage . clickToLogin ( )
24
- await idpLogin . login ( 'rabbit_no_management' , 'rabbit_no_management' )
25
- if ( ! await homePage . isLoaded ( ) ) {
26
- throw new Error ( 'Failed to login' )
27
- }
22
+ assert . ok ( ! await login . isPopupWarningDisplayed ( ) )
23
+ await login . login ( 'rabbit_no_management' , 'rabbit_no_management' )
24
+ await ! overview . isLoaded ( )
28
25
} )
29
26
30
27
it ( 'cannot log in into the management ui' , async function ( ) {
31
- const visible = await homePage . isWarningVisible ( )
28
+ const visible = await login . isWarningVisible ( )
32
29
assert . ok ( visible )
33
30
} )
34
31
35
- it ( 'should get "Not authorized" warning message' , async function ( ) {
36
- assert . equal ( 'Not authorized' , await homePage . getWarning ( ) )
37
- //assert.equal('Click here to logout', await homePage.getLogoutButton())
38
- //assert.ok(!await homePage.isBasicAuthSectionVisible())
39
- //assert.ok(!await homePage.isOAuth2SectionVisible())
32
+ it ( 'should get "Login failed" warning message' , async function ( ) {
33
+ assert . equal ( 'Login failed' , await login . getWarning ( ) )
40
34
} )
41
35
42
- describe ( "After clicking on logout button" , function ( ) {
36
+ it ( 'should get popup warning dialog' , async function ( ) {
37
+ assert . ok ( login . isPopupWarningDisplayed ( ) )
38
+ assert . equal ( 'Not_Authorized' , await login . getPopupWarning ( ) )
39
+ } )
40
+
41
+ describe ( "After clicking on popup warning dialog button" , function ( ) {
43
42
44
43
before ( async function ( ) {
45
- await homePage . clickToLogout ( )
44
+ await login . closePopupWarning ( )
46
45
} )
47
46
48
- it ( 'should get redirected to home page again without error message' , async function ( ) {
49
- const visible = await homePage . isWarningVisible ( )
47
+ it ( 'should close popup warning' , async function ( ) {
48
+ await delay ( 1000 )
49
+ const visible = await login . isPopupWarningDisplayed ( )
50
50
assert . ok ( ! visible )
51
51
} )
52
52
0 commit comments