diff options
Diffstat (limited to 'tests/UI/specs/QuickAccess_spec.js')
-rw-r--r-- | tests/UI/specs/QuickAccess_spec.js | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/tests/UI/specs/QuickAccess_spec.js b/tests/UI/specs/QuickAccess_spec.js new file mode 100644 index 0000000000..75879d2729 --- /dev/null +++ b/tests/UI/specs/QuickAccess_spec.js @@ -0,0 +1,75 @@ +/*! + * 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 = "#search,.quick-access"; + + this.timeout(0); + + var url = "?module=CoreHome&action=index&idSite=1&period=year&date=2012-08-09"; + + function enterSearchTerm(page, searchTermToAdd) + { + page.sendKeys("#search input", searchTermToAdd); + } + + 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'); + }); + }); + +}); |