diff --git a/src/explore-education-statistics-admin/src/pages/release/content/components/ReleaseEditableBlock.tsx b/src/explore-education-statistics-admin/src/pages/release/content/components/ReleaseEditableBlock.tsx
index a8affa37e39..72032b1438e 100644
--- a/src/explore-education-statistics-admin/src/pages/release/content/components/ReleaseEditableBlock.tsx
+++ b/src/explore-education-statistics-admin/src/pages/release/content/components/ReleaseEditableBlock.tsx
@@ -1,6 +1,7 @@
import EditableBlockWrapper from '@admin/components/editable/EditableBlockWrapper';
import EditableContentBlock from '@admin/components/editable/EditableContentBlock';
import EditableEmbedBlock from '@admin/components/editable/EditableEmbedBlock';
+import CommentsWrapper from '@admin/components/comments/CommentsWrapper';
import { CommentsContextProvider } from '@admin/contexts/CommentsContext';
import { useEditingContext } from '@admin/contexts/EditingContext';
import { useReleaseContentHubContext } from '@admin/contexts/ReleaseContentHubContext';
@@ -24,6 +25,7 @@ import { insertReleaseIdPlaceholders } from '@common/modules/release/utils/relea
import isBrowser from '@common/utils/isBrowser';
import React, { useCallback, useEffect } from 'react';
import { generatePath } from 'react-router';
+import useToggle from '@common/hooks/useToggle';
interface Props {
allowComments?: boolean;
@@ -78,6 +80,8 @@ const ReleaseEditableBlock = ({
releaseId,
});
+ const [showCommentAddForm, toggleCommentAddForm] = useToggle(false);
+
const updateBlock = useCallback(
(nextBlock: EditableBlock) => {
dispatch({
@@ -310,54 +314,65 @@ const ReleaseEditableBlock = ({
const blockId = `block-${block.id}`;
- switch (block.type) {
- case 'DataBlock':
- return (
-
- (
- releaseDataBlockEditRoute.path,
- {
- publicationId,
- releaseId,
- dataBlockId: block.id,
- },
- )}
- onDelete={editable ? handleDelete : undefined}
+ function renderBlock() {
+ switch (block.type) {
+ case 'DataBlock':
+ return (
+
-
-
-
-
-
- );
- case 'EmbedBlockLink': {
- return (
-
- );
- }
- case 'HtmlBlock':
- case 'MarkDownBlock': {
- return (
-
+ (
+ releaseDataBlockEditRoute.path,
+ {
+ publicationId,
+ releaseId,
+ dataBlockId: block.id,
+ },
+ )}
+ onDelete={editable ? handleDelete : undefined}
+ >
+
+
+
+
+
+ );
+ case 'EmbedBlockLink': {
+ return (
+
+
+
+ );
+ }
+ case 'HtmlBlock':
+ case 'MarkDownBlock': {
+ return (
-
- );
+ );
+ }
+ default:
+ return
Unable to edit content
;
}
- default:
- return
Unable to edit content
;
}
+
+ return (
+
+ {renderBlock()}
+
+ );
};
export default ReleaseEditableBlock;
diff --git a/src/explore-education-statistics-admin/src/pages/release/content/components/__tests__/ReleaseEditableBlock.test.tsx b/src/explore-education-statistics-admin/src/pages/release/content/components/__tests__/ReleaseEditableBlock.test.tsx
index c91abe037c0..396e3991a8a 100644
--- a/src/explore-education-statistics-admin/src/pages/release/content/components/__tests__/ReleaseEditableBlock.test.tsx
+++ b/src/explore-education-statistics-admin/src/pages/release/content/components/__tests__/ReleaseEditableBlock.test.tsx
@@ -1,5 +1,6 @@
import { AuthContextTestProvider } from '@admin/contexts/AuthContext';
import { ReleaseContentHubContextProvider } from '@admin/contexts/ReleaseContentHubContext';
+import { testComments } from '@admin/components/comments/__data__/testComments';
import { testEditableRelease } from '@admin/pages/release/__data__/testEditableRelease';
import ReleaseEditableBlock from '@admin/pages/release/content/components/ReleaseEditableBlock';
import { ReleaseContentProvider } from '@admin/pages/release/content/contexts/ReleaseContentContext';
@@ -9,6 +10,7 @@ import { GlobalPermissions } from '@admin/services/permissionService';
import _releaseContentService, {
EditableRelease,
} from '@admin/services/releaseContentService';
+import _releaseContentCommentService from '@admin/services/releaseContentCommentService';
import { EditableBlock } from '@admin/services/types/content';
import { UserDetails } from '@admin/services/types/user';
import mockDate from '@common-test/mockDate';
@@ -23,14 +25,20 @@ import {
import userEvent from '@testing-library/user-event';
import noop from 'lodash/noop';
import React, { ReactNode } from 'react';
+import { MemoryRouter } from 'react-router';
jest.mock('@admin/services/hubs/utils/createConnection');
jest.mock('@admin/services/releaseContentService');
+jest.mock('@admin/services/releaseContentCommentService');
jest.mock('@admin/services/dataBlockService');
const releaseContentService = _releaseContentService as jest.Mocked<
typeof _releaseContentService
>;
+const releaseContentCommentService =
+ _releaseContentCommentService as jest.Mocked<
+ typeof _releaseContentCommentService
+ >;
describe('ReleaseEditableBlock', () => {
const testHtmlBlock: EditableBlock = {
@@ -43,7 +51,7 @@ describe('ReleaseEditableBlock', () => {
};
const testEmbedBlock: EditableBlock = {
- comments: [],
+ comments: testComments,
id: 'embed-block-id',
order: 0,
title: 'Dashboard title',
@@ -51,6 +59,33 @@ describe('ReleaseEditableBlock', () => {
url: 'https://department-for-education.shinyapps.io/test-dashboard',
};
+ const testDataBlock: EditableBlock = {
+ name: 'Test data block',
+ heading: 'Data block heading',
+ source: '',
+ query: {
+ subjectId: 'subject-id',
+ filters: [],
+ indicators: [],
+ locationIds: [],
+ },
+ charts: [],
+ table: {
+ indicators: [],
+ tableHeaders: {
+ columnGroups: [],
+ columns: [],
+ rowGroups: [],
+ rows: [],
+ },
+ },
+ type: 'DataBlock',
+ dataSetId: 'data-set-id',
+ id: 'data-block-id',
+ order: 0,
+ comments: testComments,
+ dataBlockParentId: 'daata-block-parent-id',
+ };
const testCurrentUser: UserDetails = {
id: 'user-1',
displayName: 'Jane Doe',
@@ -851,6 +886,478 @@ describe('ReleaseEditableBlock', () => {
);
});
+ test('renders data block', () => {
+ render(
+
,
+ );
+
+ expect(screen.getByText('Edit data block')).toBeInTheDocument();
+ });
+
+ describe('data block comments', () => {
+ test('renders comments correctly`', () => {
+ render(
+
,
+ );
+
+ expect(
+ screen.getByRole('button', { name: 'Add comment' }),
+ ).toBeInTheDocument();
+
+ const unresolvedComments = within(
+ screen.getByTestId('comments-unresolved'),
+ ).getAllByTestId('comment');
+
+ expect(unresolvedComments).toHaveLength(3);
+ expect(unresolvedComments[0]).toHaveTextContent('Comment 2 content');
+ expect(unresolvedComments[1]).toHaveTextContent('Comment 3 content');
+ expect(unresolvedComments[2]).toHaveTextContent('Comment 4 content');
+
+ const resolvedComments = within(
+ screen.getByTestId('comments-resolved'),
+ ).getAllByTestId('comment');
+
+ expect(resolvedComments).toHaveLength(2);
+ expect(resolvedComments[0]).toHaveTextContent('Comment 1 content');
+ expect(resolvedComments[1]).toHaveTextContent('Comment 5 content');
+ });
+
+ test('calls `deleteContentSectionComment` when a comment delete button is clicked', async () => {
+ render(
+
,
+ );
+
+ expect(
+ releaseContentCommentService.deleteContentSectionComment,
+ ).not.toHaveBeenCalled();
+
+ const unresolvedComments = within(
+ screen.getByTestId('comments-unresolved'),
+ ).getAllByTestId('comment');
+
+ userEvent.click(
+ within(unresolvedComments[0]).getByRole('button', {
+ name: 'Delete',
+ }),
+ );
+
+ await waitFor(() => {
+ expect(
+ releaseContentCommentService.deleteContentSectionComment,
+ ).toHaveBeenCalledTimes(1);
+ expect(
+ releaseContentCommentService.deleteContentSectionComment,
+ ).toHaveBeenCalledWith(testComments[1].id);
+ });
+ });
+
+ test('calls `updateContentSectionComment` when a comment is edited', async () => {
+ render(
+
,
+ );
+
+ expect(
+ releaseContentCommentService.updateContentSectionComment,
+ ).not.toHaveBeenCalled();
+
+ const unresolvedComments = within(
+ screen.getByTestId('comments-unresolved'),
+ ).getAllByTestId('comment');
+
+ const comment = within(unresolvedComments[0]);
+
+ userEvent.click(comment.getByRole('button', { name: 'Edit' }));
+ userEvent.clear(comment.getByRole('textbox'));
+ await userEvent.type(
+ comment.getByRole('textbox'),
+ 'Test updated content',
+ );
+
+ userEvent.click(comment.getByRole('button', { name: 'Update' }));
+
+ await waitFor(() => {
+ expect(
+ releaseContentCommentService.updateContentSectionComment,
+ ).toHaveBeenCalledTimes(1);
+ expect(
+ releaseContentCommentService.updateContentSectionComment,
+ ).toHaveBeenCalledWith({
+ ...testComments[1],
+ content: 'Test updated content',
+ });
+ });
+ });
+
+ test('calls `updateContentSectionComment` when a comment is resolved', async () => {
+ render(
+
,
+ );
+
+ expect(
+ releaseContentCommentService.updateContentSectionComment,
+ ).not.toHaveBeenCalled();
+
+ const unresolvedComments = within(
+ screen.getByTestId('comments-unresolved'),
+ ).getAllByTestId('comment');
+
+ const comment = within(unresolvedComments[0]);
+
+ userEvent.click(comment.getByRole('button', { name: 'Resolve' }));
+
+ await waitFor(() => {
+ expect(
+ releaseContentCommentService.updateContentSectionComment,
+ ).toHaveBeenCalledTimes(1);
+ expect(
+ releaseContentCommentService.updateContentSectionComment,
+ ).toHaveBeenCalledWith({
+ ...testComments[1],
+ setResolved: true,
+ });
+ });
+ });
+
+ test('calls `updateContentSectionComment` when a comment is unresolved', async () => {
+ render(
+
,
+ );
+
+ expect(
+ releaseContentCommentService.updateContentSectionComment,
+ ).not.toHaveBeenCalled();
+
+ const resolvedComments = within(
+ screen.getByTestId('comments-resolved'),
+ ).getAllByTestId('comment');
+
+ const comment = within(resolvedComments[0]);
+
+ userEvent.click(
+ comment.getByRole('button', { name: 'Unresolve', hidden: true }),
+ );
+
+ await waitFor(() => {
+ expect(
+ releaseContentCommentService.updateContentSectionComment,
+ ).toHaveBeenCalledTimes(1);
+ expect(
+ releaseContentCommentService.updateContentSectionComment,
+ ).toHaveBeenCalledWith({
+ ...testComments[0],
+ setResolved: false,
+ });
+ });
+ });
+
+ test('calls `addContentSectionComment` when a comment is added', async () => {
+ render(
+
,
+ );
+
+ expect(
+ releaseContentCommentService.addContentSectionComment,
+ ).not.toHaveBeenCalled();
+
+ userEvent.click(screen.getByRole('button', { name: 'Add comment' }));
+
+ await userEvent.type(
+ screen.getByRole('textbox', {
+ name: 'Comment',
+ }),
+ 'I am a comment',
+ );
+
+ userEvent.click(
+ screen.getByRole('button', {
+ name: 'Add comment',
+ }),
+ );
+
+ await waitFor(() => {
+ expect(
+ releaseContentCommentService.addContentSectionComment,
+ ).toHaveBeenCalledTimes(1);
+ expect(
+ releaseContentCommentService.addContentSectionComment,
+ ).toHaveBeenCalledWith('release-1', 'section-1', 'data-block-id', {
+ content: 'I am a comment',
+ });
+ });
+ });
+ });
+
+ describe('embed block comments', () => {
+ test('renders comments correctly`', () => {
+ render(
+
,
+ );
+
+ expect(
+ screen.getByRole('button', { name: 'Add comment' }),
+ ).toBeInTheDocument();
+
+ const unresolvedComments = within(
+ screen.getByTestId('comments-unresolved'),
+ ).getAllByTestId('comment');
+
+ expect(unresolvedComments).toHaveLength(3);
+ expect(unresolvedComments[0]).toHaveTextContent('Comment 2 content');
+ expect(unresolvedComments[1]).toHaveTextContent('Comment 3 content');
+ expect(unresolvedComments[2]).toHaveTextContent('Comment 4 content');
+
+ const resolvedComments = within(
+ screen.getByTestId('comments-resolved'),
+ ).getAllByTestId('comment');
+
+ expect(resolvedComments).toHaveLength(2);
+ expect(resolvedComments[0]).toHaveTextContent('Comment 1 content');
+ expect(resolvedComments[1]).toHaveTextContent('Comment 5 content');
+ });
+
+ test('calls `deleteContentSectionComment` when a comment delete button is clicked', async () => {
+ render(
+
,
+ );
+
+ expect(
+ releaseContentCommentService.deleteContentSectionComment,
+ ).not.toHaveBeenCalled();
+
+ const unresolvedComments = within(
+ screen.getByTestId('comments-unresolved'),
+ ).getAllByTestId('comment');
+
+ userEvent.click(
+ within(unresolvedComments[0]).getByRole('button', {
+ name: 'Delete',
+ }),
+ );
+
+ await waitFor(() => {
+ expect(
+ releaseContentCommentService.deleteContentSectionComment,
+ ).toHaveBeenCalledTimes(1);
+ expect(
+ releaseContentCommentService.deleteContentSectionComment,
+ ).toHaveBeenCalledWith(testComments[1].id);
+ });
+ });
+
+ test('calls `updateContentSectionComment` when a comment is edited', async () => {
+ render(
+
,
+ );
+
+ expect(
+ releaseContentCommentService.updateContentSectionComment,
+ ).not.toHaveBeenCalled();
+
+ const unresolvedComments = within(
+ screen.getByTestId('comments-unresolved'),
+ ).getAllByTestId('comment');
+
+ const comment = within(unresolvedComments[0]);
+
+ userEvent.click(comment.getByRole('button', { name: 'Edit' }));
+ userEvent.clear(comment.getByRole('textbox'));
+ await userEvent.type(
+ comment.getByRole('textbox'),
+ 'Test updated content',
+ );
+
+ userEvent.click(comment.getByRole('button', { name: 'Update' }));
+
+ await waitFor(() => {
+ expect(
+ releaseContentCommentService.updateContentSectionComment,
+ ).toHaveBeenCalledTimes(1);
+ expect(
+ releaseContentCommentService.updateContentSectionComment,
+ ).toHaveBeenCalledWith({
+ ...testComments[1],
+ content: 'Test updated content',
+ });
+ });
+ });
+
+ test('calls `updateContentSectionComment` when a comment is resolved', async () => {
+ render(
+
,
+ );
+
+ expect(
+ releaseContentCommentService.updateContentSectionComment,
+ ).not.toHaveBeenCalled();
+
+ const unresolvedComments = within(
+ screen.getByTestId('comments-unresolved'),
+ ).getAllByTestId('comment');
+
+ const comment = within(unresolvedComments[0]);
+
+ userEvent.click(comment.getByRole('button', { name: 'Resolve' }));
+
+ await waitFor(() => {
+ expect(
+ releaseContentCommentService.updateContentSectionComment,
+ ).toHaveBeenCalledTimes(1);
+ expect(
+ releaseContentCommentService.updateContentSectionComment,
+ ).toHaveBeenCalledWith({
+ ...testComments[1],
+ setResolved: true,
+ });
+ });
+ });
+
+ test('calls `updateContentSectionComment` when a comment is unresolved', async () => {
+ render(
+
,
+ );
+
+ expect(
+ releaseContentCommentService.updateContentSectionComment,
+ ).not.toHaveBeenCalled();
+
+ const resolvedComments = within(
+ screen.getByTestId('comments-resolved'),
+ ).getAllByTestId('comment');
+
+ const comment = within(resolvedComments[0]);
+
+ userEvent.click(
+ comment.getByRole('button', { name: 'Unresolve', hidden: true }),
+ );
+
+ await waitFor(() => {
+ expect(
+ releaseContentCommentService.updateContentSectionComment,
+ ).toHaveBeenCalledTimes(1);
+ expect(
+ releaseContentCommentService.updateContentSectionComment,
+ ).toHaveBeenCalledWith({
+ ...testComments[0],
+ setResolved: false,
+ });
+ });
+ });
+
+ test('calls `addContentSectionComment` when a comment is added', async () => {
+ render(
+
,
+ );
+
+ expect(
+ releaseContentCommentService.addContentSectionComment,
+ ).not.toHaveBeenCalled();
+
+ userEvent.click(screen.getByRole('button', { name: 'Add comment' }));
+
+ await userEvent.type(
+ screen.getByRole('textbox', {
+ name: 'Comment',
+ }),
+ 'I am a comment',
+ );
+
+ userEvent.click(
+ screen.getByRole('button', {
+ name: 'Add comment',
+ }),
+ );
+
+ await waitFor(() => {
+ expect(
+ releaseContentCommentService.addContentSectionComment,
+ ).toHaveBeenCalledTimes(1);
+ expect(
+ releaseContentCommentService.addContentSectionComment,
+ ).toHaveBeenCalledWith('release-1', 'section-1', 'embed-block-id', {
+ content: 'I am a comment',
+ });
+ });
+ });
+ });
+
function render(
child: ReactNode,
release: EditableRelease = testEditableRelease,
@@ -872,7 +1379,7 @@ describe('ReleaseEditableBlock', () => {
unattachedDataBlocks: [],
}}
>
- {child}
+
{child}
,
diff --git a/src/explore-education-statistics-admin/src/styles/_variables.scss b/src/explore-education-statistics-admin/src/styles/_variables.scss
index ff301126691..bd481e36681 100644
--- a/src/explore-education-statistics-admin/src/styles/_variables.scss
+++ b/src/explore-education-statistics-admin/src/styles/_variables.scss
@@ -2,3 +2,4 @@ $dfe-page-width-wide: 1280px;
$dfe-page-width-wide-gutter: 15px;
$dfe-comments-width: 300px;
$dfe-comments-gutter: 30px;
+$dfe-comments-form-height: 194px;
diff --git a/tests/robot-tests/tests/admin/bau/release_content_authoring.robot b/tests/robot-tests/tests/admin/bau/release_content_authoring.robot
index cfbd71b16d1..8786c5208b5 100644
--- a/tests/robot-tests/tests/admin/bau/release_content_authoring.robot
+++ b/tests/robot-tests/tests/admin/bau/release_content_authoring.robot
@@ -12,8 +12,10 @@ Test Setup fail test fast if required
${RELEASE_NAME}= Academic year Q1 2020/21
${PUBLICATION_NAME}= UI tests - release content authoring %{RUN_IDENTIFIER}
${SECTION_1_TITLE}= First content section
+${SECTION_2_TITLE}= Second content section
${BLOCK_1_CONTENT}= Block 1 content
${BLOCK_2_CONTENT}= Block 2 content
+${DATABLOCK_NAME}= Dates data block name
*** Test Cases ***
@@ -27,6 +29,18 @@ Create new release
user navigates to publication page from dashboard ${PUBLICATION_NAME}
user creates release from publication page ${PUBLICATION_NAME} Academic year Q1 2020
+Upload a subject
+ user navigates to draft release page from dashboard ${PUBLICATION_NAME}
+ ... ${RELEASE_NAME}
+
+ user uploads subject Dates test subject dates.csv dates.meta.csv
+
+Create a data block
+ user creates data block for dates csv
+ ... Dates test subject
+ ... ${DATABLOCK_NAME}
+ ... Data Block 1 title
+
Give analyst1 publication owner permissions to work on release
user gives analyst publication owner access ${PUBLICATION_NAME}
@@ -88,8 +102,8 @@ Switch to bau1 to add review comments for first text block
user presses keys CTRL+a
user adds comment to selected text ${block} Test comment 1
- user checks list has x items testid:unresolvedComments 1 ${block}
- user checks list item contains testid:unresolvedComments 1 Test comment 1 ${block}
+ user checks list has x items testid:comments-unresolved 1 ${block}
+ user checks list item contains testid:comments-unresolved 1 Test comment 1 ${block}
${editor}= get editor ${block}
user sets focus to element ${editor}
@@ -99,9 +113,9 @@ Switch to bau1 to add review comments for first text block
sleep 0.1 # Prevent intermittent failure where toolbar button is disabled
user adds comment to selected text ${block} Test comment 2
- user checks list has x items testid:unresolvedComments 2 ${block}
- user checks list item contains testid:unresolvedComments 1 Test comment 1 ${block}
- user checks list item contains testid:unresolvedComments 2 Test comment 2 ${block}
+ user checks list has x items testid:comments-unresolved 2 ${block}
+ user checks list item contains testid:comments-unresolved 1 Test comment 1 ${block}
+ user checks list item contains testid:comments-unresolved 2 Test comment 2 ${block}
user saves autosaving text block ${block}
@@ -115,8 +129,8 @@ Add review comment for second text block as bau1
user presses keys CTRL+a
user adds comment to selected text ${block} Test comment 3
- user checks list has x items testid:unresolvedComments 1 ${block}
- user checks list item contains testid:unresolvedComments 1 Test comment 3 ${block}
+ user checks list has x items testid:comments-unresolved 1 ${block}
+ user checks list item contains testid:comments-unresolved 1 Test comment 3 ${block}
Switch to analyst1 to check second text block is locked
user switches to analyst1 browser
@@ -162,9 +176,9 @@ Switch to analyst1 to resolve comment for first text block
user switches to analyst1 browser
${block}= get accordion section block First content section 1 id:releaseMainContent
- user checks list has x items testid:unresolvedComments 2 ${block}
- user checks list item contains testid:unresolvedComments 1 Test comment 1 ${block}
- user checks list item contains testid:unresolvedComments 2 Test comment 2 ${block}
+ user checks list has x items testid:comments-unresolved 2 ${block}
+ user checks list item contains testid:comments-unresolved 1 Test comment 1 ${block}
+ user checks list item contains testid:comments-unresolved 2 Test comment 2 ${block}
${comment}= user gets unresolved comment Test comment 1 ${block}
${author}= get child element ${comment} testid:comment-author
@@ -181,13 +195,13 @@ Switch to analyst1 to resolve comment for first text block
... ${block}
... testid:Expand Details Section Resolved comments (1) 10
- user checks list has x items testid:unresolvedComments 1 ${block}
- user checks list item contains testid:unresolvedComments 1 Test comment 2 ${block}
+ user checks list has x items testid:comments-unresolved 1 ${block}
+ user checks list item contains testid:comments-unresolved 1 Test comment 2 ${block}
user opens details dropdown Resolved comments (1) ${block}
- user checks list has x items testid:resolvedComments 1 ${block}
- user checks list item contains testid:resolvedComments 1 Test comment 1 ${block}
+ user checks list has x items testid:comments-resolved 1 ${block}
+ user checks list item contains testid:comments-resolved 1 Test comment 1 ${block}
${comment}= user gets resolved comment Test comment 1 ${block}
user waits until element contains ${comment} Resolved by Analyst1 User1
@@ -210,8 +224,8 @@ Switch back to analyst1 to resolve second text block
# avoid set page view box getting in the way
user scrolls down 600
- user checks list has x items testid:unresolvedComments 1 ${block}
- user checks list item contains testid:unresolvedComments 1 Test comment 3 ${block}
+ user checks list has x items testid:comments-unresolved 1 ${block}
+ user checks list item contains testid:comments-unresolved 1 Test comment 3 ${block}
${comment}= user gets unresolved comment Test comment 3 ${block}
${author}= get child element ${comment} testid:comment-author
@@ -225,11 +239,11 @@ Switch back to analyst1 to resolve second text block
... ${block}
... testid:Expand Details Section Resolved comments (1) 10
- user waits until parent does not contain element ${block} testid:unresolvedComments
+ user waits until parent does not contain element ${block} testid:comments-unresolved
user opens details dropdown Resolved comments (1) ${block}
- user checks list has x items testid:resolvedComments 1 ${block}
- user checks list item contains testid:resolvedComments 1 Test comment 3 ${block}
+ user checks list has x items testid:comments-resolved 1 ${block}
+ user checks list item contains testid:comments-resolved 1 Test comment 3 ${block}
${comment}= user gets resolved comment Test comment 3 ${block}
user waits until element contains ${comment} Resolved by Analyst1 User1
@@ -253,10 +267,52 @@ Delete unresolved comment as bau1
${block}= get accordion section block First content section 1 id:releaseMainContent
${comment}= user gets unresolved comment Test updated comment 2 ${block}
user clicks button Delete ${comment}
- user waits until parent does not contain element ${block} testid:unresolvedComments
+ user waits until parent does not contain element ${block} testid:comments-unresolved
user saves autosaving text block ${block}
+Add second content section as analyst1
+ user switches to analyst1 browser
+ user scrolls to element xpath://button[text()="Add new section"]
+ user waits until button is enabled Add new section
+ user clicks button Add new section
+ user changes accordion section title 2 ${SECTION_2_TITLE} id:releaseMainContent
+
+Add data block
+ user adds data block to editable accordion section ${SECTION_2_TITLE} ${DATABLOCK_NAME}
+ ... id:releaseMainContent
+ ${block}= set variable xpath://*[@data-testid="Data block - ${DATABLOCK_NAME}"]
+ user waits until page contains element ${block} %{WAIT_SMALL}
+
+Add review comment for data block as bau1
+ user switches to bau1 browser
+ user reloads page
+ user opens accordion section ${SECTION_2_TITLE} id:releaseMainContent
+ ${block}= set variable xpath://*[@data-testid="data-block-comments-${DATABLOCK_NAME}"]
+ user adds comment to data block ${block} Test data block comment
+
+ user checks list has x items testid:comments-unresolved 1 ${block}
+ user checks list item contains testid:comments-unresolved 1 Test data block comment ${block}
+
+Resolve comment for data block as analyst1
+ user switches to analyst1 browser
+ user reloads page
+ user closes Set Page View box
+ user opens accordion section ${SECTION_2_TITLE} id:releaseMainContent
+ user scrolls down 400
+ ${block}= set variable xpath://*[@data-testid="data-block-comments-${DATABLOCK_NAME}"]
+ ${comment}= user gets unresolved comment Test data block comment ${block}
+
+ user clicks button Resolve ${comment}
+
+ user waits until parent contains element
+ ... ${block}
+ ... testid:Expand Details Section Resolved comments (1) 10
+
+ user opens details dropdown Resolved comments (1) ${block}
+ user checks list has x items testid:comments-resolved 1 ${block}
+ user checks list item contains testid:comments-resolved 1 Test data block comment ${block}
+
*** Keywords ***
user adds comment to selected text
@@ -271,3 +327,9 @@ user adds comment to selected text
${textarea}= get child element ${comments} label:Comment
user enters text into element ${textarea} ${text}
user clicks button Add comment ${comments}
+
+user adds comment to data block
+ [Arguments] ${block} ${text}
+ user clicks button Add comment ${block}
+ user enters text into element label:Comment ${text}
+ user clicks button Add comment ${block}
diff --git a/tests/robot-tests/tests/libs/admin-common.robot b/tests/robot-tests/tests/libs/admin-common.robot
index 5b566a6e88f..456ecbd37c8 100644
--- a/tests/robot-tests/tests/libs/admin-common.robot
+++ b/tests/robot-tests/tests/libs/admin-common.robot
@@ -780,14 +780,14 @@ user waits until modal is not visible
user gets resolved comments
[Arguments] ${parent}=css:body
- user waits until parent contains element ${parent} testid:resolvedComments
- ${comments}= get child element ${parent} testid:resolvedComments
+ user waits until parent contains element ${parent} testid:comments-resolved
+ ${comments}= get child element ${parent} testid:comments-resolved
[Return] ${comments}
user gets unresolved comments
[Arguments] ${parent}=css:body
- user waits until parent contains element ${parent} testid:unresolvedComments
- ${comments}= get child element ${parent} testid:unresolvedComments
+ user waits until parent contains element ${parent} testid:comments-unresolved
+ ${comments}= get child element ${parent} testid:comments-unresolved
[Return] ${comments}
user gets unresolved comment