Socialify

Folder ..

Viewing edit.spec.js
71 lines (61 loc) • 2.0 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
const { beforeHelper, afterHelper, prepareSotrage } = require('./../../helper')

describe('Edit credential entry', function() {
  this.timeout(10000)

  describe('user edits credentials entry', () => {
    before(() => beforeHelper({ storage: 'example' }))

    after(() => afterHelper())

    it('shows credentials view', () => {
      return expect(
        app.client
          .setValue('input[type=password]', 'password')
          .keys('\uE007')
          .waitForExist('.body .list .entry')
          .click('.list .entry')
          .getText('.entry-details')
      ).to.eventually.equal(
        `Website\nhttps://example.com\nUsername\nmyuser\nPassword\nmypassword`
      )
    })

    it('shows edit form', () => {
      return expect(
        app.client
          .click('.entry-title .action:nth-of-type(1)')
          .getText('.aside .actions')
      ).to.eventually.equal('CancelSave')
    })

    it('cancels update', () => {
      return expect(
        app.client
          .setValue('input[name=title]', 'Example Updated')
          .click('.actions .cancel')
          .getText('.list .entry')
      ).to.eventually.equal('Example\nmyuser')
    })

    it('hides edit form', () => {
      return expect(app.client.getText('.entry-title h1')).to.eventually.equal(
        'Example'
      )
    })

    it('shows editor form again', () => {
      return expect(
        app.client
          .click('.entry-title .action:nth-of-type(1)')
          .waitForExist('input[name=title]')
          .getValue('input[name=title]')
      ).to.eventually.equal('Example')
    })

    it('updates credential entry', () => {
      return expect(
        app.client
          .setValue('input[name=title]', 'Example Updated')
          .click('.actions .button')
          .getText('.list .entry')
      ).to.eventually.equal('Example Updated\nmyuser')
    })

    it('displays show view in a sidebar', () => {
      return expect(app.client.getText('.entry-title h1')).to.eventually.equal(
        'Example Updated'
      )
    })
  })
})