Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V14 QA added Block grid acceptance tests #16908

Merged
merged 30 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
12caf97
Added blockgrid tests
andr317c Jun 27, 2024
b436916
Merge remote-tracking branch 'refs/remotes/origin/v14/dev' into v14/Q…
andr317c Jun 28, 2024
0f6befb
Additional tests
andr317c Jun 30, 2024
ec08be8
Added more tets
andr317c Jul 1, 2024
31f165c
Merge remote-tracking branch 'refs/remotes/origin/v14/dev' into v14/Q…
andr317c Jul 3, 2024
d643727
Merge remote-tracking branch 'refs/remotes/origin/v14/dev' into v14/Q…
andr317c Jul 4, 2024
67260e1
Split tests
andr317c Jul 4, 2024
be602c4
Merge remote-tracking branch 'refs/remotes/origin/v14/dev' into v14/Q…
andr317c Aug 5, 2024
66017d0
Merge remote-tracking branch 'refs/remotes/origin/v14/dev' into v14/Q…
andr317c Aug 5, 2024
247c8b2
Merge remote-tracking branch 'refs/remotes/origin/v14/dev' into v14/Q…
andr317c Aug 12, 2024
4532668
Block updates
andr317c Aug 12, 2024
0d299f5
Merge remote-tracking branch 'refs/remotes/origin/v14/dev' into v14/Q…
andr317c Aug 12, 2024
43ba528
Merge remote-tracking branch 'refs/remotes/origin/v14/dev' into v14/Q…
andr317c Aug 13, 2024
bd8668c
Bumped version
andr317c Aug 13, 2024
1f6f3ef
Added block tests
andr317c Aug 13, 2024
d6c5a93
Fixes, not done
andr317c Aug 19, 2024
d46fdc8
Fixed
andr317c Aug 19, 2024
8085aa4
Merge remote-tracking branch 'refs/remotes/origin/v14/dev' into v14/Q…
andr317c Aug 20, 2024
7d57e85
Updated helper
andr317c Aug 20, 2024
5317f85
Bumped version
andr317c Aug 20, 2024
5d357da
Merge remote-tracking branch 'refs/remotes/origin/v14/dev' into v14/Q…
andr317c Aug 22, 2024
85f9dc6
Bumped helpers
andr317c Aug 22, 2024
d4c5fcd
Merge remote-tracking branch 'refs/remotes/origin/v14/dev' into v14/Q…
andr317c Aug 23, 2024
e90711f
Fixed conflicts
andr317c Aug 23, 2024
0082e39
Removed page
andr317c Aug 23, 2024
e50a106
Removed page
andr317c Aug 23, 2024
39bb5bc
Merge remote-tracking branch 'refs/remotes/origin/v14/dev' into v14/Q…
andr317c Aug 23, 2024
797303d
Bumped
andr317c Aug 23, 2024
aa556ff
Merge remote-tracking branch 'refs/remotes/origin/v14/dev' into v14/Q…
andr317c Aug 27, 2024
4f8b152
Reverted to run smoke tests
andr317c Aug 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 3 additions & 17 deletions tests/Umbraco.Tests.AcceptanceTest/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/Umbraco.Tests.AcceptanceTest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"test": "npx playwright test DefaultConfig",
"all": "npx playwright test",
"createTest": "node createTest.js",
"smokeTest": "npx playwright test DefaultConfig --grep \"@smoke\""
"smokeTest": "npx playwright test DefaultConfig/dataType/block"
},
"devDependencies": {
"@playwright/test": "^1.43",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,278 @@
import {test} from '@umbraco/playwright-testhelpers';
import {expect} from "@playwright/test";

const blockGridEditorName = 'TestBlockGridEditor';
const elementTypeName = 'BlockGridElement';
const dataTypeName = 'Textstring';
const groupName = 'testGroup';

test.beforeEach(async ({umbracoUi, umbracoApi}) => {
await umbracoApi.dataType.ensureNameNotExists(blockGridEditorName);
await umbracoUi.goToBackOffice();
await umbracoUi.dataType.goToSettingsTreeItem('Data Types');
});

test.afterEach(async ({umbracoApi}) => {
await umbracoApi.dataType.ensureNameNotExists(blockGridEditorName);
});

//TODO: It is not possible to add a view to a block
test.skip('can add a custom view to a block', async ({page, umbracoApi, umbracoUi}) => {
// Arrange
const textStringData = await umbracoApi.dataType.getByName(dataTypeName);
const contentElementTypeId = await umbracoApi.documentType.createDefaultElementType(elementTypeName, groupName, dataTypeName, textStringData.id);
await umbracoApi.dataType.createBlockGridWithABlock(blockGridEditorName, contentElementTypeId);

// Act
await umbracoUi.dataType.goToDataType(blockGridEditorName);
await umbracoUi.dataType.goToBlockWithName(elementTypeName);
await umbracoUi.dataType.goToBlockAdvancedTab();
await page.pause();
andr317c marked this conversation as resolved.
Show resolved Hide resolved
});

//TODO: It is not possible to add a view to a block
test.skip('can remove a custom view from a block', async ({page, umbracoApi, umbracoUi}) => {
andr317c marked this conversation as resolved.
Show resolved Hide resolved
// Arrange
const textStringData = await umbracoApi.dataType.getByName(dataTypeName);
const contentElementTypeId = await umbracoApi.documentType.createDefaultElementType(elementTypeName, groupName, dataTypeName, textStringData.id);
await umbracoApi.dataType.createBlockGridWithABlock(blockGridEditorName, contentElementTypeId);

// Act
await umbracoUi.dataType.goToDataType(blockGridEditorName);
await umbracoUi.dataType.goToBlockWithName(elementTypeName);
await umbracoUi.dataType.goToBlockAdvancedTab();
});

// TODO: Stylesheets are currently saved as arrays
test.skip('can remove a custom stylesheet from a block', async ({page, umbracoApi, umbracoUi}) => {
andr317c marked this conversation as resolved.
Show resolved Hide resolved
// Arrange
const stylesheetName = 'TestStylesheet.css'
const stylesheetPath = '/wwwroot/css/' + stylesheetName;
await umbracoApi.stylesheet.ensureNameNotExists(stylesheetName);
await umbracoApi.stylesheet.createDefaultStylesheet(stylesheetName);
const textStringData = await umbracoApi.dataType.getByName(dataTypeName);
const contentElementTypeId = await umbracoApi.documentType.createDefaultElementType(elementTypeName, groupName, dataTypeName, textStringData.id);
await umbracoApi.dataType.createBlockGridWithAdvancedSettingsInBlock(blockGridEditorName, contentElementTypeId, undefined, stylesheetPath, undefined, undefined, undefined);
expect(await umbracoApi.dataType.doesBlockEditorBlockContainStylesheet(blockGridEditorName, contentElementTypeId, stylesheetPath)).toBeTruthy();

// Act
await umbracoUi.dataType.goToDataType(blockGridEditorName);
await umbracoUi.dataType.goToBlockWithName(elementTypeName);
await umbracoUi.dataType.goToBlockAdvancedTab();
});

test('can update overlay size in a block', async ({umbracoApi, umbracoUi}) => {
// Arrange
const overlaySize = 'medium';
const textStringData = await umbracoApi.dataType.getByName(dataTypeName);
const contentElementTypeId = await umbracoApi.documentType.createDefaultElementType(elementTypeName, groupName, dataTypeName, textStringData.id);
await umbracoApi.dataType.createBlockGridWithABlock(blockGridEditorName, contentElementTypeId);

// Act
await umbracoUi.dataType.goToDataType(blockGridEditorName);
await umbracoUi.dataType.goToBlockWithName(elementTypeName);
await umbracoUi.dataType.goToBlockAdvancedTab();
await umbracoUi.dataType.updateBlockOverlaySize(overlaySize);
await umbracoUi.dataType.clickSubmitButton();
await umbracoUi.dataType.clickSaveButton();

// Assert
await umbracoUi.dataType.isSuccessNotificationVisible();
expect(await umbracoApi.dataType.doesBlockEditorBlockContainOverlaySize(blockGridEditorName, contentElementTypeId, overlaySize)).toBeTruthy();
});

test('can enable inline editing mode in a block', async ({umbracoApi, umbracoUi}) => {
// Arrange
const textStringData = await umbracoApi.dataType.getByName(dataTypeName);
const contentElementTypeId = await umbracoApi.documentType.createDefaultElementType(elementTypeName, groupName, dataTypeName, textStringData.id);
await umbracoApi.dataType.createBlockGridWithABlock(blockGridEditorName, contentElementTypeId);

// Act
await umbracoUi.dataType.goToDataType(blockGridEditorName);
await umbracoUi.dataType.goToBlockWithName(elementTypeName);
await umbracoUi.dataType.goToBlockAdvancedTab();
await umbracoUi.dataType.clickInlineEditingMode();
await umbracoUi.dataType.clickSubmitButton();
await umbracoUi.dataType.clickSaveButton();

// Assert
await umbracoUi.dataType.isSuccessNotificationVisible();
expect(await umbracoApi.dataType.doesBlockEditorBlockContainInlineEditing(blockGridEditorName, contentElementTypeId, true)).toBeTruthy();
});

test('can disable inline editing mode in a block', async ({umbracoApi, umbracoUi}) => {
// Arrange
const textStringData = await umbracoApi.dataType.getByName(dataTypeName);
const contentElementTypeId = await umbracoApi.documentType.createDefaultElementType(elementTypeName, groupName, dataTypeName, textStringData.id);
await umbracoApi.dataType.createBlockGridWithAdvancedSettingsInBlock(blockGridEditorName, contentElementTypeId, undefined, undefined, 'small', true);
expect(await umbracoApi.dataType.doesBlockEditorBlockContainInlineEditing(blockGridEditorName, contentElementTypeId, true)).toBeTruthy();

// Act
await umbracoUi.dataType.goToDataType(blockGridEditorName);
await umbracoUi.dataType.goToBlockWithName(elementTypeName);
await umbracoUi.dataType.goToBlockAdvancedTab();
await umbracoUi.dataType.clickInlineEditingMode();
await umbracoUi.dataType.clickSubmitButton();
await umbracoUi.dataType.clickSaveButton();

// Assert
await umbracoUi.dataType.isSuccessNotificationVisible();
expect(await umbracoApi.dataType.doesBlockEditorBlockContainInlineEditing(blockGridEditorName, contentElementTypeId, false)).toBeTruthy();
});

test('can enable hide content editor in a block', async ({umbracoApi, umbracoUi}) => {
// Arrange
const textStringData = await umbracoApi.dataType.getByName(dataTypeName);
const contentElementTypeId = await umbracoApi.documentType.createDefaultElementType(elementTypeName, groupName, dataTypeName, textStringData.id);
await umbracoApi.dataType.createBlockGridWithABlock(blockGridEditorName, contentElementTypeId);

// Act
await umbracoUi.dataType.goToDataType(blockGridEditorName);
await umbracoUi.dataType.goToBlockWithName(elementTypeName);
await umbracoUi.dataType.goToBlockAdvancedTab();
await umbracoUi.dataType.clickBlockGridHideContentEditorButton();
await umbracoUi.dataType.clickSubmitButton();
await umbracoUi.dataType.clickSaveButton();

// Assert
await umbracoUi.dataType.isSuccessNotificationVisible();
expect(await umbracoApi.dataType.doesBlockEditorBlockContainHideContentEditor(blockGridEditorName, contentElementTypeId, true)).toBeTruthy();
});

test('can disable hide content editor in a block', async ({umbracoApi, umbracoUi}) => {
// Arrange
const textStringData = await umbracoApi.dataType.getByName(dataTypeName);
const contentElementTypeId = await umbracoApi.documentType.createDefaultElementType(elementTypeName, groupName, dataTypeName, textStringData.id);
await umbracoApi.dataType.createBlockGridWithAdvancedSettingsInBlock(blockGridEditorName, contentElementTypeId, undefined, undefined, 'small', false, true);
expect(await umbracoApi.dataType.doesBlockEditorBlockContainHideContentEditor(blockGridEditorName, contentElementTypeId, true)).toBeTruthy();

// Act
await umbracoUi.dataType.goToDataType(blockGridEditorName);
await umbracoUi.dataType.goToBlockWithName(elementTypeName);
await umbracoUi.dataType.goToBlockAdvancedTab();
await umbracoUi.dataType.clickBlockGridHideContentEditorButton();
await umbracoUi.dataType.clickSubmitButton();
await umbracoUi.dataType.clickSaveButton();

// Assert
await umbracoUi.dataType.isSuccessNotificationVisible();
expect(await umbracoApi.dataType.doesBlockEditorBlockContainHideContentEditor(blockGridEditorName, contentElementTypeId, false)).toBeTruthy();
});

test('can add a background color to a block', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) => {
// Arrange
const textStringData = await umbracoApi.dataType.getByName(dataTypeName);
const backGroundColor = '#000000';
const contentElementTypeId = await umbracoApi.documentType.createDefaultElementType(elementTypeName, groupName, dataTypeName, textStringData.id);
await umbracoApi.dataType.createBlockGridWithABlock(blockGridEditorName, contentElementTypeId);

// Act
await umbracoUi.dataType.goToDataType(blockGridEditorName);
await umbracoUi.dataType.goToBlockWithName(elementTypeName);
await umbracoUi.dataType.goToBlockAdvancedTab();
await umbracoUi.dataType.selectBlockBackgroundColor(backGroundColor);
await umbracoUi.dataType.clickSubmitButton();
await umbracoUi.dataType.clickSaveButton();

// Assert
await umbracoUi.dataType.isSuccessNotificationVisible();
expect(await umbracoApi.dataType.doesBlockEditorBlockContainBackgroundColor(blockGridEditorName, contentElementTypeId, backGroundColor)).toBeTruthy();
});

