V14 Added acceptance tests for Relation Types (#15653)
* Fixed failing tests * Updated tests to use the updated helpers * Clean up tests * Enabled our pipeline for E2E testing * Updated the CMS URl for our E2E tests * Bumped version of our testHelpers * Did some fixing, still a bit more to do * Updated auth tests to use LoginUiHelper * Updated Telemetry tests to use TelemetryUiHelper * Updated LogViewer tests to use LogViewerUiHelper * Updated api tests to apply AAA pattern and fix failed tests * Removed unused import * Added api tests for RelationType * Added ui tests for Relation Type * Bumped test helper version * Added api tests for Relation Types * Updated ui tests for Relation types * Updated method due to the test helper changes * Bumped version * Fixed merged * Update tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Relation Types/RelationTypes.spec.ts Added ; Co-authored-by: Andreas Zerbst <73799582+andr317c@users.noreply.github.com> * Update tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Relation Types/RelationTypes.spec.ts Updated name of method Co-authored-by: Andreas Zerbst <73799582+andr317c@users.noreply.github.com> * Update tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Relation Types/RelationTypes.spec.ts Updated name of method Co-authored-by: Andreas Zerbst <73799582+andr317c@users.noreply.github.com> --------- Co-authored-by: Andreas Zerbst <andr317c@live.dk> Co-authored-by: Andreas Zerbst <73799582+andr317c@users.noreply.github.com>
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@umbraco/json-models-builders": "^2.0.1 ",
|
"@umbraco/json-models-builders": "^2.0.1 ",
|
||||||
"@umbraco/playwright-testhelpers": "^2.0.0-beta.12",
|
"@umbraco/playwright-testhelpers": "^2.0.0-beta.17",
|
||||||
"camelize": "^1.0.0",
|
"camelize": "^1.0.0",
|
||||||
"dotenv": "^16.3.1",
|
"dotenv": "^16.3.1",
|
||||||
"faker": "^4.1.0",
|
"faker": "^4.1.0",
|
||||||
@@ -146,9 +146,9 @@
|
|||||||
"integrity": "sha512-9tCqYEDHI5RYFQigXFwF1hnCwcWCOJl/hmll0lr5D2Ljjb0o4wphb69wikeJDz5qCEzXCoPvG6ss5SDP6IfOdg=="
|
"integrity": "sha512-9tCqYEDHI5RYFQigXFwF1hnCwcWCOJl/hmll0lr5D2Ljjb0o4wphb69wikeJDz5qCEzXCoPvG6ss5SDP6IfOdg=="
|
||||||
},
|
},
|
||||||
"node_modules/@umbraco/playwright-testhelpers": {
|
"node_modules/@umbraco/playwright-testhelpers": {
|
||||||
"version": "2.0.0-beta.12",
|
"version": "2.0.0-beta.17",
|
||||||
"resolved": "https://registry.npmjs.org/@umbraco/playwright-testhelpers/-/playwright-testhelpers-2.0.0-beta.12.tgz",
|
"resolved": "https://registry.npmjs.org/@umbraco/playwright-testhelpers/-/playwright-testhelpers-2.0.0-beta.17.tgz",
|
||||||
"integrity": "sha512-2lfFCVOMIfzu+cBOohEyc9dgsW5QnxmbKT4r0pXpB2U7DesASQ7Erg0RScxXnPmcjA+geIJ2bMmg7RhdlgJ/yQ==",
|
"integrity": "sha512-wUaF7AB+x0PHAyfAgGxvBvM+o6QKLcDM6itHjjOJLtnF0Q96JZlZ4wf4d9GcaBdpZkaYq5MBjZtXg8ZSzFFJuw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@umbraco/json-models-builders": "2.0.1",
|
"@umbraco/json-models-builders": "2.0.1",
|
||||||
"camelize": "^1.0.0",
|
"camelize": "^1.0.0",
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@umbraco/json-models-builders": "^2.0.1 ",
|
"@umbraco/json-models-builders": "^2.0.1 ",
|
||||||
"@umbraco/playwright-testhelpers": "^2.0.0-beta.12",
|
"@umbraco/playwright-testhelpers": "^2.0.0-beta.17",
|
||||||
"camelize": "^1.0.0",
|
"camelize": "^1.0.0",
|
||||||
"dotenv": "^16.3.1",
|
"dotenv": "^16.3.1",
|
||||||
"faker": "^4.1.0",
|
"faker": "^4.1.0",
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
import {test} from '@umbraco/playwright-testhelpers';
|
||||||
|
import {expect} from "@playwright/test";
|
||||||
|
|
||||||
|
test.describe('Relation type tests', () => {
|
||||||
|
const relationTypeName = 'Test Relation Type';
|
||||||
|
const objectTypeName = 'Document';
|
||||||
|
let relationTypeId = '';
|
||||||
|
let objectTypeId = '';
|
||||||
|
|
||||||
|
test.beforeEach(async ({umbracoApi}) => {
|
||||||
|
await umbracoApi.relationType.ensureNameNotExists(relationTypeName);
|
||||||
|
objectTypeId = await umbracoApi.objectTypes.getIdByName(objectTypeName);
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterEach(async ({umbracoApi}) => {
|
||||||
|
await umbracoApi.relationType.ensureNameNotExists(relationTypeName);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('can create a relation type', async ({umbracoApi}) => {
|
||||||
|
// Act
|
||||||
|
relationTypeId = await umbracoApi.relationType.create(relationTypeName, false, false, objectTypeId, objectTypeId);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(await umbracoApi.relationType.doesExist(relationTypeId)).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('can update a relation type', async ({umbracoApi}) => {
|
||||||
|
// Arrange
|
||||||
|
const wrongRelationTypeName = 'Updated Relation Type';
|
||||||
|
relationTypeId = await umbracoApi.relationType.create(wrongRelationTypeName, false, false, objectTypeId, objectTypeId);
|
||||||
|
const relationTypeData = await umbracoApi.relationType.get(relationTypeId);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
relationTypeData.name = relationTypeName;
|
||||||
|
await umbracoApi.relationType.update(relationTypeId, relationTypeData);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(await umbracoApi.relationType.doesExist(relationTypeId)).toBeTruthy();
|
||||||
|
// Checks if the relation type name was updated
|
||||||
|
const updatedRelationType = await umbracoApi.relationType.get(relationTypeId);
|
||||||
|
expect(updatedRelationType.name).toEqual(relationTypeName);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('can delete a relation type', async ({umbracoApi}) => {
|
||||||
|
// Arrange
|
||||||
|
relationTypeId = await umbracoApi.relationType.create(relationTypeName, false, false, objectTypeId, objectTypeId);
|
||||||
|
expect(await umbracoApi.relationType.doesExist(relationTypeId)).toBeTruthy();
|
||||||
|
|
||||||
|
//Act
|
||||||
|
await umbracoApi.relationType.delete(relationTypeId);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(await umbracoApi.relationType.doesExist(relationTypeId)).toBeFalsy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
import {test} from '@umbraco/playwright-testhelpers';
|
||||||
|
import {expect} from "@playwright/test";
|
||||||
|
|
||||||
|
test.describe('Relation types tests', () => {
|
||||||
|
const relationTypeName = 'Test Relation Type';
|
||||||
|
const objectTypeName = 'Document';
|
||||||
|
let relationTypeId = '';
|
||||||
|
let objectTypeId = '';
|
||||||
|
|
||||||
|
test.beforeEach(async ({umbracoApi, umbracoUi}) => {
|
||||||
|
await umbracoApi.relationType.ensureNameNotExists(relationTypeName);
|
||||||
|
await umbracoUi.goToBackOffice();
|
||||||
|
await umbracoUi.relationType.goToSettingsTreeItem('Relation Types');
|
||||||
|
objectTypeId = await umbracoApi.objectTypes.getIdByName(objectTypeName);
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterEach(async ({umbracoApi}) => {
|
||||||
|
await umbracoApi.relationType.ensureNameNotExists(relationTypeName);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('can create a relation type', async ({umbracoApi, umbracoUi}) => {
|
||||||
|
// Act
|
||||||
|
await umbracoUi.relationType.clickActionsMenuAtRoot();
|
||||||
|
await umbracoUi.relationType.clickCreateButton();
|
||||||
|
await umbracoUi.relationType.enterRelationTypeName(relationTypeName);
|
||||||
|
await umbracoUi.relationType.selectParentOption(objectTypeName);
|
||||||
|
await umbracoUi.relationType.selectChildOption(objectTypeName);
|
||||||
|
await umbracoUi.relationType.clickSaveButton();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
await umbracoUi.relationType.isSuccessNotificationVisible();
|
||||||
|
expect(await umbracoApi.relationType.doesNameExist(relationTypeName)).toBeTruthy();
|
||||||
|
// TODO: when frontend is ready, verify the new relation type name is displayed in the Relation Types tree
|
||||||
|
});
|
||||||
|
|
||||||
|
test('can update name of a relation type', async ({umbracoApi, umbracoUi}) => {
|
||||||
|
// Arrange
|
||||||
|
const wrongRelationTypeName = 'Updated Relation Type';
|
||||||
|
await umbracoApi.relationType.ensureNameNotExists(wrongRelationTypeName);
|
||||||
|
relationTypeId = await umbracoApi.relationType.create(wrongRelationTypeName, false, false, objectTypeId, objectTypeId);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
await umbracoUi.relationType.openRelationTypeByNameAtRoot(wrongRelationTypeName);
|
||||||
|
await umbracoUi.relationType.enterRelationTypeName(relationTypeName);
|
||||||
|
await umbracoUi.relationType.clickSaveButton();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
await umbracoUi.relationType.isSuccessNotificationVisible();
|
||||||
|
const relationTypeData = await umbracoApi.relationType.get(relationTypeId);
|
||||||
|
expect(relationTypeData.name).toEqual(relationTypeName);
|
||||||
|
expect(await umbracoApi.relationType.doesNameExist(wrongRelationTypeName)).toBeFalsy();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('can update direction value of a relation type', async ({umbracoApi, umbracoUi}) => {
|
||||||
|
// Arrange
|
||||||
|
relationTypeId = await umbracoApi.relationType.create(relationTypeName, false, false, objectTypeId, objectTypeId);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
await umbracoUi.relationType.openRelationTypeByNameAtRoot(relationTypeName);
|
||||||
|
await umbracoUi.relationType.clickBidirectionalRadioButton();
|
||||||
|
await umbracoUi.relationType.clickSaveButton();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
await umbracoUi.relationType.isSuccessNotificationVisible();
|
||||||
|
const relationTypeData = await umbracoApi.relationType.get(relationTypeId);
|
||||||
|
expect(relationTypeData.isBidirectional).toEqual(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('can update isDependency value of a relation type', async ({umbracoApi, umbracoUi}) => {
|
||||||
|
// Arrange
|
||||||
|
const updatedObjectTypeName = 'Media';
|
||||||
|
relationTypeId = await umbracoApi.relationType.create(relationTypeName, false, false, objectTypeId, objectTypeId);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
await umbracoUi.relationType.openRelationTypeByNameAtRoot(relationTypeName);
|
||||||
|
await umbracoUi.relationType.clickIsDependencySlider();
|
||||||
|
await umbracoUi.relationType.clickSaveButton();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
await umbracoUi.relationType.isSuccessNotificationVisible();
|
||||||
|
const relationTypeData = await umbracoApi.relationType.get(relationTypeId);
|
||||||
|
expect(relationTypeData.isDependency).toEqual(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('can delete a relation type', async ({umbracoApi, umbracoUi}) => {
|
||||||
|
// Arrange
|
||||||
|
await umbracoApi.relationType.create(relationTypeName, false, false, objectTypeId, objectTypeId);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
await umbracoUi.relationType.clickRootFolderCaretButton();
|
||||||
|
await umbracoUi.relationType.clickActionsMenuForRelationType(relationTypeName);
|
||||||
|
await umbracoUi.relationType.clickDeleteExactLabel();
|
||||||
|
await umbracoUi.relationType.clickConfirmToDeleteButton();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
await umbracoUi.relationType.isSuccessNotificationVisible();
|
||||||
|
expect(await umbracoApi.relationType.doesNameExist(relationTypeName)).toBeFalsy();
|
||||||
|
// TODO: when frontend is ready, verify the deleted relation type name is NOT displayed in the Relation Types tree
|
||||||
|
});
|
||||||
|
|
||||||
|
test.skip('can show relations of a relation type', async ({umbracoApi, umbracoUi}) => {
|
||||||
|
// TODO: implement this later as the frontend is missing now
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user