Skip to content

Commit cf52b45

Browse files
BHulovatyiom-ukr
authored andcommitted
AXON-1369: fixed e2e tests for bb new editor
1 parent 2400e04 commit cf52b45

File tree

2 files changed

+13
-17
lines changed

2 files changed

+13
-17
lines changed

e2e/page-objects/fragments/PRComments.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { expect, FrameLocator, Locator } from '@playwright/test';
22

33
const COMMENT_LIST_TES_ID = 'pullrequest.comment-list';
44
const FORM_TEST_ID = 'common.comment-form';
5-
const RICH_EDITOR_TEST_ID = 'common.rich-markdown-editor';
5+
const RICH_EDITOR_TEST_ID = 'common.atlaskit-editor';
66

77
export class PRComments {
88
readonly frame: FrameLocator;
@@ -12,8 +12,6 @@ export class PRComments {
1212
readonly editor: Locator;
1313
readonly editorContent: Locator;
1414
readonly editorConfirmButton: Locator;
15-
readonly editorCancelButton: Locator;
16-
readonly richEditorCheckbox: Locator;
1715
readonly commentList: Locator;
1816
readonly testComment: Locator;
1917

@@ -24,9 +22,7 @@ export class PRComments {
2422
this.form = this.frame.getByTestId(FORM_TEST_ID);
2523
this.editor = this.form.getByTestId(RICH_EDITOR_TEST_ID);
2624
this.editorContent = this.editor.locator('div.ProseMirror[contenteditable="true"]');
27-
this.editorConfirmButton = this.form.getByRole('button', { name: 'save' });
28-
this.editorCancelButton = this.form.getByRole('button', { name: 'cancel' });
29-
this.richEditorCheckbox = this.form.getByRole('checkbox');
25+
this.editorConfirmButton = this.form.getByRole('button', { name: /save/i });
3026
this.commentList = this.frame.getByTestId(COMMENT_LIST_TES_ID);
3127
this.testComment = this.commentList.locator('div.MuiBox-root p').filter({ hasText: 'test comment' }).first();
3228
}
@@ -40,7 +36,5 @@ export class PRComments {
4036
await expect(this.editor).toBeVisible();
4137
await expect(this.editorContent).toBeVisible();
4238
await expect(this.editorConfirmButton).toBeVisible();
43-
await expect(this.editorCancelButton).toBeVisible();
44-
await expect(this.richEditorCheckbox).toBeVisible();
4539
}
4640
}

src/react/atlascode/common/CommentForm.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,17 @@ const CommentForm: React.FC<CommentFormProps> = (props: CommentFormProps) => {
2222
<Grid item xs={10}>
2323
<Grid container spacing={1} direction="column">
2424
<Grid item>
25-
<AtlaskitEditor
26-
defaultValue={props.initialContent}
27-
onSave={props.onSave}
28-
onCancel={props.onCancel}
29-
mentionProvider={Promise.resolve({
30-
unsubscribe: () => {},
31-
} as any as AtlascodeMentionProvider)}
32-
isBitbucket={true}
33-
/>
25+
<div data-testid="common.atlaskit-editor">
26+
<AtlaskitEditor
27+
defaultValue={props.initialContent}
28+
onSave={props.onSave}
29+
onCancel={props.onCancel}
30+
mentionProvider={Promise.resolve({
31+
unsubscribe: () => {},
32+
} as any as AtlascodeMentionProvider)}
33+
isBitbucket={true}
34+
/>
35+
</div>
3436
</Grid>
3537
</Grid>
3638
</Grid>

0 commit comments

Comments
 (0)