test('can remove a background color to a block', async ({umbracoApi, umbracoUi}) => {
// Arrange
const textStringData = await umbracoApi.dataType.getByName(dataTypeName);
const backGroundColor = '#000000';
const contentElementTypeId = await umbracoApi.documentType.createDefaultElementType(elementTypeName, groupName, dataTypeName, textStringData.id);
await umbracoApi.dataType.createBlockGridWithCatalogueAppearanceInBlock(blockGridEditorName, contentElementTypeId, backGroundColor);
expect(await umbracoApi.dataType.doesBlockEditorBlockContainBackgroundColor(blockGridEditorName, contentElementTypeId, backGroundColor)).toBeTruthy();

// Act
await umbracoUi.dataType.goToDataType(blockGridEditorName);
await umbracoUi.dataType.goToBlockWithName(elementTypeName);
await umbracoUi.dataType.goToBlockAdvancedTab();
await umbracoUi.dataType.selectBlockBackgroundColor('');
await umbracoUi.dataType.clickSubmitButton();
await umbracoUi.dataType.clickSaveButton();

// Assert
await umbracoUi.dataType.isSuccessNotificationVisible();
expect(await umbracoApi.dataType.doesBlockEditorBlockContainBackgroundColor(blockGridEditorName, contentElementTypeId, '')).toBeTruthy();
});

