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

Fix SearchResultTemplateTest #5177

Merged
merged 4 commits into from
Jan 23, 2025
Merged

Conversation

PenghaiZhang
Copy link
Contributor

Checklist
Description of change

According to the log, click of the Add Resource button is intercepted by the ul above the button. Both are parts of the Attachment control which is a React component but used in the Legacty UI.
I guess when the button is visible and the test is about to click it, the list is not yet. However, when the click happens, the list becomes visible and is displayed in where the button was (and the button is moved down to below the list).
So the first potential fix is to add a wait of element being clickable to the button.

@edalex-yinzi
Copy link
Contributor

I tested a similar case but with no luck.
#5176

@PenghaiZhang
Copy link
Contributor Author

I tested a similar case but with no luck. #5176

Have you tried to use JS to do the click ?

@edalex-yinzi
Copy link
Contributor

I tested a similar case but with no luck. #5176

Have you tried to use JS to do the click ?

No. Since you are trying this, I might try a different fix.

@PenghaiZhang
Copy link
Contributor Author

The first run passed. Try again.

@edalex-yinzi
Copy link
Contributor

edalex-yinzi commented Jan 22, 2025

Mine also passed (use JS to click button).

@PenghaiZhang
Copy link
Contributor Author

Third time.

@PenghaiZhang
Copy link
Contributor Author

@edalex-ian This one is ready for review.

Copy link
Member

@edalex-ian edalex-ian left a comment

Choose a reason for hiding this comment

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

Looks good @PenghaiZhang , however we need to document the oddity.

getAddResourceButton().click();
WebElement addResourceButton =
waiter.until(ExpectedConditions.elementToBeClickable(getAddResourceButton()));
((JavascriptExecutor) driver).executeScript("arguments[0].click();", addResourceButton);
Copy link
Member

Choose a reason for hiding this comment

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

It is odd to have to use JS to click the button. It's worth documenting why with a comment.

Copy link
Member

Choose a reason for hiding this comment

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

Actually, please see this comment I made in @edalex-yinzi 's similar PR: #5176 (review)

Copy link
Contributor Author

@PenghaiZhang PenghaiZhang Jan 23, 2025

Choose a reason for hiding this comment

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

I have made a change to use 'forceButtonClickWithJS'.

@edalex-yinzi
Copy link
Contributor

My pr is merged.

@PenghaiZhang
Copy link
Contributor Author

Hi @edalex-ian this PR is ready for review.

Copy link
Member

@edalex-ian edalex-ian left a comment

Choose a reason for hiding this comment

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

LGTM!

@PenghaiZhang PenghaiZhang merged commit e885e09 into develop Jan 23, 2025
3 of 6 checks passed
@PenghaiZhang PenghaiZhang deleted the fix/search-result-template-test branch January 23, 2025 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants