From 437db52e5e2e1077f0df8aa75e66ce9827c5e22f Mon Sep 17 00:00:00 2001 From: Andreas Zerbst <73799582+andr317c@users.noreply.github.com> Date: Mon, 26 Jun 2023 15:05:50 +0200 Subject: [PATCH] Added UI acceptance for the telemetry section (#14456) * Added auth to gitignore * Added a setup for logging in which allows us to save the token for the user * Added simple acceptance test for testing our api for the DataTypes * Added simple acceptance tests for testing the API for the PartialView section * Added simple acceptance tests for testing the API for the Script section * Added acceptance tests for testing the API for the Stylesheet section. * Added acceptance tests for testing the API for the User section * Bumped the version of our testhelpers! * Added acceptance tests for testing the API for the Dictionary section. * Added acceptance tests for testing the API for the Language section. * Added acceptance tests for testing the API for the UserGroups section. * Added acceptance tests for testing the API for the Template section * Added acceptance tests for testing the API for the TemporaryFiles section * Our first UI test for v14 Added acceptance tests for the telemetry section * Removed page.pause --- .../tests/DefaultConfig/Telemetry.spec.ts | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Telemetry.spec.ts diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Telemetry.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Telemetry.spec.ts new file mode 100644 index 0000000000..068a8a53c3 --- /dev/null +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Telemetry.spec.ts @@ -0,0 +1,32 @@ +import {test} from '@umbraco/playwright-testhelpers'; +import {expect} from "@playwright/test"; + +test.describe('Telemetry tests', () => { + + test.beforeEach(async ({page, umbracoApi}, testInfo) => { + await umbracoApi.telemetry.setTelemetryLevel("Basic"); + }); + + test.afterEach(async ({page, umbracoApi}, testInfo) => { + await umbracoApi.telemetry.setTelemetryLevel("Basic"); + }); + + test('can change telemetry level', async ({page, umbracoApi, umbracoUi}) => { + const expectedLevel = "Minimal"; + + await page.goto(umbracoApi.baseUrl + '/umbraco'); + + // Selects minimal as the telemetry level + await page.getByRole('tab', { name: 'Settings' }).click(); + await page.getByRole('tab', {name: 'Telemetry Data'}).click(); + await page.locator('[name="telemetryLevel"] >> input[id=input]').fill('1'); + await page.getByRole('button', { name: 'Save telemetry settings' }).click(); + + // Assert + // UI + await page.reload(); + await expect(await page.locator('[name="telemetryLevel"] >> input[id=input]')).toHaveValue('1'); + // API + await expect(await umbracoApi.telemetry.checkTelemetryLevel(expectedLevel)).toBeTruthy(); + }); +});