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
6fda6397
Unverified
Commit
6fda6397
authored
7 years ago
by
Kyle Doherty
Browse files
Options
Downloads
Patches
Plain Diff
add navigation test case
parent
60fe9f56
Branches
backport-71c506a4fd11f1ed7d7661018f75c80f1f2d9369
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontend/test/xray/xray.integ.spec.js
+35
-10
35 additions, 10 deletions
frontend/test/xray/xray.integ.spec.js
with
35 additions
and
10 deletions
frontend/test/xray/xray.integ.spec.js
+
35
−
10
View file @
6fda6397
...
...
@@ -39,6 +39,7 @@ import { getXrayEnabled, getMaxCost } from "metabase/xray/selectors";
import
Icon
from
"
metabase/components/Icon
"
import
Toggle
from
"
metabase/components/Toggle
"
import
{
Link
}
from
'
react-router
'
import
SettingsXrayForm
from
"
metabase/admin/settings/components/SettingsXrayForm
"
;
describe
(
"
xray integration tests
"
,
()
=>
{
...
...
@@ -86,7 +87,7 @@ describe("xray integration tests", () => {
store
.
pushPath
(
`/xray/table/1/approximate`
);
const
app
=
mount
(
store
.
getAppContainer
());
await
store
.
waitForActions
(
FETCH_XRAY
,
LOAD_XRAY
,
{
timeout
:
20000
})
await
store
.
waitForActions
(
[
FETCH_XRAY
,
LOAD_XRAY
]
,
{
timeout
:
20000
})
const
tableXRay
=
app
.
find
(
TableXRay
)
expect
(
tableXRay
.
length
).
toBe
(
1
)
...
...
@@ -102,7 +103,7 @@ describe("xray integration tests", () => {
store
.
pushPath
(
`/xray/field/1/approximate`
);
const
app
=
mount
(
store
.
getAppContainer
());
await
store
.
waitForActions
(
FETCH_XRAY
,
LOAD_XRAY
,
{
timeout
:
20000
})
await
store
.
waitForActions
(
[
FETCH_XRAY
,
LOAD_XRAY
]
,
{
timeout
:
20000
})
const
fieldXRay
=
app
.
find
(
FieldXray
)
expect
(
fieldXRay
.
length
).
toBe
(
1
)
...
...
@@ -111,19 +112,44 @@ describe("xray integration tests", () => {
})
})
describe
(
"
navigation
"
,
async
()
=>
{
it
(
"
should be possible to navigate between tables and their child fields
"
,
async
()
=>
{
const
store
=
await
createTestStore
()
store
.
pushPath
(
`/xray/table/1/approximate`
);
const
app
=
mount
(
store
.
getAppContainer
());
await
store
.
waitForActions
([
FETCH_XRAY
,
LOAD_XRAY
],
{
timeout
:
20000
})
const
tableXray
=
app
.
find
(
TableXRay
)
expect
(
tableXray
.
length
).
toBe
(
1
)
const
fieldLink
=
app
.
find
(
Constituent
).
first
().
find
(
Link
)
click
(
fieldLink
)
await
store
.
waitForActions
([
FETCH_XRAY
,
LOAD_XRAY
],
{
timeout
:
20000
})
const
fieldXray
=
app
.
find
(
FieldXray
)
expect
(
fieldXray
.
length
).
toBe
(
1
)
})
})
// NOTE Atte Keinänen 8/24/17: I wanted to test both QB action widget xray action and the card/segment xray pages
// in the same tests so that we see that end-to-end user experience matches our expectations
describe
(
"
query builder actions
"
,
async
()
=>
{
it
(
"
let you see card xray for a timeseries question
"
,
async
()
=>
{
beforeEach
(
async
()
=>
{
await
SettingsApi
.
put
({
key
:
'
enable-xrays
'
,
value
:
'
true
'
})
})
it
(
"
let you see card xray for a timeseries question
"
,
async
()
=>
{
await
SettingsApi
.
put
({
key
:
'
xray-max-cost
'
,
value
:
'
extended
'
})
const
store
=
await
createTestStore
()
// make sure xrays are on and at the proper cost
store
.
pushPath
(
Urls
.
question
(
timeBreakoutQuestion
.
id
()))
const
app
=
mount
(
store
.
getAppContainer
());
await
store
.
waitForActions
(
INITIALIZE_QB
,
QUERY_COMPLETED
)
await
store
.
waitForActions
(
[
INITIALIZE_QB
,
QUERY_COMPLETED
]
)
// NOTE Atte Keinänen: Not sure why we need this delay to get most of action widget actions to appear :/
await
delay
(
500
);
...
...
@@ -133,7 +159,7 @@ describe("xray integration tests", () => {
click
(
xrayOptionIcon
);
await
store
.
waitForActions
(
FETCH_XRAY
,
LOAD_XRAY
,
{
timeout
:
5000
})
await
store
.
waitForActions
(
[
FETCH_XRAY
,
LOAD_XRAY
]
,
{
timeout
:
5000
})
expect
(
store
.
getPath
()).
toBe
(
`/xray/card/
${
timeBreakoutQuestion
.
id
()}
/extended`
)
const
cardXRay
=
app
.
find
(
CardXRay
)
...
...
@@ -142,19 +168,18 @@ describe("xray integration tests", () => {
})
it
(
"
let you see segment xray for a question containing a segment
"
,
async
()
=>
{
await
SettingsApi
.
put
({
key
:
'
enable-xrays
'
,
value
:
true
})
const
store
=
await
createTestStore
()
store
.
pushPath
(
Urls
.
question
(
segmentQuestion
.
id
()))
const
app
=
mount
(
store
.
getAppContainer
());
await
store
.
waitForActions
(
INITIALIZE_QB
,
QUERY_COMPLETED
)
await
store
.
waitForActions
(
[
INITIALIZE_QB
,
QUERY_COMPLETED
]
)
const
actionsWidget
=
app
.
find
(
ActionsWidget
)
click
(
actionsWidget
.
childAt
(
0
))
const
xrayOptionIcon
=
actionsWidget
.
find
(
'
.Icon.Icon-beaker
'
)
click
(
xrayOptionIcon
);
await
store
.
waitForActions
(
FETCH_XRAY
,
LOAD_XRAY
,
{
timeout
:
5000
})
await
store
.
waitForActions
(
[
FETCH_XRAY
,
LOAD_XRAY
]
,
{
timeout
:
5000
})
expect
(
store
.
getPath
()).
toBe
(
`/xray/segment/
${
segmentId
}
/approximate`
)
const
segmentXRay
=
app
.
find
(
SegmentXRay
)
...
...
@@ -195,7 +220,7 @@ describe("xray integration tests", () => {
// navigate to a previosuly x-ray-able entity
store
.
pushPath
(
Urls
.
question
(
timeBreakoutQuestion
.
id
()))
await
store
.
waitForActions
(
INITIALIZE_QB
,
QUERY_COMPLETED
)
await
store
.
waitForActions
(
[
INITIALIZE_QB
,
QUERY_COMPLETED
]
)
// for some reason a delay is needed to get the full action suite
await
delay
(
500
);
...
...
@@ -217,7 +242,7 @@ describe("xray integration tests", () => {
store
.
pushPath
(
Urls
.
question
(
segmentQuestion
.
id
()))
const
app
=
mount
(
store
.
getAppContainer
())
await
store
.
waitForActions
(
INITIALIZE_QB
,
QUERY_COMPLETED
)
await
store
.
waitForActions
(
[
INITIALIZE_QB
,
QUERY_COMPLETED
]
)
await
delay
(
500
);
const
actionsWidget
=
app
.
find
(
ActionsWidget
)
...
...
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