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 tests for rendering content with checkboxlist and date picker #17332

Merged
merged 21 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
7385857
Added tests for rendering content with numeric
nhudinh0309 Oct 11, 2024
ba8fa65
Added tests for rendering content with textarea
nhudinh0309 Oct 11, 2024
0001d17
Merge branch 'v14/dev' into v14/QA/rendering-content/textarea-tests
nhudinh0309 Oct 15, 2024
add62b6
Added tests for rendering content with approved color
nhudinh0309 Oct 17, 2024
da71189
Added tests for rendering content with numeric
nhudinh0309 Oct 17, 2024
212f4e2
Added tests for rendering content with tags
nhudinh0309 Oct 17, 2024
b021788
Added tests for rendering content with textarea
nhudinh0309 Oct 17, 2024
13c609b
Updated tests for rendering content with textstring due to test helpe…
nhudinh0309 Oct 17, 2024
27d9ebe
Added tests for rendering content with truefalse
nhudinh0309 Oct 17, 2024
d0bb1a4
Added tests for rendering content with checkbox list
nhudinh0309 Oct 17, 2024
0a97961
Added tests for rendering content with date picker - not done
nhudinh0309 Oct 17, 2024
e754442
Updated tests for rendering content with date picker
nhudinh0309 Oct 18, 2024
cd51351
Merge branch 'v14/dev' into v14/QA/rendering-content/checkbox-date-tests
nhudinh0309 Oct 22, 2024
1daf45b
Updated tests for rendering content due to ui helper changes
nhudinh0309 Oct 22, 2024
9274ef8
Bumped version
nhudinh0309 Oct 22, 2024
e1ccefa
Removed blank lines
nhudinh0309 Oct 22, 2024
c988258
Merge branch 'v14/dev' into v14/QA/rendering-content/checkbox-date-tests
nhudinh0309 Oct 23, 2024
a37bdac
Make Rendering Content tests run in the pipeline
nhudinh0309 Oct 23, 2024
8a1ffb0
Changed method name due to test helper changes
nhudinh0309 Oct 23, 2024
4dd5963
Reverted
nhudinh0309 Oct 25, 2024
552ce3a
Merge branch 'v14/dev' into v14/QA/rendering-content/checkbox-date-tests
nhudinh0309 Oct 25, 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
10 changes: 5 additions & 5 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.

