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
3f3c04cc
Commit
3f3c04cc
authored
7 years ago
by
Atte Keinänen
Browse files
Options
Downloads
Patches
Plain Diff
Remove the new question tests from query_builder as they were already moved
parent
38927251
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontend/test/query_builder/query_builder.integ.spec.js
+0
-140
0 additions, 140 deletions
frontend/test/query_builder/query_builder.integ.spec.js
with
0 additions
and
140 deletions
frontend/test/query_builder/query_builder.integ.spec.js
+
0
−
140
View file @
3f3c04cc
...
...
@@ -90,146 +90,6 @@ describe("QueryBuilder", () => {
await
login
()
})
/**
* Simple tests for seeing if the query builder renders without errors
*/
describe
(
"
for new questions
"
,
async
()
=>
{
let
metricId
=
null
;
let
segmentId
=
null
;
beforeAll
(
async
()
=>
{
const
metricDef
=
{
name
:
"
A Metric
"
,
description
:
"
For testing new question flow
"
,
table_id
:
1
,
show_in_getting_started
:
true
,
definition
:
{
database
:
1
,
query
:
{
aggregation
:
[
"
count
"
]}}}
const
segmentDef
=
{
name
:
"
A Segment
"
,
description
:
"
For testing new question flow
"
,
table_id
:
1
,
definition
:
{
source_table
:
1
,
filter
:
[
"
time-interval
"
,
[
"
field-id
"
,
1
],
-
30
,
"
day
"
]}}
// Needed for question creation flow
metricId
=
(
await
MetricApi
.
create
(
metricDef
)).
id
;
segmentId
=
(
await
SegmentApi
.
create
(
segmentDef
)).
id
;
})
afterAll
(
async
()
=>
{
await
MetricApi
.
delete
({
metricId
,
revision_message
:
"
The lifetime of this metric was just a few seconds
"
})
await
SegmentApi
.
delete
({
segmentId
,
revision_message
:
"
Sadly this segment didn't enjoy a long life either
"
})
})
it
(
"
redirects /question to /question/new
"
,
async
()
=>
{
const
store
=
await
createTestStore
()
store
.
pushPath
(
"
/question
"
);
mount
(
store
.
getAppContainer
());
await
store
.
waitForActions
([
REDIRECT_TO_NEW_QUESTION_FLOW
])
expect
(
store
.
getPath
()).
toBe
(
"
/question/new
"
)
})
it
(
"
renders normally on page load
"
,
async
()
=>
{
const
store
=
await
createTestStore
()
store
.
pushPath
(
Urls
.
newQuestion
());
const
app
=
mount
(
store
.
getAppContainer
());
await
store
.
waitForActions
([
RESET_QUERY
,
FETCH_METRICS
,
FETCH_SEGMENTS
]);
await
store
.
waitForActions
([
SET_REQUEST_STATE
]);
expect
(
app
.
find
(
NewQueryOption
).
length
).
toBe
(
4
)
});
it
(
"
lets you start a custom gui question
"
,
async
()
=>
{
const
store
=
await
createTestStore
()
store
.
pushPath
(
Urls
.
newQuestion
());
const
app
=
mount
(
store
.
getAppContainer
());
await
store
.
waitForActions
([
RESET_QUERY
,
FETCH_METRICS
,
FETCH_SEGMENTS
]);
await
store
.
waitForActions
([
SET_REQUEST_STATE
]);
click
(
app
.
find
(
NewQueryOption
).
filterWhere
((
c
)
=>
c
.
prop
(
'
title
'
)
===
"
Custom
"
))
await
store
.
waitForActions
(
INITIALIZE_QB
,
UPDATE_URL
,
LOAD_METADATA_FOR_CARD
);
expect
(
getQuery
(
store
.
getState
())
instanceof
StructuredQuery
).
toBe
(
true
)
})
it
(
"
lets you start a custom native question
"
,
async
()
=>
{
// Don't render Ace editor in tests because it uses many DOM methods that aren't supported by jsdom
// see also parameters.integ.js for more notes about Ace editor testing
NativeQueryEditor
.
prototype
.
loadAceEditor
=
()
=>
{}
const
store
=
await
createTestStore
()
store
.
pushPath
(
Urls
.
newQuestion
());
const
app
=
mount
(
store
.
getAppContainer
());
await
store
.
waitForActions
([
RESET_QUERY
,
FETCH_METRICS
,
FETCH_SEGMENTS
,
FETCH_DATABASES
]);
await
store
.
waitForActions
([
SET_REQUEST_STATE
]);
click
(
app
.
find
(
NewQueryOption
).
filterWhere
((
c
)
=>
c
.
prop
(
'
title
'
)
===
"
SQL
"
))
await
store
.
waitForActions
(
INITIALIZE_QB
);
expect
(
getQuery
(
store
.
getState
())
instanceof
NativeQuery
).
toBe
(
true
)
// No database selector visible because in test environment we should
// only have a single database
expect
(
app
.
find
(
DataSelector
).
length
).
toBe
(
0
)
// The name of the database should be displayed
expect
(
app
.
find
(
NativeQueryEditor
).
text
()).
toMatch
(
/Sample Dataset/
)
})
it
(
"
lets you start a question from a metric
"
,
async
()
=>
{
const
store
=
await
createTestStore
()
store
.
pushPath
(
Urls
.
newQuestion
());
const
app
=
mount
(
store
.
getAppContainer
());
await
store
.
waitForActions
([
RESET_QUERY
,
FETCH_METRICS
,
FETCH_SEGMENTS
]);
await
store
.
waitForActions
([
SET_REQUEST_STATE
]);
click
(
app
.
find
(
NewQueryOption
).
filterWhere
((
c
)
=>
c
.
prop
(
'
title
'
)
===
"
Metrics
"
))
await
store
.
waitForActions
(
FETCH_DATABASES
);
await
store
.
waitForActions
([
SET_REQUEST_STATE
]);
expect
(
store
.
getPath
()).
toBe
(
"
/question/new/metric
"
)
const
entitySearch
=
app
.
find
(
EntitySearch
)
const
viewByCreator
=
entitySearch
.
find
(
SearchGroupingOption
).
last
()
expect
(
viewByCreator
.
text
()).
toBe
(
"
Creator
"
);
click
(
viewByCreator
)
expect
(
store
.
getPath
()).
toBe
(
"
/question/new/metric?grouping=creator
"
)
const
group
=
entitySearch
.
find
(
SearchResultsGroup
)
expect
(
group
.
prop
(
'
groupName
'
)).
toBe
(
"
Bobby Tables
"
)
const
metricSearchResult
=
group
.
find
(
SearchResultListItem
)
.
filterWhere
((
item
)
=>
/A Metric/
.
test
(
item
.
text
()))
click
(
metricSearchResult
.
childAt
(
0
))
await
store
.
waitForActions
([
INITIALIZE_QB
,
QUERY_COMPLETED
]);
expect
(
app
.
find
(
AggregationWidget
).
find
(
"
.View-section-aggregation
"
).
text
()
).
toBe
(
"
A Metric
"
)
})
it
(
"
lets you start a question from a segment
"
,
async
()
=>
{
const
store
=
await
createTestStore
()
store
.
pushPath
(
Urls
.
newQuestion
());
const
app
=
mount
(
store
.
getAppContainer
());
await
store
.
waitForActions
([
RESET_QUERY
,
FETCH_METRICS
,
FETCH_SEGMENTS
]);
await
store
.
waitForActions
([
SET_REQUEST_STATE
]);
click
(
app
.
find
(
NewQueryOption
).
filterWhere
((
c
)
=>
c
.
prop
(
'
title
'
)
===
"
Segments
"
))
await
store
.
waitForActions
(
FETCH_DATABASES
);
await
store
.
waitForActions
([
SET_REQUEST_STATE
]);
expect
(
store
.
getPath
()).
toBe
(
"
/question/new/segment
"
)
const
entitySearch
=
app
.
find
(
EntitySearch
)
const
viewByTable
=
entitySearch
.
find
(
SearchGroupingOption
).
at
(
1
)
expect
(
viewByTable
.
text
()).
toBe
(
"
Table
"
);
click
(
viewByTable
)
expect
(
store
.
getPath
()).
toBe
(
"
/question/new/segment?grouping=table
"
)
const
group
=
entitySearch
.
find
(
SearchResultsGroup
)
.
filterWhere
((
group
)
=>
group
.
prop
(
'
groupName
'
)
===
"
Orders
"
)
const
metricSearchResult
=
group
.
find
(
SearchResultListItem
)
.
filterWhere
((
item
)
=>
/A Segment/
.
test
(
item
.
text
()))
click
(
metricSearchResult
.
childAt
(
0
))
await
store
.
waitForActions
([
INITIALIZE_QB
,
QUERY_COMPLETED
]);
expect
(
app
.
find
(
FilterWidget
).
find
(
"
.Filter-section-value
"
).
text
()).
toBe
(
"
A Segment
"
)
})
});
describe
(
"
visualization settings
"
,
()
=>
{
it
(
"
lets you hide a field for a raw data table
"
,
async
()
=>
{
const
{
store
,
qb
}
=
await
initQBWithReviewsTable
();
...
...
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