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

68 خطوط
2.2 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("CampaignBuilder", function () {
this.timeout(0);
var url = '?module=Widgetize&action=iframe&widget=1&moduleToWidgetize=Referrers&actionToWidgetize=getCampaignUrlBuilder&idSite=1&period=day&date=yesterday&disableLink=1&widget=1';
before(function () {
testEnvironment.pluginsToLoad = ['Referrers'];
testEnvironment.save();
});
async function captureUrlBuilder(screenshotName, theTest)
{
await theTest();
const element = await page.$('.campaignUrlBuilder');
expect(await element.screenshot()).to.matchImage(screenshotName);
}
async function ensureHighlightEffectIsGone()
{
await page.waitForTimeout(2000);
}
async function generateUrl()
{
await page.click('.generateCampaignUrl');
await ensureHighlightEffectIsGone();
}
it('should load the url builder', async function () {
await page.goto(url);
expect(await page.screenshot({ fullPage: true })).to.matchImage('loaded');
});
it('generate simple url with url and campaign name', async function () {
await captureUrlBuilder('generate_url_nokeyword', async function () {
await page.type('#websiteurl', 'https://www.example.com/foo/bar?x=1&y=2#foobarbaz');
await page.type('#campaignname', 'My2018Campaign-Test');
await generateUrl();
});
});
it('can reset form', async function () {
await captureUrlBuilder('generate_url_reset', async function () {
await page.click('.resetCampaignUrl');
await page.waitForTimeout(500); // wait to re-render
});
});
it('generate simple url with url and campaign name and keyword', async function () {
await captureUrlBuilder('generate_url_withkeyword', async function () {
await page.type('#websiteurl', 'www.example.com');
await page.type('#campaignname', 'MyAwesome&#2<&§Name');
await page.type('#campaignkeyword', 'MyAwesome&#2<&§Keyword');
await generateUrl();
});
});
});