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

Re-enable mention intermittent failed cases #2403

Merged
merged 11 commits into from
Oct 14, 2024
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Re-enable mention intermittently failed test cases",
"packageName": "@ni/nimble-components",
"email": "123377167+aagash-ni@users.noreply.github.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,7 @@ export class RichTextEditorPageObject {
.run();
await waitForUpdatesAsync();

if (this.isMentionListboxOpened()) {
this.richTextEditorElement.tiptapEditor.commands.focus();
await waitForUpdatesAsync();
}
await this.focusEditorIfMentionListboxOpened();
}

public async setCursorPosition(position: number): Promise<void> {
Expand Down Expand Up @@ -439,6 +436,8 @@ export class RichTextEditorPageObject {
}

public async clickMentionListboxOption(index: number): Promise<void> {
await this.focusEditorIfMentionListboxOpened();

const listOption = this.getAllListItemsInMentionBox()[index];
listOption?.click();
await waitForUpdatesAsync();
Expand Down Expand Up @@ -530,4 +529,11 @@ export class RichTextEditorPageObject {
);
return parserMentionConfig;
}

private async focusEditorIfMentionListboxOpened(): Promise<void> {
if (this.isMentionListboxOpened()) {
this.richTextEditorElement.tiptapEditor.commands.focus();
await waitForUpdatesAsync();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1542,29 +1542,34 @@ describe('RichTextEditorMentionListbox', () => {
expect(pageObject.isMentionListboxOpened()).toBeTrue();
});

// Intermittent, see https://github.com/ni/nimble/issues/2219
xit('should show mention popup for multiple mention configuration elements', async () => {
it('should show mention popup for multiple mention configuration elements', async () => {
await appendUserMentionConfiguration(element, [
{ key: 'user:1', displayName: 'username1' },
{ key: 'user:2', displayName: 'username2' }
]);

await pageObject.setEditorTextContent('@');
expect(pageObject.isMentionListboxOpened()).toBeTrue();

expect(pageObject.getMentionListboxItemsName()).toEqual([
'username1',
'username2'
]);
await pageObject.clickMentionListboxOption(0);
expect(pageObject.isMentionListboxOpened()).toBeTrue();

await pageObject.sliceEditorContent(0, 2);
vivinkrishna-ni marked this conversation as resolved.
Show resolved Hide resolved

await appendTestMentionConfiguration(element, [
{ key: 'test:1', displayName: 'testname1' },
{ key: 'test:2', displayName: 'testname2' }
]);

await pageObject.setEditorTextContent('!');
expect(pageObject.isMentionListboxOpened()).toBeTrue();

expect(pageObject.getMentionListboxItemsName()).toEqual([
'testname1',
'testname2'
]);
expect(pageObject.isMentionListboxOpened()).toBeTrue();
});

it('mention listbox should be closed when cursor position is moved to start and configuration dynamically changes', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,13 @@ Plain text 3`);
<user:1> `);
});

// Intermittent, see https://github.com/ni/nimble/issues/2219
xit('Mention node', async () => {
it('Mention node', async () => {
await appendUserMentionConfiguration(element, [
{ key: 'user:1', displayName: 'username1' }
]);

await commitFirstMentionBoxOptionIntoEditor('@');

expect(element.getMarkdown()).toEqual('<user:1> ');
});

Expand Down