V15 QA Updated acceptance tests for Link Picker (#18231)
* Added tests to ensure that the empty link is not accepted in url picker * Added tests to ensure that the empty link is not accepted in tiptap * Updated link picker tests due to UX changes * Cleaned up * Make Content tests run in the pipeline * Added tests for unpublished document * Fixed comments * Bumped version * Cleaned up * Updated test name * Reverted * Bumped version
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"@umbraco/json-models-builders": "^2.0.27",
|
||||
"@umbraco/playwright-testhelpers": "^15.0.16",
|
||||
"@umbraco/playwright-testhelpers": "^15.0.17",
|
||||
"camelize": "^1.0.0",
|
||||
"dotenv": "^16.3.1",
|
||||
"node-fetch": "^2.6.7"
|
||||
@@ -66,9 +66,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@umbraco/playwright-testhelpers": {
|
||||
"version": "15.0.16",
|
||||
"resolved": "https://registry.npmjs.org/@umbraco/playwright-testhelpers/-/playwright-testhelpers-15.0.16.tgz",
|
||||
"integrity": "sha512-n/zG/ZHv/nE88qrSFnOCkKDyKjVqprSd2R2LBvkk3bkDtj5V7TV8ZzeiBb03UXEAw+FBiYsuS14XgT1jOhmJ8Q==",
|
||||
"version": "15.0.17",
|
||||
"resolved": "https://registry.npmjs.org/@umbraco/playwright-testhelpers/-/playwright-testhelpers-15.0.17.tgz",
|
||||
"integrity": "sha512-DRNWWzGB16is+J1sqT8+yOobuN2d9mshRfXRDtkaEVRahPpkYBfR1Mjv0DofBkheB2cAlvdvPsBUopzE6bMKSQ==",
|
||||
"dependencies": {
|
||||
"@umbraco/json-models-builders": "2.0.28",
|
||||
"node-fetch": "^2.6.7"
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@umbraco/json-models-builders": "^2.0.27",
|
||||
"@umbraco/playwright-testhelpers": "^15.0.16",
|
||||
"@umbraco/playwright-testhelpers": "^15.0.17",
|
||||
"camelize": "^1.0.0",
|
||||
"dotenv": "^16.3.1",
|
||||
"node-fetch": "^2.6.7"
|
||||
|
||||
@@ -264,3 +264,134 @@ test('can edit the URL picker in the content', async ({umbracoApi, umbracoUi}) =
|
||||
expect(contentData.values[0].value[0].name).toEqual(updatedLinkTitle);
|
||||
expect(contentData.values[0].value[0].url).toEqual(link);
|
||||
});
|
||||
|
||||
test('cannot submit an empty link', async ({umbracoApi, umbracoUi}) => {
|
||||
// Arrange
|
||||
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName);
|
||||
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id);
|
||||
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId);
|
||||
await umbracoUi.goToBackOffice();
|
||||
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
|
||||
|
||||
// Act
|
||||
await umbracoUi.content.goToContentWithName(contentName);
|
||||
await umbracoUi.content.clickAddMultiURLPickerButton();
|
||||
await umbracoUi.content.clickManualLinkButton();
|
||||
await umbracoUi.content.enterLink('');
|
||||
await umbracoUi.content.enterAnchorOrQuerystring('');
|
||||
await umbracoUi.content.enterLinkTitle('');
|
||||
await umbracoUi.content.clickAddButton();
|
||||
|
||||
// Assert
|
||||
await umbracoUi.content.isTextWithMessageVisible(ConstantHelper.validationMessages.emptyLinkPicker);
|
||||
});
|
||||
|
||||
test('cannot update the URL picker with an empty link', async ({umbracoApi, umbracoUi}) => {
|
||||
// Arrange
|
||||
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName);
|
||||
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id);
|
||||
await umbracoApi.document.createDocumentWithExternalLinkURLPicker(contentName, documentTypeId, link, linkTitle);
|
||||
await umbracoUi.goToBackOffice();
|
||||
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
|
||||
|
||||
// Act
|
||||
await umbracoUi.content.goToContentWithName(contentName);
|
||||
await umbracoUi.content.clickLinkWithName(linkTitle);
|
||||
await umbracoUi.content.enterLink('');
|
||||
await umbracoUi.content.enterAnchorOrQuerystring('');
|
||||
await umbracoUi.content.enterLinkTitle('');
|
||||
await umbracoUi.content.clickUpdateButton();
|
||||
|
||||
// Assert
|
||||
await umbracoUi.content.isTextWithMessageVisible(ConstantHelper.validationMessages.emptyLinkPicker);
|
||||
});
|
||||
|
||||
// TODO: Remove skip when the front-end ready. Currently it still accept the empty link with an anchor or querystring
|
||||
// Issue link: https://github.com/umbraco/Umbraco-CMS/issues/17411
|
||||
test.skip('cannot submit an empty URL with an anchor or query', async ({umbracoApi, umbracoUi}) => {
|
||||
// Arrange
|
||||
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName);
|
||||
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id);
|
||||
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId);
|
||||
await umbracoUi.goToBackOffice();
|
||||
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
|
||||
|
||||
// Act
|
||||
await umbracoUi.content.goToContentWithName(contentName);
|
||||
await umbracoUi.content.clickAddMultiURLPickerButton();
|
||||
await umbracoUi.content.clickManualLinkButton();
|
||||
await umbracoUi.content.enterLink('');
|
||||
await umbracoUi.content.enterAnchorOrQuerystring('#value');
|
||||
await umbracoUi.content.clickAddButton();
|
||||
|
||||
// Assert
|
||||
await umbracoUi.content.isTextWithMessageVisible(ConstantHelper.validationMessages.emptyLinkPicker);
|
||||
});
|
||||
|
||||
// TODO: Remove skip when the front-end ready. Currently it still accept the empty link using spacebar
|
||||
// Issue link: https://github.com/umbraco/Umbraco-CMS/issues/17411
|
||||
test.skip('cannot submit an empty link using spacebar', async ({umbracoApi, umbracoUi}) => {
|
||||
// Arrange
|
||||
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName);
|
||||
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id);
|
||||
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId);
|
||||
await umbracoUi.goToBackOffice();
|
||||
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
|
||||
|
||||
// Act
|
||||
await umbracoUi.content.goToContentWithName(contentName);
|
||||
await umbracoUi.content.clickAddMultiURLPickerButton();
|
||||
await umbracoUi.content.clickManualLinkButton();
|
||||
await umbracoUi.content.enterLink('Space', true);
|
||||
await umbracoUi.content.enterAnchorOrQuerystring('Space', true);
|
||||
await umbracoUi.content.enterLinkTitle('Space', true);
|
||||
await umbracoUi.content.clickAddButton();
|
||||
|
||||
// Assert
|
||||
await umbracoUi.content.isTextWithMessageVisible(ConstantHelper.validationMessages.emptyLinkPicker);
|
||||
});
|
||||
|
||||
// TODO: Remove skip when the front-end ready. Currently it is impossible to link to unpublished document
|
||||
// Issue link: https://github.com/umbraco/Umbraco-CMS/issues/17974
|
||||
test.skip('can create content with the link to an unpublished document', async ({umbracoApi, umbracoUi}) => {
|
||||
// Arrange
|
||||
const expectedState = 'Draft';
|
||||
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName);
|
||||
await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id);
|
||||
// Create a document to link
|
||||
const documentTypeForLinkedDocumentName = 'TestDocumentType';
|
||||
const documentTypeForLinkedDocumentId = await umbracoApi.documentType.createDefaultDocumentTypeWithAllowAsRoot(documentTypeForLinkedDocumentName);
|
||||
const linkedDocumentName = 'LinkedDocument';
|
||||
const linkedDocumentId = await umbracoApi.document.createDefaultDocument(linkedDocumentName, documentTypeForLinkedDocumentId);
|
||||
await umbracoUi.goToBackOffice();
|
||||
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
|
||||
|
||||
// Act
|
||||
await umbracoUi.content.clickActionsMenuAtRoot();
|
||||
await umbracoUi.content.clickCreateButton();
|
||||
await umbracoUi.content.chooseDocumentType(documentTypeName);
|
||||
await umbracoUi.content.enterContentName(contentName);
|
||||
await umbracoUi.content.clickAddMultiURLPickerButton();
|
||||
await umbracoUi.content.clickDocumentLinkButton();
|
||||
await umbracoUi.content.selectLinkByName(linkedDocumentName);
|
||||
await umbracoUi.content.clickButtonWithName('Choose');
|
||||
await umbracoUi.content.clickAddButton();
|
||||
await umbracoUi.content.clickSaveButton();
|
||||
|
||||
// Assert
|
||||
await umbracoUi.content.isSuccessNotificationVisible();
|
||||
expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy();
|
||||
const contentData = await umbracoApi.document.getByName(contentName);
|
||||
expect(contentData.variants[0].state).toBe(expectedState);
|
||||
expect(contentData.values[0].alias).toEqual(AliasHelper.toAlias(dataTypeName));
|
||||
expect(contentData.values[0].value.length).toBe(1);
|
||||
expect(contentData.values[0].value[0].type).toEqual('document');
|
||||
expect(contentData.values[0].value[0].icon).toEqual('icon-document');
|
||||
expect(contentData.values[0].value[0].target).toBeNull();
|
||||
expect(contentData.values[0].value[0].unique).toEqual(linkedDocumentId);
|
||||
expect(contentData.values[0].value[0].name).toEqual(linkedDocumentName);
|
||||
|
||||
// Clean
|
||||
await umbracoApi.documentType.ensureNameNotExists(documentTypeForLinkedDocumentName);
|
||||
await umbracoApi.document.ensureNameNotExists(linkedDocumentName);
|
||||
});
|
||||
|
||||
@@ -141,3 +141,78 @@ test('can add a video in RTE Tiptap property editor', async ({umbracoApi, umbrac
|
||||
expect(contentData.values[0].value.markup).toContain('data-embed-url');
|
||||
expect(contentData.values[0].value.markup).toContain(videoURL);
|
||||
});
|
||||
|
||||
test('cannot submit an empty link in RTE Tiptap property editor', async ({umbracoApi, umbracoUi}) => {
|
||||
// Arrange
|
||||
const iconTitle = 'Link';
|
||||
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId);
|
||||
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId);
|
||||
await umbracoUi.goToBackOffice();
|
||||
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
|
||||
|
||||
// Act
|
||||
await umbracoUi.content.goToContentWithName(contentName);
|
||||
await umbracoUi.content.clickTipTapToolbarIconWithTitle(iconTitle);
|
||||
await umbracoUi.content.clickManualLinkButton();
|
||||
await umbracoUi.content.enterLink('');
|
||||
await umbracoUi.content.enterAnchorOrQuerystring('');
|
||||
await umbracoUi.content.enterLinkTitle('');
|
||||
await umbracoUi.content.clickAddButton();
|
||||
|
||||
// Assert
|
||||
await umbracoUi.content.isTextWithMessageVisible(ConstantHelper.validationMessages.emptyLinkPicker);
|
||||
});
|
||||
|
||||
// TODO: Remove skip when the front-end ready. Currently it still accept the empty link with an anchor or querystring
|
||||
// Issue link: https://github.com/umbraco/Umbraco-CMS/issues/17411
|
||||
test.skip('cannot submit an empty URL with an anchor or querystring in RTE Tiptap property editor', async ({umbracoApi, umbracoUi}) => {
|
||||
// Arrange
|
||||
const iconTitle = 'Link';
|
||||
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId);
|
||||
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId);
|
||||
await umbracoUi.goToBackOffice();
|
||||
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
|
||||
|
||||
// Act
|
||||
await umbracoUi.content.goToContentWithName(contentName);
|
||||
await umbracoUi.content.clickTipTapToolbarIconWithTitle(iconTitle);
|
||||
await umbracoUi.content.clickManualLinkButton();
|
||||
await umbracoUi.content.enterLink('');
|
||||
await umbracoUi.content.enterAnchorOrQuerystring('#value');
|
||||
await umbracoUi.content.clickAddButton();
|
||||
|
||||
// Assert
|
||||
await umbracoUi.content.isTextWithMessageVisible(ConstantHelper.validationMessages.emptyLinkPicker);
|
||||
});
|
||||
|
||||
// TODO: Remove skip when the front-end ready. Currently it is impossible to link to unpublished document
|
||||
// Issue link: https://github.com/umbraco/Umbraco-CMS/issues/17974
|
||||
test.skip('can insert a link to an unpublished document in RTE Tiptap property editor', async ({umbracoApi, umbracoUi}) => {
|
||||
// Arrange
|
||||
const iconTitle = 'Link';
|
||||
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId);
|
||||
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId);
|
||||
// Create a document to link
|
||||
const documentTypeForLinkedDocumentName = 'TestDocumentType';
|
||||
const documentTypeForLinkedDocumentId = await umbracoApi.documentType.createDefaultDocumentTypeWithAllowAsRoot(documentTypeForLinkedDocumentName);
|
||||
const linkedDocumentName = 'LinkedDocument';
|
||||
await umbracoApi.document.createDefaultDocument(linkedDocumentName, documentTypeForLinkedDocumentId);
|
||||
await umbracoUi.goToBackOffice();
|
||||
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
|
||||
|
||||
// Act
|
||||
await umbracoUi.content.goToContentWithName(contentName);
|
||||
await umbracoUi.content.clickTipTapToolbarIconWithTitle(iconTitle);
|
||||
await umbracoUi.content.clickDocumentLinkButton();
|
||||
await umbracoUi.content.selectLinkByName(linkedDocumentName);
|
||||
await umbracoUi.content.clickButtonWithName('Choose');
|
||||
await umbracoUi.content.clickAddButton();
|
||||
await umbracoUi.content.clickSaveButton();
|
||||
|
||||
// Assert
|
||||
await umbracoUi.content.isSuccessNotificationVisible();
|
||||
|
||||
// Clean
|
||||
await umbracoApi.documentType.ensureNameNotExists(documentTypeForLinkedDocumentName);
|
||||
await umbracoApi.document.ensureNameNotExists(linkedDocumentName);
|
||||
});
|
||||
Reference in New Issue
Block a user