Socialify

Folder ..

Viewing password.spec.js
57 lines (48 loc) • 1.6 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
const { beforeHelper, afterHelper } = require('./../../helper')

describe('Password field on entry form', function() {
  this.timeout(10000)

  describe('show/hide password', () => {
    before(() => beforeHelper({ storage: 'empty' }))

    after(() => afterHelper())

    it('shows credentials form', () => {
      return expect(
        app.client
          .setValue('input[type=password]', 'password')
          .keys("\uE007")
          .click('.add-button')
          .isExisting('input[name=password]')
      ).to.eventually.equal(true)
    })

    it('password is hidden by defaul', () => {
      return expect(
        app.client
          .setValue('input[name=password]', 'password')
          .isExisting('.secure-on input[name=password]')
      ).to.eventually.equal(true)
    })
    
    it('shows password on click reveal', () => {
      return expect(
        app.client
          .click('.secure-on .view')
          .isExisting('.secure-off input[name=password]')
      ).to.eventually.equal(true)
    })
    
    it('shows password on click reveal', () => {
      return expect(
        app.client.getValue('input[name=password]')
      ).to.eventually.equal('password')
    })
    
    it('generates password', () => {
      return expect(
        app.client
          .click('.secure-off .action')
          .getValue('input[name=password]')
      ).to.not.eventually.equal('password')
    })
    
    it('replaces current password', () => {
      return app.client.getValue('input[name=password]').then(value => {
        expect(value.length).to.equal(12)
      })
    })
  })
})