1
0
قرینه از https://github.com/matomo-org/matomo.git synced 2025-08-22 06:57:53 +00:00
Files
matomo/plugins/UserCountry/tests/UI/UserCountry_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

54 خطوط
1.8 KiB
JavaScript

/*!
* Matomo - free/libre analytics platform
*
* Screenshot integration tests.
*
* @link https://matomo.org
* @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
describe("UserCountry", function () {
afterEach(function () {
delete testEnvironment.pluginsToUnload;
testEnvironment.save();
});
it('should show geolocation admin without additional providers', async function () {
testEnvironment.pluginsToUnload = ['GeoIp2'];
testEnvironment.save();
await page.goto("?module=UserCountry&action=adminIndex");
expect(await page.screenshotSelector('#content')).to.matchImage('admin_no_providers');
});
it('should show geolocation admin with GeoIP2 providers', async function () {
testEnvironment.pluginsToLoad = ['GeoIp2', 'Provider'];
testEnvironment.save();
await page.goto("?module=UserCountry&action=adminIndex");
await page.evaluate(function(){
$('#geoipdb-update-info').html($('#geoipdb-update-info').html().replace(/dbip-city-lite-[\d]{4}-[\d]{2}\.mmdb\.gz</, 'dbip-city-lite-2020-04.mmdb.gz<'));
});
expect(await page.screenshotSelector('#content')).to.matchImage('admin_geoip2');
});
it('should show geolocation admin with GeoIP2 providers (without Provider plugin)', async function () {
testEnvironment.pluginsToLoad = ['GeoIp2'];
testEnvironment.pluginsToUnload = ['Provider'];
testEnvironment.save();
await page.reload();
await page.evaluate(function(){
$('#geoipdb-update-info').html($('#geoipdb-update-info').html().replace(/dbip-city-lite-[\d]{4}-[\d]{2}\.mmdb\.gz</, 'dbip-city-lite-2020-04.mmdb.gz<'));
});
expect(await page.screenshotSelector('#content')).to.matchImage('admin_geoip2_no_provider');
});
});