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
207d8146
Unverified
Commit
207d8146
authored
4 years ago
by
Nemanja Glumac
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Repro for #13022 (#13308)
parent
c26d6afc
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/admin/datamodel/metrics.cy.spec.js
+53
-0
53 additions, 0 deletions
...est/metabase/scenarios/admin/datamodel/metrics.cy.spec.js
with
53 additions
and
0 deletions
frontend/test/metabase/scenarios/admin/datamodel/metrics.cy.spec.js
+
53
−
0
View file @
207d8146
...
...
@@ -168,4 +168,57 @@ describe("scenarios > admin > datamodel > metrics", () => {
.
click
();
});
});
describe
(
"
custom metrics
"
,
()
=>
{
it
(
"
should save the metric using custom expressions (metabase#13022)
"
,
()
=>
{
cy
.
visit
(
"
/admin/datamodel/metrics
"
);
cy
.
findByText
(
"
New metric
"
).
click
();
cy
.
log
(
"
**Create new metric based on Custom Expression**
"
);
cy
.
findByText
(
"
Select a table
"
).
click
();
popover
().
within
(()
=>
{
cy
.
findByText
(
"
Sample Dataset
"
);
cy
.
findByText
(
"
Orders
"
).
click
();
});
// "Count" is selected by defauult
cy
.
get
(
"
.QueryOption
"
)
.
contains
(
"
Count
"
)
.
click
();
// Override it with "Custom Expression"
popover
().
within
(()
=>
{
cy
.
findByText
(
"
Custom Expression
"
).
click
();
cy
.
get
(
"
[contenteditable='true']
"
)
.
click
()
.
clear
()
.
type
(
"
Sum([Discount] * [Quantity])
"
,
{
delay
:
100
});
cy
.
findByPlaceholderText
(
"
Name (required)
"
)
.
click
()
.
type
(
"
CE
"
,
{
delay
:
100
});
cy
.
findByText
(
"
Done
"
).
click
();
});
const
metricName
=
"
Test CE Metric
"
;
// Give it a name
cy
.
findByPlaceholderText
(
"
Something descriptive but not too long
"
).
type
(
metricName
,
);
// and description
cy
.
findByPlaceholderText
(
"
This is a good place to be more specific about less obvious metric rules
"
,
).
type
(
"
Description
"
);
// Save the custom metric
cy
.
findByText
(
"
Save changes
"
)
.
should
(
"
not.be.disabled
"
)
.
click
();
cy
.
log
(
"
**Refresh the page and assert**
"
);
cy
.
reload
();
cy
.
url
().
should
(
"
be
"
,
"
/admin/datamodel/metrics
"
);
cy
.
findByText
(
'
Unexpected input given to normalize. Expected type to be "object", found "string".
'
,
).
should
(
"
not.exist
"
);
cy
.
findByText
(
metricName
);
});
});
});
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