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
c457863b
Unverified
Commit
c457863b
authored
4 years ago
by
Paul Rosenzweig
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
add cypress helper to visit an adhoc question (#14165)
parent
82fb3984
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend/test/__support__/cypress.js
+9
-0
9 additions, 0 deletions
frontend/test/__support__/cypress.js
frontend/test/metabase/scenarios/visualizations/pivot_tables.cy.spec.js
+25
-25
25 additions, 25 deletions
...metabase/scenarios/visualizations/pivot_tables.cy.spec.js
with
34 additions
and
25 deletions
frontend/test/__support__/cypress.js
+
9
−
0
View file @
c457863b
...
...
@@ -304,3 +304,12 @@ function addQADatabase(engine, db_display_name, port) {
expect
(
status
).
to
.
equal
(
200
);
});
}
export
function
visitQuestionAdhoc
(
question
)
{
if
(
question
.
display
)
{
// without "locking" the display, the QB will run its picking logic and override the setting
question
=
Object
.
assign
({},
question
,
{
displayIsLocked
:
true
});
}
const
hash
=
btoa
(
unescape
(
encodeURIComponent
(
JSON
.
stringify
(
question
))));
cy
.
visit
(
"
/question#
"
+
hash
);
}
This diff is collapsed.
Click to expand it.
frontend/test/metabase/scenarios/visualizations/pivot_tables.cy.spec.js
+
25
−
25
View file @
c457863b
import
{
signInAsAdmin
,
restore
}
from
"
__support__/cypress
"
;
import
{
signInAsAdmin
,
restore
,
visitQuestionAdhoc
,
}
from
"
__support__/cypress
"
;
import
{
SAMPLE_DATASET
}
from
"
__support__/cypress_sample_dataset
"
;
const
{
ORDERS
,
ORDERS_ID
,
PRODUCTS
,
PEOPLE
}
=
SAMPLE_DATASET
;
...
...
@@ -12,17 +16,11 @@ describe("scenarios > visualizations > pivot tables", () => {
});
it
(
"
should be created from an ad-hoc question
"
,
()
=>
{
// We're intentionally setting the visualization to `bar` here
createAndVisitTestQuestion
({
display
:
"
bar
"
});
// By changing the visualization type, we make this an "ad-hoc" question
cy
.
findByText
(
"
Visualization
"
).
click
();
cy
.
get
(
"
.Icon-pivot_table
"
)
.
should
(
"
be.visible
"
)
.
click
();
visitQuestionAdhoc
({
dataset_query
:
testQuery
,
display
:
"
pivot
"
});
cy
.
findByText
(
/Count by Users
?
→ Source and Products
?
→ Category/
);
// ad-hoc title
cy
.
findByText
(
"
Settings
"
).
click
();
assertOnPivotSettings
();
assertOnPivotTable
();
});
...
...
@@ -107,25 +105,27 @@ describe("scenarios > visualizations > pivot tables", () => {
});
});
const
testQuery
=
{
type
:
"
query
"
,
query
:
{
"
source-table
"
:
ORDERS_ID
,
aggregation
:
[[
"
count
"
]],
breakout
:
[
[
"
fk->
"
,
[
"
field-id
"
,
ORDERS
.
USER_ID
],
[
"
field-id
"
,
PEOPLE
.
SOURCE
]],
[
"
fk->
"
,
[
"
field-id
"
,
ORDERS
.
PRODUCT_ID
],
[
"
field-id
"
,
PRODUCTS
.
CATEGORY
],
],
],
},
database
:
1
,
};
function
createAndVisitTestQuestion
({
display
=
"
pivot
"
}
=
{})
{
cy
.
request
(
"
POST
"
,
"
/api/card
"
,
{
name
:
QUESTION_NAME
,
dataset_query
:
{
type
:
"
query
"
,
query
:
{
"
source-table
"
:
ORDERS_ID
,
aggregation
:
[[
"
count
"
]],
breakout
:
[
[
"
fk->
"
,
[
"
field-id
"
,
ORDERS
.
USER_ID
],
[
"
field-id
"
,
PEOPLE
.
SOURCE
]],
[
"
fk->
"
,
[
"
field-id
"
,
ORDERS
.
PRODUCT_ID
],
[
"
field-id
"
,
PRODUCTS
.
CATEGORY
],
],
],
},
database
:
1
,
},
dataset_query
:
testQuery
,
display
,
description
:
null
,
visualization_settings
:
{},
...
...
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