Newer
Older
/*!
* Piwik - free/libre analytics platform
*
* ActionsDataTable screenshot tests.
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
describe("QuickAccess", function () {
var selectorToCapture = ".quick-access,.quick-access .dropdown";
this.timeout(0);
var url = "?module=CoreHome&action=index&idSite=1&period=year&date=2012-08-09";
function enterSearchTerm(page, searchTermToAdd)
{
page.sendKeys(".quick-access input", searchTermToAdd);
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
72
73
74
75
76
77
}
function captureSelector(screenshotName, done, selector, callback)
{
expect.screenshot(screenshotName).to.be.captureSelector(selector, callback, done);
}
function capture(screenshotName, done, callback)
{
captureSelector(screenshotName, done, selectorToCapture, callback);
}
it("should be displayed", function (done) {
capture('initially', done, function (page) {
page.load(url);
});
});
it("should search for something and update view", function (done) {
capture('search_1', done, function (page) {
enterSearchTerm(page, 'b');
});
});
it("should search again when typing another letter", function (done) {
capture('search_2', done, function (page) {
enterSearchTerm(page, 'a');
});
});
it("should show message if no results", function (done) {
capture('search_no_result', done, function (page) {
enterSearchTerm(page, 'x');
});
});
it("should be possible to activate via shortcut", function (done) {
capture('shortcut', done, function (page) {
page.load(url);
page.sendKeys("body", 'f');
});
});
it("should search for websites", function (done) {
capture('search_sites', done, function (page) {
enterSearchTerm(page, 'si');
});
});
it("clicking on a category should show all items that belong to that category", function (done) {
capture('search_category', done, function (page) {
page.click('.quick-access-category:first');
});
});
});