V14 Added acceptance tests for Dashboard (#15748)

* Added tests for Examine Management tab

* Added tests for Heath Check

* Added tests for Models Builder

* Added tests for Profiling

* Added tests for Published Status

* Bumped version

* Added tests for Welcome Dashboard

* Updated test name

* Bumped version of test helper

* Bumped version of test helpers

* Replace " with '
This commit is contained in:
Nhu Dinh
2024-02-28 14:40:54 +07:00
committed by GitHub
parent 2494d8c5aa
commit cc6ebf35fb
6 changed files with 231 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
import { expect } from '@playwright/test';
import {ConstantHelper, test} from '@umbraco/playwright-testhelpers';
test.describe('Examine Management Dashboard tests', () => {
test.beforeEach(async ({umbracoUi}) => {
await umbracoUi.goToBackOffice();
await umbracoUi.examineManagement.goToSection(ConstantHelper.sections.settings);
await umbracoUi.examineManagement.clickExamineManagementTab();
});
test('can view indexers information', async ({umbracoApi, umbracoUi}) => {
// Arrange
const allIndexersData = await umbracoApi.indexer.getAll();
const indexerCount = allIndexersData.total;
// Assert
allIndexersData.items.forEach(async index => {
await umbracoUi.examineManagement.doesIndexersHaveText(index.name);
});
expect(await umbracoUi.examineManagement.checkIndexersCount()).toBe(indexerCount);
});
test('can view the details of an index', async ({umbracoApi, umbracoUi}) => {
// Arrange
const allIndexersData = await umbracoApi.indexer.getAll();
const indexName = allIndexersData.items[0].name;
const indexData = await umbracoApi.indexer.getByIndexName(indexName);
// Act
await umbracoUi.examineManagement.clickIndexByName(indexName);
// Assert
await umbracoUi.examineManagement.doesIndexHaveHealthStatus(indexName, indexData.healthStatus);
await umbracoUi.examineManagement.doesIndexPropertyHaveValue('documentCount', indexData.documentCount.toString());
await umbracoUi.examineManagement.doesIndexPropertyHaveValue('fieldCount', indexData.fieldCount.toString());
await umbracoUi.examineManagement.doesIndexPropertyHaveValue('CommitCount', indexData.providerProperties.CommitCount.toString());
await umbracoUi.examineManagement.doesIndexPropertyHaveValue('DefaultAnalyzer', indexData.providerProperties.DefaultAnalyzer);
await umbracoUi.examineManagement.doesIndexPropertyHaveValue('LuceneDirectory', indexData.providerProperties.LuceneDirectory);
await umbracoUi.examineManagement.doesIndexPropertyHaveValue('LuceneIndexFolder', indexData.providerProperties.LuceneIndexFolder);
await umbracoUi.examineManagement.doesIndexPropertyHaveValue('DirectoryFactory', indexData.providerProperties.DirectoryFactory);
await umbracoUi.examineManagement.doesIndexPropertyHaveValue('EnableDefaultEventHandler', indexData.providerProperties.EnableDefaultEventHandler.toString());
await umbracoUi.examineManagement.doesIndexPropertyHaveValue('PublishedValuesOnly', indexData.providerProperties.PublishedValuesOnly.toString());
});
});

View File

@@ -0,0 +1,57 @@
import { expect } from '@playwright/test';
import {ConstantHelper, test} from '@umbraco/playwright-testhelpers';
test.describe('Health Check Dashboard tests', () => {
test.beforeEach(async ({umbracoUi}) => {
await umbracoUi.goToBackOffice();
await umbracoUi.healthCheck.goToSection(ConstantHelper.sections.settings);
await umbracoUi.healthCheck.clickHealthCheckTab();
});
test('can perform all health checks', async ({ umbracoApi, umbracoUi }) => {
// Arrange
const allHealthChecksData = await umbracoApi.healthCheck.getAll();
const healthCheckGroupCount = allHealthChecksData.total;
expect(await umbracoUi.healthCheck.checkHealthCheckGroupCount()).toBe(healthCheckGroupCount);
// Act
await umbracoUi.healthCheck.clickPerformanceAllChecksButton();
// Assert
// verify that the number of health check groups is correct
expect(await umbracoUi.healthCheck.checkHealthCheckGroupCount()).toBe(healthCheckGroupCount);
// verify that the details of all health check groups are correct
for (const healthCheck of allHealthChecksData.items) {
await umbracoUi.healthCheck.isHealthCheckGroupVisible(healthCheck.name);
const resultCount = await umbracoApi.healthCheck.getResultsCountByName(healthCheck.name);
if (resultCount.success > 0) {
await umbracoUi.healthCheck.doesHeathCheckGroupHaveSuccessItemsCount(healthCheck.name, resultCount.success);
}
if (resultCount.warning > 0) {
await umbracoUi.healthCheck.doesHeathCheckGroupHaveWarningItemsCount(healthCheck.name, resultCount.warning);
}
if (resultCount.error > 0) {
await umbracoUi.healthCheck.doesHeathCheckGroupHaveErrorItemsCount(healthCheck.name, resultCount.error);
}
}
});
test('can view the details of a health check', async ({ umbracoApi, umbracoUi }) => {
// Arrange
const allHealthChecksData = await umbracoApi.healthCheck.getAll();
if (allHealthChecksData !== undefined) {
const healthCheckName = allHealthChecksData.items[0].name;
const healthCheckData = await umbracoApi.healthCheck.getByName(healthCheckName);
// Act
await umbracoUi.healthCheck.clickHeathCheckGroupByName(healthCheckName);
// Assert
for (const check of healthCheckData.checks) {
await umbracoUi.healthCheck.isCheckNameVisible(check.name);
await umbracoUi.healthCheck.isCheckDescriptionVisible(check.description);
}
}
});
});

View File

@@ -0,0 +1,29 @@
import {ConstantHelper, test} from '@umbraco/playwright-testhelpers';
test.describe('Models Builder Dashboard tests', () => {
test.beforeEach(async ({umbracoUi}) => {
await umbracoUi.goToBackOffice();
await umbracoUi.modelsBuilder.goToSection(ConstantHelper.sections.settings);
await umbracoUi.modelsBuilder.clickModelsBuilderTab();
});
test('can reload models builder dashboard', async ({umbracoApi, umbracoUi}) => {
// Arrange
const modelsBuilderData = await umbracoApi.modelsBuilder.getDashboard();
const expectedVersion = 'Version: ' + modelsBuilderData.version;
const expectedMode = "The ModelsMode is '" + modelsBuilderData.mode + "'";
const expectedModelsNamespace = 'The models namespace is ' + modelsBuilderData.modelsNamespace;
const expectedOutOfDateModels = modelsBuilderData.outOfDateModels ? 'Tracking of out-of-date models is enabled' : 'Tracking of out-of-date models is not enabled';
// Act
await umbracoUi.modelsBuilder.clickReloadButton();
// Assert
await umbracoUi.modelsBuilder.isSuccessButtonWithTextVisible('Reload');
await umbracoUi.modelsBuilder.doesModelsBuilderDashboardHaveText(expectedVersion);
await umbracoUi.modelsBuilder.doesModelsBuilderDashboardHaveText(expectedMode);
await umbracoUi.modelsBuilder.doesModelsBuilderDashboardHaveText(expectedModelsNamespace);
await umbracoUi.modelsBuilder.doesModelsBuilderDashboardHaveText(expectedOutOfDateModels);
});
});

View File

@@ -0,0 +1,20 @@
import {ConstantHelper, test} from '@umbraco/playwright-testhelpers';
test.describe('Profiling Dashboard tests', () => {
test.beforeEach(async ({umbracoUi}) => {
await umbracoUi.goToBackOffice();
await umbracoUi.profiling.goToSection(ConstantHelper.sections.settings);
await umbracoUi.profiling.clickProfilingTab();
});
// TODO: Remove .skip when frontend is ready. Currently the value of active the profiler by default is not updated after reloading the page
test.skip('can update value of activate the profiler by default', async ({umbracoUi}) => {
// Act
await umbracoUi.profiling.clickActivateProfilerByDefaultSlider();
await umbracoUi.reloadPage();
// Assert
await umbracoUi.profiling.isActivateProfilerByDefaultSliderChecked(true);
});
});

View File

@@ -0,0 +1,50 @@
import {ConstantHelper, test} from '@umbraco/playwright-testhelpers';
test.describe('Published Status Dashboard tests', () => {
test.beforeEach(async ({umbracoUi}) => {
await umbracoUi.goToBackOffice();
await umbracoUi.publishedStatus.goToSection(ConstantHelper.sections.settings);
await umbracoUi.publishedStatus.clickPublishedStatusTab();
});
test('can view and refresh published cache status', async ({umbracoApi, umbracoUi}) => {
// Arrange
const expectedStatus = await umbracoApi.publishedCache.getStatus();
// Act
await umbracoUi.publishedStatus.clickRefreshStatusButton();
// Assert
await umbracoUi.publishedStatus.isSuccessButtonWithTextVisible('Refresh Status');
await umbracoUi.publishedStatus.isPublishedCacheStatusVisible(expectedStatus);
});
test('can reload the memory cache', async ({umbracoUi}) => {
// Act
await umbracoUi.publishedStatus.clickReloadMemoryCacheButton();
await umbracoUi.publishedStatus.clickContinueButton();
// Assert
await umbracoUi.publishedStatus.isSuccessButtonWithTextVisible('Reload Memory Cache');
});
test('can rebuild the database cache', async ({umbracoUi}) => {
// Act
await umbracoUi.publishedStatus.clickRebuildDatabaseCacheButton();
await umbracoUi.publishedStatus.clickContinueButton();
// Assert
await umbracoUi.publishedStatus.isSuccessButtonWithTextVisible('Rebuild Database Cache');
});
test('can snapshot internal cache', async ({umbracoUi}) => {
// Act
await umbracoUi.publishedStatus.clickSnapshotInternalCacheButton();
await umbracoUi.publishedStatus.clickContinueButton();
// Assert
await umbracoUi.publishedStatus.isSuccessButtonWithTextVisible('Snapshot Internal Cache');
});
});

View File

@@ -0,0 +1,30 @@
import {ConstantHelper, test} from '@umbraco/playwright-testhelpers';
test.describe('Welcome Dashboard tests', () => {
test.beforeEach(async ({umbracoUi}) => {
await umbracoUi.goToBackOffice();
await umbracoUi.welcomeDashboard.goToSection(ConstantHelper.sections.settings);
});
test('can click on buttons', async ({umbracoUi}) => {
// Arrange
const getTheHelpYouNeedDocumentationUrl = 'https://docs.umbraco.com/umbraco-cms/umbraco-cms';
const goToTheForumUrl = 'https://our.umbraco.com/forum';
const chatWithTheCommunityUrl = 'https://discord.umbraco.com';
const getCertifiedUrl = 'https://umbraco.com/training/';
const getTheHelpYouNeedSupportUrl = 'https://umbraco.com/support/';
const watchTheVideosUrl = 'https://www.youtube.com/c/UmbracoLearningBase';
// Act
await umbracoUi.welcomeDashboard.clickWelcomeTab();
// Assert
await umbracoUi.welcomeDashboard.doesButtonWithLabelInBoxHaveLink('Get the help you need', 'Documentation', getTheHelpYouNeedDocumentationUrl);
await umbracoUi.welcomeDashboard.doesButtonWithLabelInBoxHaveLink('Go to the forum', 'Community', goToTheForumUrl);
await umbracoUi.welcomeDashboard.doesButtonWithLabelInBoxHaveLink('Chat with the community', 'Community', chatWithTheCommunityUrl);
await umbracoUi.welcomeDashboard.doesButtonWithLabelInBoxHaveLink('Get Certified', 'Training', getCertifiedUrl);
await umbracoUi.welcomeDashboard.doesButtonWithLabelInBoxHaveLink('Get the help you need', 'Support', getTheHelpYouNeedSupportUrl);
await umbracoUi.welcomeDashboard.doesButtonWithLabelInBoxHaveLink('Watch the videos', 'Videos', watchTheVideosUrl);
});
});