-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Properly highlight models as the data source (#39792)
* [HDS] Prep/cleanup steps for Highlighting the data source (#39681) * Rename `DATA_BUCKET` key to `MODELS` * Rename misleading method `isSavedQuestionSelected` is too narrow because we can also have other saved entities, such as models (and soon metrics) as the selected source. * Fix type for `selectedTableId` * Extract `sourceId` * Rename saved question instances to saved entity * Rename related components * Show models correctly in the data source picker (#39686) * Show models correctly in the data source picker * Address review comments * Destructure props * Add E2E reproduction for #39699 * Prevent accessing potentially stale value Closes #39699
- Loading branch information
1 parent
0a1f97f
commit 56d4c48
Showing
11 changed files
with
148 additions
and
70 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
e2e/test/scenarios/question/reproductions/39699-notebook-data-source-models.cy.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.