-
Notifications
You must be signed in to change notification settings - Fork 731
fix(amazonq): Reducing error propagation flakiness in UI E2E Tests in utils and Helpers #7882
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -73,25 +73,23 @@ export async function pressShortcut(driver: WebDriver, ...keys: (keyof typeof Ke | |
| * @param prompt The text to write in the chat input | ||
| * @param webview The WebviewView instance | ||
| * @param send Whether to click the send button (defaults to true) | ||
| * @returns Promise<boolean> True if successful | ||
| */ | ||
| export async function writeToChat(prompt: string, webview: WebviewView, send = true): Promise<boolean> { | ||
| export async function writeToChat(prompt: string, webview: WebviewView, send = true): Promise<void> { | ||
| const chatInput = await waitForElement(webview, By.css('.mynah-chat-prompt-input')) | ||
| await chatInput.sendKeys(prompt) | ||
| if (send === true) { | ||
| if (send) { | ||
| const sendButton = await waitForElement(webview, By.css('.mynah-chat-prompt-button')) | ||
| await sendButton.click() | ||
| } | ||
| return true | ||
| } | ||
|
|
||
| /** | ||
| * Waits for a chat response to be generated | ||
| * @param webview The WebviewView instance | ||
| * @param timeout The timeout in milliseconds | ||
| * @returns Promise<boolean> True if a response was detected, false if timeout occurred | ||
| * @throws Error if timeout occurs before response is detected | ||
| */ | ||
| export async function waitForChatResponse(webview: WebviewView, timeout = 15000): Promise<boolean> { | ||
| export async function waitForChatResponse(webview: WebviewView, timeout = 15000): Promise<void> { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. out of curiosity, is there a reason we need to increase the default here? |
||
| const startTime = Date.now() | ||
|
|
||
| while (Date.now() - startTime < timeout) { | ||
|
|
@@ -103,34 +101,27 @@ export async function waitForChatResponse(webview: WebviewView, timeout = 15000) | |
| const chatItems = await latestContainer.findElements(By.css('*')) | ||
|
|
||
| if (chatItems.length >= 2) { | ||
| return true | ||
| return | ||
| } | ||
| } | ||
| await sleep(500) | ||
| } | ||
|
|
||
| return false | ||
| throw new Error('Timeout waiting for chat response') | ||
| } | ||
|
|
||
| /** | ||
| * Clears the text in the chat input field | ||
| * @param webview The WebviewView instance | ||
| * @returns Promise<boolean> True if successful, false if an error occurred | ||
| */ | ||
| export async function clearChat(webview: WebviewView): Promise<boolean> { | ||
| try { | ||
| const chatInput = await waitForElement(webview, By.css('.mynah-chat-prompt-input')) | ||
| await chatInput.sendKeys( | ||
| process.platform === 'darwin' | ||
| ? '\uE03D\u0061' // Command+A on macOS | ||
| : '\uE009\u0061' // Ctrl+A on Windows/Linux | ||
| ) | ||
| await chatInput.sendKeys('\uE003') // Backspace | ||
| return true | ||
| } catch (e) { | ||
| console.error('Error clearing chat input:', e) | ||
| return false | ||
| } | ||
| export async function clearChat(webview: WebviewView): Promise<void> { | ||
| const chatInput = await waitForElement(webview, By.css('.mynah-chat-prompt-input')) | ||
| await chatInput.sendKeys( | ||
| process.platform === 'darwin' | ||
| ? '\uE03D\u0061' // Command+A on macOS | ||
| : '\uE009\u0061' // Ctrl+A on Windows/Linux | ||
| ) | ||
| await chatInput.sendKeys('\uE003') // Backspace | ||
| } | ||
|
|
||
| /** | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo: look into this sleep.