@webex/plugin-authorization-browser 3.0.0-beta.13 → 3.0.0-beta.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,67 +17,74 @@ describe('plugin-authorization-browser', function () {
17
17
  describe.skip('Implicit Grant', () => {
18
18
  let browser, user;
19
19
 
20
- before(() => testUsers.create({count: 1})
21
- .then((users) => {
20
+ before(() =>
21
+ testUsers.create({count: 1}).then((users) => {
22
22
  user = users[0];
23
- }));
23
+ })
24
+ );
24
25
 
25
- before(() => createBrowser(pkg)
26
- .then((b) => {
26
+ before(() =>
27
+ createBrowser(pkg).then((b) => {
27
28
  browser = b;
28
- }));
29
+ })
30
+ );
29
31
 
30
32
  after(() => browser && browser.printLogs());
31
33
 
32
- after(() => browser && browser.quit()
33
- .catch((reason) => {
34
- console.warn(reason);
35
- }));
34
+ after(
35
+ () =>
36
+ browser &&
37
+ browser.quit().catch((reason) => {
38
+ console.warn(reason);
39
+ })
40
+ );
36
41
 
37
- it('authorizes a user', () => browser
38
- .get(`${redirectUri}/${pkg.name}`)
39
- .waitForElementByClassName('ready')
40
- .title()
42
+ it('authorizes a user', () =>
43
+ browser
44
+ .get(`${redirectUri}/${pkg.name}`)
45
+ .waitForElementByClassName('ready')
46
+ .title()
41
47
  .should.eventually.become('Authorization Automation Test')
42
- .waitForElementByCssSelector('[title="Login with Implicit Grant"]')
48
+ .waitForElementByCssSelector('[title="Login with Implicit Grant"]')
43
49
  .click()
44
- .login(user)
45
- .waitForElementByClassName('authorization-automation-test')
46
- .waitForElementByCssSelector('#ping-complete:not(:empty)')
50
+ .login(user)
51
+ .waitForElementByClassName('authorization-automation-test')
52
+ .waitForElementByCssSelector('#ping-complete:not(:empty)')
47
53
  .text()
48
- .should.eventually.become('success'));
54
+ .should.eventually.become('success'));
49
55
 
50
- it('is still logged in after reloading the page', () => browser
51
- .waitForElementById('access-token')
56
+ it('is still logged in after reloading the page', () =>
57
+ browser
58
+ .waitForElementById('access-token')
52
59
  .text()
53
- .should.eventually.not.be.empty
54
- .url()
60
+ .should.eventually.not.be.empty.url()
55
61
  .then((url) => browser.get(url))
56
- .sleep(500)
57
- .waitForElementById('access-token')
58
- .text()
59
- .should.eventually.not.be.empty);
62
+ .sleep(500)
63
+ .waitForElementById('access-token')
64
+ .text().should.eventually.not.be.empty);
60
65
 
61
- it('logs out a user', () => browser
62
- .title()
66
+ it('logs out a user', () =>
67
+ browser
68
+ .title()
63
69
  .should.eventually.become('Authorization Automation Test')
64
- .waitForElementByCssSelector('[title="Logout"]')
70
+ .waitForElementByCssSelector('[title="Logout"]')
65
71
  .click()
66
- // We need to revoke three tokens before the window.location assignment.
67
- // So far, I haven't found any ques to wait for, so sleep seems to be
68
- // the only option.
69
- .sleep(3000)
70
- .title()
72
+ // We need to revoke three tokens before the window.location assignment.
73
+ // So far, I haven't found any ques to wait for, so sleep seems to be
74
+ // the only option.
75
+ .sleep(3000)
76
+ .title()
71
77
  .should.eventually.become('Redirect Dispatcher')
72
- .get(`${redirectUri}/${pkg.name}`)
73
- .title()
78
+ .get(`${redirectUri}/${pkg.name}`)
79
+ .title()
74
80
  .should.eventually.become('Authorization Automation Test')
75
- .waitForElementById('access-token')
81
+ .waitForElementById('access-token')
76
82
  .text()
77
- .should.eventually.be.empty
78
- .waitForElementByCssSelector('[title="Login with Implicit Grant"]')
83
+ .should.eventually.be.empty.waitForElementByCssSelector(
84
+ '[title="Login with Implicit Grant"]'
85
+ )
79
86
  .click()
80
- .waitForElementById('IDToken1'));
87
+ .waitForElementById('IDToken1'));
81
88
  });
82
89
  });
83
90
  });
@@ -17,13 +17,13 @@ browserOnly(describe)('plugin-authorization-browser', () => {
17
17
  const userId = uuid.v4();
18
18
  const displayName = `test-${userId}`;
19
19
 
20
- return createUser({displayName, userId})
21
- .then(({jwt}) => {
22
- const webex = new WebexCore();
20
+ return createUser({displayName, userId}).then(({jwt}) => {
21
+ const webex = new WebexCore();
23
22
 
24
- return webex.authorization.requestAccessTokenFromJwt({jwt})
25
- .then(() => assert.isTrue(webex.canAuthorize));
26
- });
23
+ return webex.authorization
24
+ .requestAccessTokenFromJwt({jwt})
25
+ .then(() => assert.isTrue(webex.canAuthorize));
26
+ });
27
27
  });
28
28
 
29
29
  it('should call services#initServiceCatalogs()', () => {
@@ -39,37 +39,36 @@ browserOnly(describe)('plugin-authorization-browser', () => {
39
39
  });
40
40
  });
41
41
 
42
- describe.skip('\'#refresh', () => {
42
+ describe.skip("'#refresh", () => {
43
43
  describe('when used with an appid access token', () => {
44
44
  it('refreshes the access token', () => {
45
45
  const userId = uuid.v4();
46
46
  const displayName = `test-${userId}`;
47
47
 
48
- return createUser({displayName, userId})
49
- .then(({jwt}) => {
50
- const webex = new WebexCore({
51
- config: {
52
- credentials: {
53
- jwtRefreshCallback() {
54
- return createUser({displayName, userId})
55
- .then(({jwt}) => jwt);
56
- }
57
- }
58
- }
59
- });
60
- let token;
61
-
62
- return webex.authorization.requestAccessTokenFromJwt({jwt})
63
- .then(() => {
64
- token = webex.credentials.supertoken.access_token;
65
- assert.isTrue(webex.canAuthorize);
66
- })
67
- .then(() => webex.refresh())
68
- .then(() => {
69
- assert.isTrue(webex.canAuthorize);
70
- assert.notEqual(webex.credentials.supertoken.access_token, token);
71
- });
48
+ return createUser({displayName, userId}).then(({jwt}) => {
49
+ const webex = new WebexCore({
50
+ config: {
51
+ credentials: {
52
+ jwtRefreshCallback() {
53
+ return createUser({displayName, userId}).then(({jwt}) => jwt);
54
+ },
55
+ },
56
+ },
72
57
  });
58
+ let token;
59
+
60
+ return webex.authorization
61
+ .requestAccessTokenFromJwt({jwt})
62
+ .then(() => {
63
+ token = webex.credentials.supertoken.access_token;
64
+ assert.isTrue(webex.canAuthorize);
65
+ })
66
+ .then(() => webex.refresh())
67
+ .then(() => {
68
+ assert.isTrue(webex.canAuthorize);
69
+ assert.notEqual(webex.credentials.supertoken.access_token, token);
70
+ });
71
+ });
73
72
  });
74
73
  });
75
74
  });