fix playwright tests

This commit is contained in:
Bikram Choudhury
2026-05-25 19:38:35 +05:30
parent d80989e8cc
commit ac378bc36c
4 changed files with 60 additions and 38 deletions
@@ -155,6 +155,19 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
if (this.state.errorMessage && this.state.errorMessage !== prevState.errorMessage) {
scrollToSection("panelContainer");
}
// When the user selects a different "Use existing" database, lazily load its offer so
// the "Provision dedicated throughput" checkbox can appear even if the initial
// loadDatabaseOffers() call could not load this database's offer (e.g. due to a
// transient ARM error shortly after the database was created).
if (!this.state.createNewDatabase && this.state.selectedDatabaseId !== prevState.selectedDatabaseId) {
const selectedDatabase = useDatabases
.getState()
.databases?.find((database) => database.id() === this.state.selectedDatabaseId);
if (selectedDatabase && !selectedDatabase.offer()) {
selectedDatabase.loadOffer().then(() => this.forceUpdate()).catch(console.error);
}
}
}
render(): JSX.Element {
+1 -5
View File
@@ -144,11 +144,7 @@ function TabNav({ tab, active, tabKind }: { tab?: Tab; active: boolean; tabKind?
)}
{isQueryErrorThrown(tab, tabKind) && (
<TooltipHost content="Error">
<img
src={errorQuery}
alt="Error"
style={{ marginTop: 4, marginLeft: 4, width: 10, height: 11 }}
/>
<img src={errorQuery} alt="Error" style={{ marginTop: 4, marginLeft: 4, width: 10, height: 11 }} />
</TooltipHost>
)}
</span>
+4
View File
@@ -256,8 +256,12 @@ export default class Database implements ViewModels.Database {
databaseId: this.id(),
databaseResourceId: this.self,
};
try {
this.offer(await readDatabaseOffer(params));
this.isOfferRead = true;
} catch {
// Don't propagate - leave isOfferRead false so it can be retried
}
}
}
+10 -1
View File
@@ -438,7 +438,16 @@ export class DataExplorer {
* There's only a single "primary" button, but we still require you to pass the label to confirm you're selecting the right button.
*/
async globalCommandButton(label: string): Promise<Locator> {
await this.frame.getByTestId("GlobalCommands").click();
const globalCommands = this.frame.getByTestId("GlobalCommands");
// Prefer the explicit dropdown trigger so we always open the menu rather than
// triggering a primary action directly. The SplitButton (wide sidebar) exposes
// "More commands" and the MenuButton (narrow sidebar) is labelled "New…".
const dropdownTrigger = globalCommands.getByRole("button", { name: "More commands" });
if (await dropdownTrigger.isVisible()) {
await dropdownTrigger.click();
} else {
await globalCommands.click();
}
return this.frame.getByRole("menuitem", { name: label });
}