File: FeedbackQuestion_spec.js

package info (click to toggle)
matomo 5.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 95,068 kB
  • sloc: php: 289,425; xml: 127,249; javascript: 112,130; python: 202; sh: 178; makefile: 20; sql: 10
file content (51 lines) | stat: -rw-r--r-- 1,916 bytes parent folder | download
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
/*!
 * 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('FeedbackQuestion', function () {
  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');
  });
});