test('can add a icon color to a block', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) => {
// Arrange
const textStringData = await umbracoApi.dataType.getByName(dataTypeName);
const iconColor = '#000000';
const contentElementTypeId = await umbracoApi.documentType.createDefaultElementType(elementTypeName, groupName, dataTypeName, textStringData.id);
await umbracoApi.dataType.createBlockGridWithABlock(blockGridEditorName, contentElementTypeId);

// Act
await umbracoUi.dataType.goToDataType(blockGridEditorName);
await umbracoUi.dataType.goToBlockWithName(elementTypeName);
await umbracoUi.dataType.goToBlockAdvancedTab();
await umbracoUi.dataType.selectBlockIconColor(iconColor);
await umbracoUi.dataType.clickSubmitButton();
await umbracoUi.dataType.clickSaveButton();

// Assert
await umbracoUi.dataType.isSuccessNotificationVisible();
expect(await umbracoApi.dataType.doesBlockEditorBlockContainIconColor(blockGridEditorName, contentElementTypeId, iconColor)).toBeTruthy();
});

test('can remove a icon color from a block', async ({umbracoApi, umbracoUi}) => {
// Arrange
const textStringData = await umbracoApi.dataType.getByName(dataTypeName);
const iconColor = '#000000';
const contentElementTypeId = await umbracoApi.documentType.createDefaultElementType(elementTypeName, groupName, dataTypeName, textStringData.id);
await umbracoApi.dataType.createBlockGridWithCatalogueAppearanceInBlock(blockGridEditorName, contentElementTypeId, '', iconColor);
expect(await umbracoApi.dataType.doesBlockEditorBlockContainIconColor(blockGridEditorName, contentElementTypeId, iconColor)).toBeTruthy();

// Act
await umbracoUi.dataType.goToDataType(blockGridEditorName);
await umbracoUi.dataType.goToBlockWithName(elementTypeName);
await umbracoUi.dataType.goToBlockAdvancedTab();
await umbracoUi.dataType.selectBlockIconColor('');
await umbracoUi.dataType.clickSubmitButton();
await umbracoUi.dataType.clickSaveButton();

// Assert
await umbracoUi.dataType.isSuccessNotificationVisible();
expect(await umbracoApi.dataType.doesBlockEditorBlockContainIconColor(blockGridEditorName, contentElementTypeId, '')).toBeTruthy();
});

// TODO: Thumbnails are not showing correctly
test.skip('can add a thumbnail to a block', async ({page, umbracoApi, umbracoUi}) => {
andr317c marked this conversation as resolved.
Show resolved Hide resolved
// Arrange
const mediaName = 'TestMedia';
await umbracoApi.media.ensureNameNotExists(mediaName);
await umbracoApi.media.createDefaultMediaWithImage(mediaName);
const textStringData = await umbracoApi.dataType.getByName(dataTypeName);
const contentElementTypeId = await umbracoApi.documentType.createDefaultElementType(elementTypeName, groupName, dataTypeName, textStringData.id);
await umbracoApi.dataType.createBlockGridWithABlock(blockGridEditorName, contentElementTypeId);

// Act
await umbracoUi.dataType.goToDataType(blockGridEditorName);
await umbracoUi.dataType.goToBlockWithName(elementTypeName);
await umbracoUi.dataType.goToBlockAdvancedTab();
const mediaUrl = await umbracoApi.media.getMediaPathByName(mediaName);
andr317c marked this conversation as resolved.
Show resolved Hide resolved
await umbracoUi.dataType.chooseBlockThumbnailWithPath(mediaUrl.fileName, mediaUrl.mediaPath);
await umbracoUi.dataType.clickSubmitButton();
await umbracoUi.dataType.clickSaveButton();

// Assert
await umbracoUi.dataType.isSuccessNotificationVisible();
});

// TODO: Thumbnails are not showing correctly
test.skip('can remove a thumbnail from a block', async ({page, umbracoApi, umbracoUi}) => {
andr317c marked this conversation as resolved.
Show resolved Hide resolved
// Arrange
const textStringData = await umbracoApi.dataType.getByName(dataTypeName);
const contentElementTypeId = await umbracoApi.documentType.createDefaultElementType(elementTypeName, groupName, dataTypeName, textStringData.id);
await umbracoApi.dataType.createBlockGridWithABlock(blockGridEditorName, contentElementTypeId);

// Act
await umbracoUi.dataType.goToDataType(blockGridEditorName);
await umbracoUi.dataType.goToBlockWithName(elementTypeName);
await umbracoUi.dataType.goToBlockAdvancedTab();
});

Check warning on line 278 in tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/DataType/BlockGrid/Block/BlockGridBlockAdvanced.spec.ts

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (v14/dev)

❌ New issue: Code Duplication

The module contains 10 functions with similar structure: 'can add a custom view to a block','can disable hide content editor in a block','can disable inline editing mode in a block','can enable hide content editor in a block' and 6 more functions. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.
Loading
Loading