Skip to content
Open
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 @@ -52,7 +52,7 @@ public String getPrompt()
public CalculatedColumnAssistantDialog submitPrompt()
{
int previousCount = getAssistantResponses().size();
elementCache().promptSubmitButton.click();
clickSubmitWithoutWaiting();
waitForThinkingSpinnerToDisappear();
WebDriverWrapper.waitFor(() -> getAssistantResponses().size() > previousCount,
"No new assistant response appeared in chat history.", 10_000);
Expand All @@ -61,7 +61,8 @@ public CalculatedColumnAssistantDialog submitPrompt()

private void waitForThinkingSpinnerToDisappear()
{
WebDriverWrapper.waitFor(() -> !Locators.thinkingSpinner.existsIn(this), 60_000);
WebDriverWrapper.waitFor(() -> !Locators.thinkingSpinner.existsIn(this) &&
Locators.submitIcon.existsIn(elementCache().promptSubmitButton), 60_000);
}

/**
Expand Down Expand Up @@ -175,7 +176,7 @@ public boolean isPending()
*/
public void clickStop()
{
Locators.stopButton.findElement(this).click();
Locators.stopIcon.findElement(elementCache().promptSubmitButton).click();
}

/**
Expand All @@ -184,7 +185,10 @@ public void clickStop()
*/
public void clickSubmitWithoutWaiting()
{
elementCache().promptSubmitButton.click();
int previousCount = Locators.userPrompt.findElements(this).size();
Locators.submitIcon.findElement(elementCache().promptSubmitButton).click();
WebDriverWrapper.waitFor(() -> Locators.userPrompt.findElements(this).size() > previousCount,
"New prompt didn't appear.", 2_000);
}

private WebElement lastAssistantResponseElement()
Expand Down Expand Up @@ -217,9 +221,14 @@ protected ElementCache elementCache()

public static class Locators
{
public static final Locator.XPathLocator assistantResponse = Locator.tagWithClass("div", "chat-item").withClass("assistant-response");
public static final Locator.XPathLocator chatItem = Locator.byClass("chat-item");

public static final Locator.XPathLocator pendingBubble = Locator.tagWithClass("div", "chat-item").withClass("pending");
public static final Locator.XPathLocator assistantResponse = chatItem
.withClass("assistant-response").withoutClass("pending");

public static final Locator.XPathLocator pendingBubble = chatItem.withClass("pending");

public static final Locator.XPathLocator userPrompt = chatItem.withClass("user-prompt");

public static final Locator.XPathLocator thinkingSpinner = Locator.tagWithClass("i", "fa-spinner");

Expand All @@ -230,8 +239,9 @@ public static class Locators
.withDescendant(Locator.tagWithClass("button", "clickable-text"))
.descendant(Locator.tag("code"));

public static final Locator.XPathLocator stopButton = Locator.tagWithClass("button", "prompt-button")
.withDescendant(Locator.tagWithClass("i", "fa-stop"));
public static final Locator.XPathLocator stopIcon = Locator.byClass("fa-stop");

public static final Locator.XPathLocator submitIcon = Locator.byClass("fa-arrow-up");
}

protected class ElementCache extends ModalDialog.ElementCache
Expand Down