diff options
author | Stefan Giehl <stefan@matomo.org> | 2021-10-19 21:57:25 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-19 21:57:25 +0300 |
commit | c1b874bc6f40549e02fe36c5dc5474806ca3a1ae (patch) | |
tree | d39a962a6462918e459fa6a3a71214cfc1e05e74 /plugins/SegmentEditor/tests | |
parent | c15d8dbf98890bf18be7f7cf398e02b994264682 (diff) |
Fix segment creation fails when enable_create_realtime_segments = 0 (#18181)
Diffstat (limited to 'plugins/SegmentEditor/tests')
2 files changed, 34 insertions, 0 deletions
diff --git a/plugins/SegmentEditor/tests/UI/SegmentSelectorEditor_spec.js b/plugins/SegmentEditor/tests/UI/SegmentSelectorEditor_spec.js index 5e9032d7d0..0c3a9e7bd0 100644 --- a/plugins/SegmentEditor/tests/UI/SegmentSelectorEditor_spec.js +++ b/plugins/SegmentEditor/tests/UI/SegmentSelectorEditor_spec.js @@ -283,4 +283,35 @@ describe("SegmentSelectorEditorTest", function () { await page.waitForNetworkIdle(); expect(await page.screenshotSelector(selectorsToCapture)).to.matchImage('enabled_create_realtime_segments'); }); + + it("should save a new segment when enable_create_realtime_segments = 0", async function() { + // ensure segment won't be archived after saving it. + testEnvironment.overrideConfig('General', 'enable_create_realtime_segments', 0); + testEnvironment.overrideConfig('General', 'enable_browser_archiving_triggering', 0); + testEnvironment.overrideConfig('General', 'browser_archiving_disabled_enforce', 1); + testEnvironment.optionsOverride = { + enableBrowserTriggerArchiving: '0', + }; + testEnvironment.save(); + await page.evaluate(function () { + $('.segmentRow0 .segment-row:first .metricValueBlock input').val('3').change(); + }); + + await page.type('input.edit_segment_name', 'auto archive segment'); + await page.click('.segmentRow0 .segment-or'); // click somewhere else to save new name + + // this is for debug purpose. If segment can't be saved, and alert might be shown, causing the UI test to hang + page.on('dialog', (dialog)=> { + console.log(dialog.message()); + }); + + await page.evaluate(function () { + $('button.saveAndApply').click(); + }); + await page.waitForNetworkIdle(); + await page.waitForSelector('.segmentationContainer'); + + await page.click('.segmentationContainer .title'); + expect(await page.screenshotSelector(selectorsToCapture)).to.matchImage('enabled_create_realtime_segments_saved'); + }); }); diff --git a/plugins/SegmentEditor/tests/UI/expected-screenshots/SegmentSelectorEditorTest_enabled_create_realtime_segments_saved.png b/plugins/SegmentEditor/tests/UI/expected-screenshots/SegmentSelectorEditorTest_enabled_create_realtime_segments_saved.png new file mode 100644 index 0000000000..0ffb486a39 --- /dev/null +++ b/plugins/SegmentEditor/tests/UI/expected-screenshots/SegmentSelectorEditorTest_enabled_create_realtime_segments_saved.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aa78bbd9964683cb66588f231ad36130af914fd1ac7393fd311eca9eeafe084a +size 20327 |