From 82b4f7b23f830d8353737648f9e9cf75a0cc404d Mon Sep 17 00:00:00 2001 From: Jacob Ransom Date: Wed, 27 Nov 2024 17:28:10 +1300 Subject: [PATCH] Adding UI test cases around new feature --- tests/UI/ContainerTrigger_spec.js | 45 +++++++++++++++++++ ...rTrigger_copy_trigger_container_select.png | 3 ++ ...rigger_copy_trigger_container_selected.png | 3 ++ .../ContainerTrigger_copy_trigger_dialog.png | 3 ++ ...tainerTrigger_copy_trigger_site_select.png | 3 ++ ...inerTrigger_copy_trigger_site_selected.png | 3 ++ .../ContainerTrigger_copy_trigger_success.png | 3 ++ 7 files changed, 63 insertions(+) create mode 100644 tests/UI/expected-screenshots/ContainerTrigger_copy_trigger_container_select.png create mode 100644 tests/UI/expected-screenshots/ContainerTrigger_copy_trigger_container_selected.png create mode 100644 tests/UI/expected-screenshots/ContainerTrigger_copy_trigger_dialog.png create mode 100644 tests/UI/expected-screenshots/ContainerTrigger_copy_trigger_site_select.png create mode 100644 tests/UI/expected-screenshots/ContainerTrigger_copy_trigger_site_selected.png create mode 100644 tests/UI/expected-screenshots/ContainerTrigger_copy_trigger_success.png diff --git a/tests/UI/ContainerTrigger_spec.js b/tests/UI/ContainerTrigger_spec.js index a38972425..2e8835306 100644 --- a/tests/UI/ContainerTrigger_spec.js +++ b/tests/UI/ContainerTrigger_spec.js @@ -257,4 +257,49 @@ describe("ContainerTrigger", function () { await page.waitForTimeout(250); await capture.page(page, 'create_new_long_name'); }); + + it('should show dialog to copy trigger', async function () { + await page.goto(container1Base); + await clickFirstRowTableAction('icon-content-copy', 3); + await page.waitForNetworkIdle(); + pageWrap = await page.waitForSelector('div.ui-dialog.mtmCopyTrigger'); + expect(await pageWrap.screenshot()).to.matchImage('copy_trigger_dialog'); + }); + + it('should show list of containers to copy trigger to', async function () { + await page.evaluate(() => $('div.matomo-field-select div.select-wrapper input.dropdown-trigger')[0].click()); + await page.waitForTimeout(250); + pageWrap = await page.waitForSelector('div.ui-dialog.mtmCopyTrigger'); + expect(await pageWrap.screenshot()).to.matchImage('copy_trigger_container_select'); + }); + + it('should select container to copy trigger to', async function () { + await page.evaluate(() => $('div.matomo-field-select ul li:first').click()); + await page.waitForTimeout(250); + pageWrap = await page.waitForSelector('div.ui-dialog.mtmCopyTrigger'); + expect(await pageWrap.screenshot()).to.matchImage('copy_trigger_container_selected'); + }); + + it('should show list of sites to copy trigger to', async function () { + await page.click('#destinationSite'); + await page.waitForTimeout(250); + pageWrap = await page.waitForSelector('div.ui-dialog.mtmCopyTrigger'); + expect(await pageWrap.screenshot()).to.matchImage('copy_trigger_site_select'); + }); + + it('should select site to copy trigger to', async function () { + await page.evaluate(() => $('#destinationSite ul li:first').click()); + await page.waitForTimeout(250); + pageWrap = await page.waitForSelector('div.ui-dialog.mtmCopyTrigger'); + expect(await pageWrap.screenshot()).to.matchImage('copy_trigger_site_selected'); + }); + + it('should be able to copy trigger', async function () { + await page.goto(container1Base); + await clickFirstRowTableAction('icon-content-copy', 3); + await page.waitForNetworkIdle(); + await page.evaluate(() => $('div.copyMtmObjectDialog button.btn').click()); + await page.waitForNetworkIdle(); + await capture.page(page, 'copy_trigger_success'); + }); }); diff --git a/tests/UI/expected-screenshots/ContainerTrigger_copy_trigger_container_select.png b/tests/UI/expected-screenshots/ContainerTrigger_copy_trigger_container_select.png new file mode 100644 index 000000000..e89cbf9cf --- /dev/null +++ b/tests/UI/expected-screenshots/ContainerTrigger_copy_trigger_container_select.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f54922010f1bc00ff5441ab0ba8581d04f5e738757ccd84bea4dfb71aba2acf3 +size 20974 diff --git a/tests/UI/expected-screenshots/ContainerTrigger_copy_trigger_container_selected.png b/tests/UI/expected-screenshots/ContainerTrigger_copy_trigger_container_selected.png new file mode 100644 index 000000000..1df32b068 --- /dev/null +++ b/tests/UI/expected-screenshots/ContainerTrigger_copy_trigger_container_selected.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c55c61508ca3a758c9a17347cf804ea9ce5e278301727f850322d4e0a969978f +size 29335 diff --git a/tests/UI/expected-screenshots/ContainerTrigger_copy_trigger_dialog.png b/tests/UI/expected-screenshots/ContainerTrigger_copy_trigger_dialog.png new file mode 100644 index 000000000..679156757 --- /dev/null +++ b/tests/UI/expected-screenshots/ContainerTrigger_copy_trigger_dialog.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:12e6ab3f40c190e449c44f2a92c5cd76b3fd5030f79a6e8967c98a55f6d5250b +size 27610 diff --git a/tests/UI/expected-screenshots/ContainerTrigger_copy_trigger_site_select.png b/tests/UI/expected-screenshots/ContainerTrigger_copy_trigger_site_select.png new file mode 100644 index 000000000..c71283108 --- /dev/null +++ b/tests/UI/expected-screenshots/ContainerTrigger_copy_trigger_site_select.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6266c463650fbe0d05bca53f03bc1712a86903db1c9f54c843966ab82e03d7e7 +size 31439 diff --git a/tests/UI/expected-screenshots/ContainerTrigger_copy_trigger_site_selected.png b/tests/UI/expected-screenshots/ContainerTrigger_copy_trigger_site_selected.png new file mode 100644 index 000000000..7af292dff --- /dev/null +++ b/tests/UI/expected-screenshots/ContainerTrigger_copy_trigger_site_selected.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e9bffdccc48da83f80cc6861a05527895ad1872c0cbd8222ce223052a67339f0 +size 28121 diff --git a/tests/UI/expected-screenshots/ContainerTrigger_copy_trigger_success.png b/tests/UI/expected-screenshots/ContainerTrigger_copy_trigger_success.png new file mode 100644 index 000000000..a49727c2c --- /dev/null +++ b/tests/UI/expected-screenshots/ContainerTrigger_copy_trigger_success.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:17a3977445e9c9edaa8981a070a14d0872ad59bde50b55b3489e1a8d52e9ecc1 +size 141047