1
0
قرینه از https://github.com/matomo-org/matomo.git synced 2025-08-22 15:07:44 +00:00
Files
matomo/tests/UI/specs/SiteSelector_spec.js
Michal Kleiner 9a3ef94df6 [Coding Style] Enable rule PSR12.Files.FileHeader + unify file headers (#22132)
* [Coding Style] Enable rule PSR12.Files.FileHeader

* Apply CS

* Replace Piwik with Matomo in file headers

* Unify file headers (position, no. of lines, https links)

* Rebuild dist files

* Apply CS

* Fix system test that relies on line numbers in a file that had the file header updated

---------

Co-authored-by: Stefan Giehl <stefan@matomo.org>
2024-04-20 20:50:47 +02:00

70 خطوط
2.4 KiB
JavaScript

/*!
* Matomo - free/libre analytics platform
*
* Site selector screenshot tests.
*
* @link https://matomo.org
* @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
describe("SiteSelector", function () {
this.timeout(0);
const selectorToCapture = '.siteSelector,.siteSelector .dropdown';
const url = "?module=UsersManager&action=userSettings&idSite=1&period=day&date=yesterday";
it("should load correctly", async function() {
await page.goto(url);
await page.waitForNetworkIdle();
dialog = await page.$(selectorToCapture);
await page.waitForTimeout(500);
expect(await dialog.screenshot()).to.matchImage('loaded');
});
it("should display expanded when clicked", async function() {
await page.click('.sites_autocomplete .title');
await page.waitForSelector('.custom_select_ul_list');
await page.waitForNetworkIdle();
await page.click('.websiteSearch');
expect(await page.screenshotSelector(selectorToCapture)).to.matchImage('expanded');
});
it("should show no results when search returns no results", async function() {
await page.type(".websiteSearch", "abc");
await page.waitForTimeout(500);
await page.waitForNetworkIdle();
expect(await page.screenshotSelector(selectorToCapture)).to.matchImage('search_no_results');
});
it("should search when one character typed into search input", async function() {
await page.click('.reset');
await page.waitForTimeout(500);
await page.type(".websiteSearch", "s");
await page.waitForNetworkIdle();
await page.waitForTimeout(500);
expect(await page.screenshotSelector(selectorToCapture)).to.matchImage('search_one_char');
});
it("should search again when second character typed into search input", async function() {
await page.type(".websiteSearch", "t");
await page.waitForNetworkIdle();
await page.waitForTimeout(500);
expect(await page.screenshotSelector(selectorToCapture)).to.matchImage('search_two_chars');
});
it("should change the site when a site is selected", async function() {
elem = await page.jQuery(".custom_select_ul_list>li:visible");
elem.click();
await page.waitForNetworkIdle();
await page.waitForTimeout(200);
expect(await page.screenshotSelector(selectorToCapture)).to.matchImage('site_selected');
});
});