1
0
قرینه از https://github.com/matomo-org/matomo.git synced 2025-08-24 16:07:37 +00:00
Files
matomo/plugins/Feedback/tests/UI/RateFeature_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

89 خطوط
2.7 KiB
JavaScript

/*!
* Matomo - free/libre analytics platform
*
* UsersManager screenshot tests.
*
* @link https://matomo.org
* @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
describe("RateFeature", function () {
this.timeout(0);
var url = "?module=CoreHome&action=index&idSite=1&period=day&date=yesterday#?idSite=1&period=day&date=yesterday&segment=&category=General_Visitors&subcategory=General_Overview";
before(async function() {
await page.webpage.setViewport({
width: 1250,
height: 768
});
});
it('should display the like feature popup', async function () {
await page.goto(url);
await page.waitForNetworkIdle();
const like = await page.$('.like-icon');
await like.evaluate(b => b.click());
var modal = await page.waitForSelector('.modal.open', { visible: true });
await page.waitForTimeout(1000);
expect(await modal.screenshot()).to.matchImage('rate_feature_like_questions');
});
it('should accept like feedback', async function () {
const useful = await page.$('#useful');
await useful.evaluate(b => b.click());
await page.type('#feedbacktext', 'test');
const submit = await page.$('a.modal-action:nth-child(1)');
await submit.click();
await page.waitForNetworkIdle();
var modal = await page.waitForSelector('.modal.open', { visible: true });
expect(await modal.screenshot()).to.matchImage('rate_feature_like_submit');
});
it('should display the dislike feature popup', async function () {
await page.goto(url);
await page.waitForNetworkIdle();
const like = await page.$('.dislike-icon');
await like.evaluate(b => b.click());
var modal = await page.waitForSelector('.modal.open', { visible: true });
await page.waitForTimeout(1000);
expect(await modal.screenshot()).to.matchImage('rate_feature_dislike_questions');
});
it('should accept dislike feedback', async function () {
const useful = await page.$('#missingfeatures');
await useful.evaluate(b => b.click());
await page.type('#feedbacktext', 'test');
const submit = await page.$('a.modal-action:nth-child(1)');
await submit.click();
await page.waitForNetworkIdle();
var modal = await page.waitForSelector('.modal.open', { visible: true });
expect(await modal.screenshot()).to.matchImage('rate_feature_dislike_submit');
});
function delay(interval) {
return it('should delay', done =>
{
setTimeout(() => done(), interval)
}).timeout(interval + 100);
}
});