Socialify

Folder ..

Viewing search.spec.js
46 lines (39 loc) • 1.2 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
const { beforeHelper, afterHelper } = require('./../../helper')

describe('Search credential entries', function() {
  this.timeout(10000)

  describe('user searches credentials', () => {
    before(() => beforeHelper({ storage: 'collection' }))

    after(() => afterHelper())

    it('shows credentials', () => {
      return expect(
        app.client
          .setValue('input[type=password]', 'password')
          .keys('\uE007')
          .waitForExist('.body .list .entry')
          .isExisting('.list .entry:nth-child(3)')
      ).to.eventually.equal(true)
    })

    it('filters entries', () => {
      return expect(
        app.client
          .setValue('.search input', 'in')
          .isExisting('.list .entry:nth-child(2)')
      ).to.eventually.equal(false)
    })

    it('shows only matching entries', () => {
      return expect(
        app.client
          .setValue('.search input', 'in')
          .getText('.list .entry:nth-child(1)')
      ).to.eventually.equal('Instagram\nanotheruser')
    })

    it('adds entries back on clear filter', () => {
      return expect(
        app.client
          .keys('\uE003')
          .keys('\uE003')
          .isExisting('.list .entry:nth-child(3)')
      ).to.eventually.equal(true)
    })
  })
})