mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-06-12 15:37:27 +01:00
fix playwright tests
This commit is contained in:
@@ -155,6 +155,19 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
|
|||||||
if (this.state.errorMessage && this.state.errorMessage !== prevState.errorMessage) {
|
if (this.state.errorMessage && this.state.errorMessage !== prevState.errorMessage) {
|
||||||
scrollToSection("panelContainer");
|
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 {
|
render(): JSX.Element {
|
||||||
|
|||||||
@@ -144,11 +144,7 @@ function TabNav({ tab, active, tabKind }: { tab?: Tab; active: boolean; tabKind?
|
|||||||
)}
|
)}
|
||||||
{isQueryErrorThrown(tab, tabKind) && (
|
{isQueryErrorThrown(tab, tabKind) && (
|
||||||
<TooltipHost content="Error">
|
<TooltipHost content="Error">
|
||||||
<img
|
<img src={errorQuery} alt="Error" style={{ marginTop: 4, marginLeft: 4, width: 10, height: 11 }} />
|
||||||
src={errorQuery}
|
|
||||||
alt="Error"
|
|
||||||
style={{ marginTop: 4, marginLeft: 4, width: 10, height: 11 }}
|
|
||||||
/>
|
|
||||||
</TooltipHost>
|
</TooltipHost>
|
||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -256,8 +256,12 @@ export default class Database implements ViewModels.Database {
|
|||||||
databaseId: this.id(),
|
databaseId: this.id(),
|
||||||
databaseResourceId: this.self,
|
databaseResourceId: this.self,
|
||||||
};
|
};
|
||||||
|
try {
|
||||||
this.offer(await readDatabaseOffer(params));
|
this.offer(await readDatabaseOffer(params));
|
||||||
this.isOfferRead = true;
|
this.isOfferRead = true;
|
||||||
|
} catch {
|
||||||
|
// Don't propagate - leave isOfferRead false so it can be retried
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+10
-1
@@ -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.
|
* 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> {
|
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 });
|
return this.frame.getByRole("menuitem", { name: label });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user