Welcome to mirror list, hosted at ThFree Co, Russian Federation.

FeedbackQuestion_spec.js « UI « tests « Feedback « plugins - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 70528468ff58a217d2fe6ab8b0b726f6e92bfec7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*!
 * Matomo - free/libre analytics platform
 *
 * UsersManager screenshot tests.
 *
 * @link https://matomo.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */

describe('FeedbackQuestion', function () {
  this.timeout(0);
  this.fixture = 'Piwik\\Plugins\\Feedback\\tests\\Fixtures\\FeedbackQuestionBannerFixture';

  var url = '?module=CoreHome&action=index&idSite=1&period=day&date=2019-07-11&forceFeedbackTest=1';

  it('should display question banner', async function () {
    await page.setCookie({
      name: 'feedback-question',
      value: '0',
      expire: '3600',
      'url': 'http://localhost/tests/PHPUnit/proxy/' + url,
    });
    await page.goto(url);
    await page.waitForNetworkIdle();

    var banner = await page.waitForSelector('.bannerHeader', { visible: true });
    expect(await banner.screenshot()).to.matchImage('feedback_banner');
  });

  it('should display popup when banner button is clicked', async function () {
    await page.click('.bannerHeader .btn');
    await page.waitForNetworkIdle();

    var popup = await page.waitForSelector('.modal', { visible: true });
    expect(await popup.screenshot()).to.matchImage('feedback_popup');
  });

  it('should show error when blank content submit', async function () {
    await page.click('.modal .modal-footer a:nth-child(1)');
    await page.waitForNetworkIdle();
    var popup = await page.waitForSelector('.modal.open', { visible: true });
    expect(await popup.screenshot()).to.matchImage('feedback_failed');
  });

  it('should show success when banner is submit', async function () {
    await page.type('#message', 'test content, do not send emails');
    await page.click('.modal .modal-footer a:nth-child(1)');
    await page.waitForNetworkIdle();
    var popup = await page.waitForSelector('.modal.open', { visible: true });
    expect(await popup.screenshot()).to.matchImage('feedback_success');
  });
});