1
0
قرینه از https://github.com/matomo-org/matomo.git synced 2025-08-22 15:07:44 +00:00
Files
matomo/plugins/ExamplePlugin/tests/UI/SimpleUITest_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

47 خطوط
1.9 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("SimpleUITest", function () {
this.timeout(0);
// uncomment this if you want to define a custom fixture to load before the test instead of the default one
// this.fixture = "Piwik\\Plugins\\ExamplePlugin\\tests\\Fixtures\\YOUR_FIXTURE_NAME";
var generalParams = 'idSite=1&period=day&date=2010-01-03',
urlBase = 'module=CoreHome&action=index&' + generalParams;
before(function () {
testEnvironment.pluginsToLoad = ['ExamplePlugin'];
testEnvironment.save();
});
it('should load a simple page by its module and action and take a full screenshot', async function() {
var screenshotName = 'simplePage';
// will take a screenshot and store it in "processed-ui-screenshots/SimpleUITest_simplePage.png"
var urlToTest = "?" + generalParams + "&module=ExamplePlugin&action=index";
await page.goto(urlToTest);
expect(await page.screenshot({ fullPage: true })).to.matchImage(screenshotName);
});
it('should load a simple page by its module and action and take a partial screenshot', async function() {
var screenshotName = 'simplePagePartial';
// will take a screenshot and store it in "processed-ui-screenshots/SimpleUITest_simplePagePartial.png"
var contentSelector = '#root,.expandDataTableFooterDrawer';
// take a screenshot only of the content of this CSS/jQuery selector
var urlToTest = "?" + generalParams + "&module=ExamplePlugin&action=index";
// "?" + urlBase + "#" + generalParams + "&module=ExamplePlugin&action=index"; this defines a URL for a page within the dashboard
await page.goto(urlToTest);
expect(await page.screenshotSelector(contentSelector)).to.matchImage(screenshotName);
});
});