Skip to content
Snippets Groups Projects
Unverified Commit 1c42af37 authored by Mahatthana (Kelvin) Nomsawadi's avatar Mahatthana (Kelvin) Nomsawadi Committed by GitHub
Browse files

Fix flaky test (#41073)

parent 16ab6a83
No related branches found
No related tags found
No related merge requests found
export const commandPalette = () => cy.findByTestId("command-palette"); export const commandPalette = () => cy.findByTestId("command-palette");
export const openCommandPalette = () => cy.get("body").type("{ctrl+k}"); export const openCommandPalette = () => cy.get("body").type("{ctrl+k}{cmd+k}");
export const closeCommandPalette = () => cy.get("body").type("{esc}"); export const closeCommandPalette = () => cy.get("body").type("{esc}");
export const commandPaletteSearch = () => export const commandPaletteSearch = () =>
cy.findByPlaceholderText("Jump to..."); cy.findByPlaceholderText("Jump to...");
...@@ -43,16 +43,16 @@ describe("command palette", () => { ...@@ -43,16 +43,16 @@ describe("command palette", () => {
cy.log("Should search entities and docs"); cy.log("Should search entities and docs");
commandPaletteSearch().type("Orders, Count"); commandPaletteSearch().type("Orders, Count");
cy.findByRole("option", { name: /Orders, Count/ }).should("exist"); cy.findByRole("option", { name: "Orders, Count" }).should("exist");
cy.findByText('Search documentation for "Orders, Count"').should("exist"); cy.findByText('Search documentation for "Orders, Count"').should("exist");
// Since the command palette list is virtualized, we will search for a few // Since the command palette list is virtualized, we will search for a few
// to ensure they're reachable // to ensure they're reachable
commandPaletteSearch().clear().type("People"); commandPaletteSearch().clear().type("People");
cy.findByRole("option", { name: /People/ }).should("exist"); cy.findByRole("option", { name: "People" }).should("exist");
commandPaletteSearch().clear().type("Uploads"); commandPaletteSearch().clear().type("Uploads");
cy.findByRole("option", { name: /Settings - Uploads/ }).should("exist"); cy.findByRole("option", { name: "Settings - Uploads" }).should("exist");
}); });
cy.log("We can close the command palette using escape"); cy.log("We can close the command palette using escape");
...@@ -67,7 +67,7 @@ describe("command palette", () => { ...@@ -67,7 +67,7 @@ describe("command palette", () => {
commandPalette().within(() => { commandPalette().within(() => {
commandPaletteSearch().type("Nested"); commandPaletteSearch().type("Nested");
cy.findByRole("option", { name: /Enable Nested Queries/ }).click(); cy.findByRole("option", { name: "Enable Nested Queries" }).click();
}); });
cy.findByTestId("enable-nested-queries-setting").should("be.visible"); cy.findByTestId("enable-nested-queries-setting").should("be.visible");
...@@ -79,7 +79,7 @@ describe("command palette", () => { ...@@ -79,7 +79,7 @@ describe("command palette", () => {
commandPalette().within(() => { commandPalette().within(() => {
commandPaletteSearch().clear().type("Week"); commandPaletteSearch().clear().type("Week");
cy.findByRole("option", { name: /First day of the week/ }).click(); cy.findByRole("option", { name: "First day of the week" }).click();
}); });
cy.location("pathname").should("contain", "settings/localization"); cy.location("pathname").should("contain", "settings/localization");
......
...@@ -92,6 +92,7 @@ export const PaletteResults = () => { ...@@ -92,6 +92,7 @@ export const PaletteResults = () => {
<Flex gap=".5rem" style={{ minWidth: 0 }}> <Flex gap=".5rem" style={{ minWidth: 0 }}>
{item.icon && ( {item.icon && (
<Icon <Icon
aria-hidden
name={(item.icon as IconName) || "click"} name={(item.icon as IconName) || "click"}
color={ color={
active ? color("brand-light") : color("text-light") active ? color("brand-light") : color("text-light")
...@@ -116,6 +117,7 @@ export const PaletteResults = () => { ...@@ -116,6 +117,7 @@ export const PaletteResults = () => {
</Flex> </Flex>
{active && ( {active && (
<Flex <Flex
aria-hidden
gap="0.5rem" gap="0.5rem"
fw={400} fw={400}
style={{ style={{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment