aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/test/medium/issues.spec.js
blob: 4987c91aa4cd13b2f1ee6b6b0dcc81b6eeb88698 (plain)
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
define(function (require) {
  var bdd = require('intern!bdd');
  require('../helpers/test-page');

  bdd.describe('Issues Page', function () {
    bdd.describe('Saved Searches', function () {
      bdd.it('should show list of saved searches', function () {
        return this.remote
            .get(require.toUrl('test/medium/base.html'))
            .setFindTimeout(5000)
            .mockFromString('/api/l10n/index', '{}')
            .mockFromFile('/api/issue_filters/app', 'issues-spec/app.json')
            .mockFromFile('/api/issues/search', 'issues-spec/search.json')
            .startApp('issues')
            .assertElementCount('.js-filter', 2)
            .assertElementCount('.js-filter[data-id="31"]', 1)
            .assertElementCount('.js-filter[data-id="32"]', 1);
      });

      bdd.it('should load a saved search', function () {
        return this.remote
            .get(require.toUrl('test/medium/base.html'))
            .setFindTimeout(5000)
            .mockFromString('/api/l10n/index', '{}')
            .mockFromFile('/api/issue_filters/app', 'issues-spec/app.json')
            .mockFromFile('/api/issues/search', 'issues-spec/search.json')
            .mockFromFile('/api/issue_filters/show/31', 'issues-spec/filter.json')
            .startApp('issues')
            .clickElement('.search-navigator-filters-show-list')
            .clickElement('.js-filter[data-id="31"]')
            .assertElementCount('.js-filter-copy', 1)
            .assertElementCount('.js-filter-edit', 1)
            .assertElementInclude('.issues-filters-name', 'Critical and Blocker Issues')
            .assertElementCount('.js-facet.active[data-value="BLOCKER"]', 1)
            .assertElementCount('.js-facet.active[data-value="CRITICAL"]', 1)
            .assertElementCount('.js-facet.active[data-unresolved]', 1);
      });

      bdd.it('should load a saved search and then resets it by new search', function () {
        return this.remote
            .get(require.toUrl('test/medium/base.html'))
            .setFindTimeout(5000)
            .mockFromString('/api/l10n/index', '{}')
            .mockFromFile('/api/issue_filters/app', 'issues-spec/app.json')
            .mockFromFile('/api/issues/search', 'issues-spec/search.json')
            .mockFromFile('/api/issue_filters/show/31', 'issues-spec/filter.json')
            .startApp('issues')
            .clickElement('.search-navigator-filters-show-list')
            .clickElement('.js-filter[data-id="31"]')
            .assertElementCount('.js-filter-copy', 1)
            .assertElementCount('.js-filter-edit', 1)
            .assertElementInclude('.issues-filters-name', 'Critical and Blocker Issues')
            .assertElementCount('.js-facet.active[data-value="BLOCKER"]', 1)
            .assertElementCount('.js-facet.active[data-value="CRITICAL"]', 1)
            .assertElementCount('.js-facet.active[data-unresolved]', 1)
            .clickElement('.js-new-search')
            .assertElementCount('.js-facet[data-value="BLOCKER"]:not(.active)', 1)
            .assertElementCount('.js-facet[data-value="CRITICAL"]:not(.active)', 1)
            .assertElementCount('.js-facet.active[data-unresolved]', 1)
            .assertElementNotInclude('.issues-filters-name', 'Critical and Blocker Issues');
      });
    });
  });

});