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

Draft | Run mention intermittent failing test in loop #2396

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ export class RichTextEditorPageObject {
.run();
await waitForUpdatesAsync();

if (this.isMentionListboxOpened()) {
if (await this.isMentionListboxOpened()) {
this.richTextEditorElement.tiptapEditor.commands.focus();
await waitForUpdatesAsync();
}
Expand All @@ -274,18 +274,47 @@ export class RichTextEditorPageObject {
.deleteRange({ from, to })
.run();
await waitForUpdatesAsync();

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

public getEditorLastChildAttribute(attribute: string): string {
return getLastChildElementAttribute(attribute, this.getTiptapEditor());
}

public isMentionListboxOpened(): boolean {
return (
!this.getMentionListbox()
?.shadowRoot?.querySelector(anchoredRegionTag)
?.hasAttribute('hidden') ?? false
public async isMentionListboxOpened(): Promise<boolean> {
const mentionListbox = this.getMentionListbox();
if (!mentionListbox) {
// eslint-disable-next-line no-console
console.log('Mention listbox not found');
return false;
}
const shadowRoot = mentionListbox.shadowRoot;
if (!shadowRoot) {
// eslint-disable-next-line no-console
console.log('Mention listbox shadow root not found');
return false;
}

const anchoredRegion = shadowRoot.querySelector(anchoredRegionTag);
if (!anchoredRegion) {
// eslint-disable-next-line no-console
console.log('Anchored region not found');
return false;
}
await waitForUpdatesAsync();

// eslint-disable-next-line no-console
console.log(
'Anchored region hidden attribute:',
!anchoredRegion.hasAttribute('hidden')
);
// eslint-disable-next-line no-console
console.log('Anchored region hidden property:', !anchoredRegion.hidden);
return !anchoredRegion.hidden;
}

public getEditorMentionViewAttributeValues(attribute: string): string[] {
Expand Down Expand Up @@ -439,7 +468,16 @@ export class RichTextEditorPageObject {
}

public async clickMentionListboxOption(index: number): Promise<void> {
// if (await this.isMentionListboxOpened()) {
// this.richTextEditorElement.tiptapEditor.commands.focus();
// await waitForUpdatesAsync();
// }
const listOption = this.getAllListItemsInMentionBox()[index];
// eslint-disable-next-line no-console
console.log(
'Editor focus status:',
this.richTextEditorElement.tiptapEditor.isFocused
);
listOption?.click();
await waitForUpdatesAsync();
}
Expand Down
Loading
Loading