Skip to content

Commit

Permalink
Add E2E reproduction for #39699
Browse files Browse the repository at this point in the history
  • Loading branch information
nemanjaglumac committed Mar 6, 2024
1 parent fe802fc commit 079cd6a
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { SAMPLE_DATABASE } from "e2e/support/cypress_sample_database";
import { SECOND_COLLECTION_ID } from "e2e/support/cypress_sample_instance_data";
import { restore, openNotebook } from "e2e/support/helpers";

const { REVIEWS_ID } = SAMPLE_DATABASE;

const modelDetails = {
name: "GUI Model",
query: { "source-table": REVIEWS_ID, limit: 1 },
display: "table",
type: "model",
collection_id: SECOND_COLLECTION_ID,
};

describe("issue 39699", () => {
beforeEach(() => {
restore();
cy.signInAsAdmin();

cy.createQuestion(modelDetails, { visitQuestion: true });
});

it("data selector should properly show a model as the source (metabase#39699)", () => {
openNotebook();
cy.findByTestId("data-step-cell")
.should("have.text", modelDetails.name)
.click();

cy.findByTestId("saved-entity-back-navigation").should(
"have.text",
"Models",
);

cy.findByTestId("saved-entity-collection-tree").within(() => {
cy.findByLabelText("Our analytics")
.should("have.attr", "aria-expanded", "false")
.and("have.attr", "aria-selected", "false");
cy.findByLabelText("First collection")
.should("have.attr", "aria-expanded", "true")
.and("have.attr", "aria-selected", "false");
cy.findByLabelText("Second collection")
.should("have.attr", "aria-expanded", "false")
.and("have.attr", "aria-selected", "true");
});

cy.findByTestId("select-list")
.findByLabelText(modelDetails.name)
.should("have.attr", "aria-selected", "true");
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ function SavedEntityPicker({
return (
<SavedEntityPickerRoot>
<CollectionsContainer>
<BackButton onClick={onBack}>
<BackButton onClick={onBack} data-testid="saved-entity-back-navigation">
<Icon name="chevronleft" className="mr1" />
{isDatasets ? t`Models` : t`Saved Questions`}
</BackButton>
<TreeContainer>
<TreeContainer data-testid="saved-entity-collection-tree">
<Tree
data={collectionTree}
onSelect={handleSelect}
Expand Down

0 comments on commit 079cd6a

Please sign in to comment.