4 changes: 2 additions & 2 deletions tests/Umbraco.Tests.AcceptanceTest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"typescript": "^4.8.3"
},
"dependencies": {
"@umbraco/json-models-builders": "^2.0.21",
"@umbraco/playwright-testhelpers": "^2.0.0-beta.91",
"@umbraco/json-models-builders": "^2.0.22",
"@umbraco/playwright-testhelpers": "^2.0.0-beta.92",
"camelize": "^1.0.0",
"dotenv": "^16.3.1",
"node-fetch": "^2.6.7"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ test('can render content with an approved color with label', async ({umbracoApi,
await umbracoUi.contentRender.navigateToRenderedContentPage(contentURL);

// Assert
await umbracoUi.contentRender.doesContentRenderValueHaveText(colorValue.label);
await umbracoUi.contentRender.doesContentRenderValueContainText(colorValue.label);
});

test('can render content with an approved color without label', async ({umbracoApi, umbracoUi}) => {
Expand All @@ -44,5 +44,5 @@ test('can render content with an approved color without label', async ({umbracoA
await umbracoUi.contentRender.navigateToRenderedContentPage(contentURL);

// Assert
await umbracoUi.contentRender.doesContentRenderValueHaveText(colorValue.value);
});
await umbracoUi.contentRender.doesContentRenderValueContainText(colorValue.value);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import {AliasHelper, test} from '@umbraco/playwright-testhelpers';

const contentName = 'Test Rendering Content';
const documentTypeName = 'TestDocumentTypeForContent';
const customDataTypeName = 'Custom Checkbox List';
const templateName = 'TestTemplateForContent';
const propertyName = 'Test Checkbox List';

test.afterEach(async ({umbracoApi}) => {
await umbracoApi.document.ensureNameNotExists(contentName);
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
await umbracoApi.template.ensureNameNotExists(templateName);
await umbracoApi.dataType.ensureNameNotExists(customDataTypeName);
});

const checkboxList = [
{type: 'an empty list of checkboxes', value: []},
{type: 'one checkbox', value: ['Test checkbox']},
{type: 'multiple checkboxes', value: ['Test checkbox 1', 'Test checkbox 2', 'Test checkbox 3']},
];

for (const checkbox of checkboxList) {
test(`can render content with ${checkbox.type}`, async ({umbracoApi, umbracoUi}) => {
// Arrange
const checkboxValue = checkbox.value;
const dataTypeId = await umbracoApi.dataType.createCheckboxListDataType(customDataTypeName, checkboxValue);
const templateId = await umbracoApi.template.createTemplateWithDisplayingCheckboxListValue(templateName, AliasHelper.toAlias(propertyName));
await umbracoApi.document.createPublishedDocumentWithValue(contentName, checkboxValue, dataTypeId, templateId, propertyName, documentTypeName);
const contentData = await umbracoApi.document.getByName(contentName);
const contentURL = contentData.urls[0].url;

// Act
await umbracoUi.contentRender.navigateToRenderedContentPage(contentURL);

// Assert
checkboxValue.forEach(async value => {
await umbracoUi.contentRender.doesContentRenderValueContainText(value);
});
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import {AliasHelper, test} from '@umbraco/playwright-testhelpers';

const contentName = 'Test Rendering Content';
const documentTypeName = 'TestDocumentTypeForContent';
const templateName = 'TestTemplateForContent';
const propertyName = 'Test Date Picker';

test.afterEach(async ({umbracoApi}) => {
await umbracoApi.document.ensureNameNotExists(contentName);
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
await umbracoApi.template.ensureNameNotExists(templateName);
});

const dateTimes = [
{type: 'with AM time', value: '2024-10-29 09:09:09', expectedValue: '10/29/2024 9:09:09 AM', dataTypeName: 'Date Picker with time'},
{type: 'with PM time', value: '2024-10-29 21:09:09', expectedValue: '10/29/2024 9:09:09 PM', dataTypeName: 'Date Picker with time'},
// TODO: Uncomment this when the front-end is ready. Currently the time still be rendered.
//{type: 'without time', value: '2024-10-29 00:00:00', expectedValue: '10/29/2024', dataTypeName: 'Date Picker'}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you mentioned this to the FrontEnd team?

];

for (const dateTime of dateTimes) {
test(`can render content with a date ${dateTime.type}`, async ({umbracoApi, umbracoUi}) => {
const dataTypeData = await umbracoApi.dataType.getByName(dateTime.dataTypeName);
const templateId = await umbracoApi.template.createTemplateWithDisplayingStringValue(templateName, AliasHelper.toAlias(propertyName));
await umbracoApi.document.createPublishedDocumentWithValue(contentName, dateTime.value, dataTypeData.id, templateId, propertyName, documentTypeName);
const contentData = await umbracoApi.document.getByName(contentName);
const contentURL = contentData.urls[0].url;

// Act
await umbracoUi.contentRender.navigateToRenderedContentPage(contentURL);

// Assert
await umbracoUi.contentRender.doesContentRenderValueContainText(dateTime.expectedValue, true);
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ for (const numeric of numerics) {
await umbracoUi.contentRender.navigateToRenderedContentPage(contentURL);

// Assert
await umbracoUi.contentRender.doesContentRenderValueHaveText(numericValue);
await umbracoUi.contentRender.doesContentRenderValueContainText(numericValue);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ for (const tag of tags) {

// Assert
tagValue.forEach(async value => {
await umbracoUi.contentRender.doesContentRenderValueHaveText(value);
await umbracoUi.contentRender.doesContentRenderValueContainText(value);
});
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ for (const textarea of textareas) {
await umbracoUi.contentRender.navigateToRenderedContentPage(contentURL);

// Assert
await umbracoUi.contentRender.doesContentRenderValueHaveText(textareaValue);
await umbracoUi.contentRender.doesContentRenderValueContainText(textareaValue);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ for (const textstring of textstrings) {
await umbracoUi.contentRender.navigateToRenderedContentPage(contentURL);

// Assert
await umbracoUi.contentRender.doesContentRenderValueHaveText(textstringValue);
await umbracoUi.contentRender.doesContentRenderValueContainText(textstringValue);
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ for (const trueFalse of trueFalseValues) {
await umbracoUi.contentRender.navigateToRenderedContentPage(contentURL);

// Assert
await umbracoUi.contentRender.doesContentRenderValueHaveText(trueFalse.expectedValue);
await umbracoUi.contentRender.doesContentRenderValueContainText(trueFalse.expectedValue);
});
}
}
Loading