diff options
author | Stefan Giehl <stefan@piwik.org> | 2018-03-30 23:56:02 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-30 23:56:02 +0300 |
commit | da1fec50e51071c775278ac2b9c2eb5db7a20f2f (patch) | |
tree | 704e7d0ebe0477fe02c3ac9057e8bb67f27b079b /plugins/SitesManager/tests | |
parent | 119e62cd5cc076396dd83736e402d4f470acadd8 (diff) |
Moves various UI tests to their plugins (#12649)
* move Overlay UI tests to Overlay plugin
* remove UI files that has been moved
* move Login UI tests to Login plugin
* check for element instead of comparing screenshots
* Move Installation UI tests to it's plugin
* Move UI tests for Marketplace to Marketplace plugin
* Updates Sync Screenshots command to download test files to correct directories
* ensure shortcut help is always tested with same useragent
* Move VisitorMap UI tests to UserCountryMap plugin
* Move Morpheus UI tests to plugin
* Move MultiSites UI tests zu plugin
* Move ActionsDataTable UI tests to Actions plugin
* Renames Test directories to tests
* Move UsersManager UI tests to plugin
* Move CoreUpdater UI tests to plugin
* Move DBStats UI tests to plugin
* Move Transitions UI tests to plugin
* Move Insights UI tests to plugin
* improve UI tests splitting on travis
* Moves SegmentEditor UI tests to plugin
* Moves SitesManager UI tests to plugin
* Moves ImageGraph UI tests to plugin
* move live ui test files to git lfs
* remove retry
* update test file
* improve splitting for travis
* prevent test from failing randomly
Diffstat (limited to 'plugins/SitesManager/tests')
9 files changed, 112 insertions, 0 deletions
diff --git a/plugins/SitesManager/tests/UI/SitesManager_spec.js b/plugins/SitesManager/tests/UI/SitesManager_spec.js new file mode 100644 index 0000000000..3e21e12f26 --- /dev/null +++ b/plugins/SitesManager/tests/UI/SitesManager_spec.js @@ -0,0 +1,88 @@ +/*! + * Matomo - free/libre analytics platform + * + * SitesManager screenshot tests. + * + * @link https://matomo.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ + +describe("SitesManager", function () { + this.timeout(0); + this.fixture = "Piwik\\Plugins\\SitesManager\\tests\\Fixtures\\ManySites"; + + var url = "?module=SitesManager&action=index&idSite=1&period=day&date=yesterday&showaddsite=false"; + + function assertScreenshotEquals(screenshotName, done, test) + { + expect.screenshot(screenshotName).to.be.captureSelector('#content', test, done); + } + + function loadNextPage(page) + { + page.click('.SitesManager .paging:first .next'); + } + + function loadPreviousPage(page) + { + page.click('.SitesManager .paging:first .prev'); + } + + function searchForText(page, textToAppendToSearchField) + { + page.sendKeys(".SitesManager .search:first input", textToAppendToSearchField); + page.click('.SitesManager .search:first img'); + page.wait(150); + } + + it("should load correctly and show page 0", function (done) { + assertScreenshotEquals("loaded", done, function (page) { + page.load(url); + }); + }); + + it("should show page 1 when clicking next", function (done) { + assertScreenshotEquals("page_1", done, function (page) { + loadNextPage(page); + }); + }); + + it("should show page 2 when clicking next", function (done) { + assertScreenshotEquals("page_2", done, function (page) { + loadNextPage(page); + }); + }); + + it("should show page 1 when clicking prev", function (done) { + assertScreenshotEquals("page_1_again", done, function (page) { + loadPreviousPage(page); + }); + }); + + it("should search for websites and reset page to 0", function (done) { + assertScreenshotEquals("search", done, function (page) { + searchForText(page, 'SiteTes'); + }); + }); + + it("should page within search result to page 1", function (done) { + assertScreenshotEquals("search_page_1", done, function (page) { + loadNextPage(page); + }); + }); + + it("should search for websites no result", function (done) { + assertScreenshotEquals("search_no_result", done, function (page) { + searchForText(page, 'RanDoMSearChTerm'); + }); + }); + + it("should load the global settings page", function (done) { + assertScreenshotEquals("global_settings", done, function (page) { + page.load('?module=SitesManager&action=globalSettings&idSite=1&period=day&date=yesterday&showaddsite=false'); + page.evaluate(function () { + $('.form-help:contains(UTC time is)').hide(); + }); + }); + }); +});
\ No newline at end of file diff --git a/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_global_settings.png b/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_global_settings.png new file mode 100644 index 0000000000..d2efbb0e53 --- /dev/null +++ b/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_global_settings.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fd7785c0fc20c5762a867502aa34eda81e67882d4e33244fc93a2eddb1bf57ea +size 265717 diff --git a/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_loaded.png b/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_loaded.png new file mode 100644 index 0000000000..b38a71ab2e --- /dev/null +++ b/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_loaded.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:217be30852c53a2833f9b8f7aeddc0bd1b58b0438a8a4b295b66d0fe57a36651 +size 166501 diff --git a/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_page_1.png b/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_page_1.png new file mode 100644 index 0000000000..716940e9ee --- /dev/null +++ b/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_page_1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2a37b03f7da4f40654829523a95dd4a4fd1dd45b1f2ccafea5f8425e99310391 +size 171272 diff --git a/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_page_1_again.png b/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_page_1_again.png new file mode 100644 index 0000000000..690fa8aef4 --- /dev/null +++ b/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_page_1_again.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:74f547c92a5f8208131677343ff28d368a72e4fd846f5e52e3fc07a3f382dadd +size 171294 diff --git a/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_page_2.png b/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_page_2.png new file mode 100644 index 0000000000..f6507d8470 --- /dev/null +++ b/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_page_2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:903b496b77fd035a6aa9f04e95cc578c00588bde4e8e09f4890b236fff3b1a19 +size 173214 diff --git a/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_search.png b/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_search.png new file mode 100644 index 0000000000..d48315bb47 --- /dev/null +++ b/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_search.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c6a908ca9c94a331261bc247382587d999d85453e1256116fcf39c98fbdbb2a1 +size 164757 diff --git a/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_search_no_result.png b/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_search_no_result.png new file mode 100644 index 0000000000..8570c22b95 --- /dev/null +++ b/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_search_no_result.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:238224decfa68bfc3f6c1f2bc7d244b1aae18da067073960150ed87b978f8524 +size 44695 diff --git a/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_search_page_1.png b/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_search_page_1.png new file mode 100644 index 0000000000..6d8547aa4a --- /dev/null +++ b/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_search_page_1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7ef236adfbf0e5b0c06d295af9044e43018d04d8cff1f4c46c54b3b270dc8ecf +size 169348 |