Skip to content

Commit 4b04a13

Browse files
committed
Fix PHPStan snapshot and UI screenshots
1 parent 754051c commit 4b04a13

9 files changed

Lines changed: 28 additions & 32 deletions

phpstan-baseline.neon

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4658,11 +4658,6 @@ parameters:
46584658
count: 1
46594659
path: plugins/ScheduledReports/ScheduledReports.php
46604660

4661-
-
4662-
message: "#^Negated boolean expression is always true\\.$#"
4663-
count: 1
4664-
path: plugins/SegmentEditor/API.php
4665-
46664661
-
46674662
message: "#^Parameter \\#2 \\$idSites of class Piwik\\\\Segment constructor expects array, int\\|null given\\.$#"
46684663
count: 1

plugins/SegmentEditor/tests/UI/SegmentSelectorEditor_spec.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,30 +64,31 @@ describe("SegmentSelectorEditorTest", function () {
6464
});
6565

6666
it("should star all segments", async function() {
67-
await page.click('.segmentList li:nth-child(2) .starSegment');
68-
await page.click('.segmentList li:nth-child(3) .starSegment');
69-
await page.click('.segmentList li:nth-child(4) .starSegment');
70-
const firstSegment = await page.$('.segmentList li:nth-child(2)');
71-
expect(firstSegment.className).to.contain('segmentStarred');
72-
expect(firstSegment.find('.starSegment').attr('data-state')).to.equal('');
67+
const firstSegment = await page.$('.segmentList li:nth-of-type(2)');
68+
const firstSegmentStar = await page.$('.segmentList li:nth-of-type(2) .starSegment');
69+
await firstSegmentStar.click('.segmentList li:nth-of-type(2) .starSegment');
70+
await page.click('.segmentList li:nth-of-type(3) .starSegment');
71+
await page.click('.segmentList li:nth-of-type(4) .starSegment');
72+
expect(firstSegment.attr('class')).to.match(/segmentStarred/);
73+
expect(firstSegmentStar.attr('data-state')).to.equal('');
7374
expect(await page.screenshotSelector(selectorsToCapture)).to.matchImage('1_selector_starred');
7475
});
7576

7677
it("should unstar first segment", async function() {
77-
await page.click('.segmentList li:nth-child(2) .starSegment');
78-
const firstSegment = await page.$('.segmentList li:nth-child(2)');
79-
expect(firstSegment.className).to.not.contain('segmentStarred');
80-
expect(firstSegment.find('.starSegment').attr('data-state')).to.equal('');
78+
const firstSegment = await page.$('.segmentList li:nth-of-type(2)');
79+
const firstSegmentStar = await page.$('.segmentList li:nth-of-type(2) .starSegment');
80+
await firstSegmentStar.click('.segmentList li:nth-of-type(2) .starSegment');
81+
expect(firstSegment.attr('class')).to.not.match(/segmentStarred/);
82+
expect(firstSegmentStar.attr('data-state')).to.equal('');
8183
expect(await page.screenshotSelector(selectorsToCapture)).to.matchImage('1b_selector_unstarred');
8284
});
8385

8486
it("should have disabled star for anonymous users", async function() {
8587
await switchToAnonymousUser();
8688
await page.goto(url);
8789
await page.click('.segmentationContainer .title');
88-
const firstSegment = await page.$('.segmentList li:nth-child(2)');
89-
expect(firstSegment.className).to.contain('segmentStarred');
90-
expect(firstSegment.find('.starSegment').attr('data-state')).to.equal('');
90+
const firstSegmentStar = await page.$('.segmentList li:nth-of-type(2) .starSegment');
91+
expect(firstSegmentStar.attr('data-state')).to.equal('disabled');
9192
});
9293

9394
it("should open segment editor when edit link clicked for existing segment", async function() {
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading

0 commit comments

Comments
 (0)