Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
9422dade
Unverified
Commit
9422dade
authored
2 years ago
by
Alexander Polyankin
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add E2E tests for showing/hiding visualizations for pinned questions (#23465)
parent
a58b5576
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontend/test/metabase/scenarios/collections/collection-pinned-overview.cy.spec.js
+87
-7
87 additions, 7 deletions
...enarios/collections/collection-pinned-overview.cy.spec.js
with
87 additions
and
7 deletions
frontend/test/metabase/scenarios/collections/collection-pinned-overview.cy.spec.js
+
87
−
7
View file @
9422dade
...
...
@@ -26,6 +26,23 @@ const PIVOT_QUESTION_DETAILS = {
},
};
const
SQL_QUESTION_DETAILS
=
{
name
:
"
SQL with parameters
"
,
display
:
"
scalar
"
,
native
:
{
"
template-tags
"
:
{
filter
:
{
id
:
"
ce8f111c-24c4-6823-b34f-f704404572f1
"
,
name
:
"
filter
"
,
"
display-name
"
:
"
Filter
"
,
type
:
"
text
"
,
required
:
true
,
},
},
query
:
"
select {{filter}}
"
,
},
};
describe
(
"
scenarios > collection pinned items overview
"
,
()
=>
{
beforeEach
(()
=>
{
restore
();
...
...
@@ -38,7 +55,9 @@ describe("scenarios > collection pinned items overview", () => {
it
(
"
should be able to pin a dashboard
"
,
()
=>
{
openRootCollection
();
openUnpinnedItemMenu
(
DASHBOARD_NAME
);
popover
().
within
(()
=>
cy
.
findByText
(
"
Pin this
"
).
click
());
popover
()
.
findByText
(
"
Pin this
"
)
.
click
();
cy
.
wait
(
"
@getPinnedItems
"
);
getPinnedSection
().
within
(()
=>
{
...
...
@@ -52,7 +71,9 @@ describe("scenarios > collection pinned items overview", () => {
it
(
"
should be able to pin a question
"
,
()
=>
{
openRootCollection
();
openUnpinnedItemMenu
(
QUESTION_NAME
);
popover
().
within
(()
=>
cy
.
findByText
(
"
Pin this
"
).
click
());
popover
()
.
findByText
(
"
Pin this
"
)
.
click
();
cy
.
wait
([
"
@getPinnedItems
"
,
"
@getCardQuery
"
]);
getPinnedSection
().
within
(()
=>
{
...
...
@@ -82,7 +103,9 @@ describe("scenarios > collection pinned items overview", () => {
openRootCollection
();
openUnpinnedItemMenu
(
MODEL_NAME
);
popover
().
within
(()
=>
cy
.
findByText
(
"
Pin this
"
).
click
());
popover
()
.
findByText
(
"
Pin this
"
)
.
click
();
cy
.
wait
(
"
@getPinnedItems
"
);
getPinnedSection
().
within
(()
=>
{
...
...
@@ -98,7 +121,9 @@ describe("scenarios > collection pinned items overview", () => {
openRootCollection
();
openPinnedItemMenu
(
DASHBOARD_NAME
);
popover
().
within
(()
=>
cy
.
findByText
(
"
Unpin
"
).
click
());
popover
()
.
findByText
(
"
Unpin
"
)
.
click
();
cy
.
wait
(
"
@getPinnedItems
"
);
getPinnedSection
().
should
(
"
not.exist
"
);
...
...
@@ -109,7 +134,9 @@ describe("scenarios > collection pinned items overview", () => {
openRootCollection
();
openPinnedItemMenu
(
DASHBOARD_NAME
);
popover
().
within
(()
=>
cy
.
findByText
(
"
Move
"
).
click
());
popover
()
.
findByText
(
"
Move
"
)
.
click
();
cy
.
findByText
(
`Move "
${
DASHBOARD_NAME
}
"?`
).
should
(
"
be.visible
"
);
});
...
...
@@ -119,7 +146,9 @@ describe("scenarios > collection pinned items overview", () => {
openRootCollection
();
openPinnedItemMenu
(
DASHBOARD_NAME
);
popover
().
within
(()
=>
cy
.
findByText
(
"
Duplicate
"
).
click
());
popover
()
.
findByText
(
"
Duplicate
"
)
.
click
();
cy
.
findByText
(
`Duplicate "
${
DASHBOARD_NAME
}
"`
).
should
(
"
be.visible
"
);
});
...
...
@@ -129,12 +158,63 @@ describe("scenarios > collection pinned items overview", () => {
openRootCollection
();
openPinnedItemMenu
(
DASHBOARD_NAME
);
popover
().
within
(()
=>
cy
.
findByText
(
"
Archive
"
).
click
());
popover
()
.
findByText
(
"
Archive
"
)
.
click
();
cy
.
wait
(
"
@getPinnedItems
"
);
getPinnedSection
().
should
(
"
not.exist
"
);
cy
.
findByText
(
DASHBOARD_NAME
).
should
(
"
not.exist
"
);
});
it
(
"
should be able to hide the visualization for a pinned question
"
,
()
=>
{
cy
.
request
(
"
PUT
"
,
"
/api/card/2
"
,
{
collection_position
:
1
});
openRootCollection
();
openPinnedItemMenu
(
QUESTION_NAME
);
popover
()
.
findByText
(
"
Don’t show visualization
"
)
.
click
();
cy
.
wait
(
"
@getPinnedItems
"
);
getPinnedSection
().
within
(()
=>
{
cy
.
findByText
(
"
18,760
"
).
should
(
"
not.exist
"
);
cy
.
findByText
(
"
A question
"
).
should
(
"
be.visible
"
);
cy
.
findByText
(
QUESTION_NAME
).
click
();
cy
.
url
().
should
(
"
include
"
,
"
/question/2
"
);
});
});
it
(
"
should be able to show the visualization for a pinned question
"
,
()
=>
{
cy
.
request
(
"
PUT
"
,
"
/api/card/2
"
,
{
collection_position
:
1
,
collection_preview
:
false
,
});
openRootCollection
();
openPinnedItemMenu
(
QUESTION_NAME
);
popover
()
.
findByText
(
"
Show visualization
"
)
.
click
();
cy
.
wait
([
"
@getPinnedItems
"
,
"
@getCardQuery
"
]);
getPinnedSection
().
within
(()
=>
{
cy
.
findByText
(
QUESTION_NAME
).
should
(
"
be.visible
"
);
cy
.
findByText
(
"
18,760
"
).
should
(
"
be.visible
"
);
});
});
it
(
"
should automatically hide the visualization for pinned native questions with missing required parameters
"
,
()
=>
{
cy
.
createNativeQuestion
(
SQL_QUESTION_DETAILS
).
then
(({
body
:
{
id
}
})
=>
{
cy
.
request
(
"
PUT
"
,
`/api/card/
${
id
}
`
,
{
collection_position
:
1
});
});
openRootCollection
();
getPinnedSection
().
within
(()
=>
{
cy
.
findByText
(
SQL_QUESTION_DETAILS
.
name
).
should
(
"
be.visible
"
);
cy
.
findByText
(
"
A question
"
).
should
(
"
be.visible
"
);
});
});
});
const
getPinnedSection
=
()
=>
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment