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
4266f076
Commit
4266f076
authored
6 years ago
by
Tom Robinson
Browse files
Options
Downloads
Patches
Plain Diff
Revert "Refactor alert.integ.spec cleanup"
This reverts commit
dec7ff44
.
parent
9c226213
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend/test/__support__/integrated_tests.js
+4
-13
4 additions, 13 deletions
frontend/test/__support__/integrated_tests.js
frontend/test/alert/alert.integ.spec.js
+17
-11
17 additions, 11 deletions
frontend/test/alert/alert.integ.spec.js
with
21 additions
and
24 deletions
frontend/test/__support__/integrated_tests.js
+
4
−
13
View file @
4266f076
...
...
@@ -581,24 +581,17 @@ export const eventually = async (assertion, timeout = 5000, period = 250) => {
// })
// afterAll(cleanup);
//
export
const
cleanup
=
async
()
=>
{
export
const
cleanup
=
()
=>
{
useSharedAdminLogin
();
try
{
await
Promise
.
all
(
cleanup
.
actions
.
splice
(
0
,
cleanup
.
actions
.
length
).
map
(
action
=>
action
()),
);
}
catch
(
e
)
{
console
.
warn
(
"
CLEANUP FAILED
"
,
e
);
throw
e
;
}
Promise
.
all
(
cleanup
.
actions
.
splice
(
0
,
cleanup
.
actions
.
length
).
map
(
action
=>
action
()),
);
};
cleanup
.
actions
=
[];
cleanup
.
fn
=
action
=>
cleanup
.
actions
.
push
(
action
);
cleanup
.
metric
=
metric
=>
cleanup
.
fn
(()
=>
deleteMetric
(
metric
));
cleanup
.
segment
=
segment
=>
cleanup
.
fn
(()
=>
deleteSegment
(
segment
));
cleanup
.
question
=
question
=>
cleanup
.
fn
(()
=>
deleteQuestion
(
question
));
cleanup
.
collection
=
collection
=>
cleanup
.
fn
(()
=>
deleteCollection
(
collection
));
export
const
deleteQuestion
=
question
=>
CardApi
.
delete
({
cardId
:
getId
(
question
)
});
...
...
@@ -606,8 +599,6 @@ export const deleteSegment = segment =>
SegmentApi
.
delete
({
segmentId
:
getId
(
segment
),
revision_message
:
"
Please
"
});
export
const
deleteMetric
=
metric
=>
MetricApi
.
delete
({
metricId
:
getId
(
metric
),
revision_message
:
"
Please
"
});
export
const
deleteCollection
=
collection
=>
CollectionsApi
.
update
({
id
:
getId
(
collection
),
archived
:
true
});
const
getId
=
o
=>
typeof
o
===
"
object
"
&&
o
!=
null
...
...
This diff is collapsed.
Click to expand it.
frontend/test/alert/alert.integ.spec.js
+
17
−
11
View file @
4266f076
...
...
@@ -5,14 +5,19 @@ import {
forBothAdminsAndNormalUsers
,
useSharedAdminLogin
,
useSharedNormalLogin
,
cleanup
,
}
from
"
__support__/integrated_tests
"
;
import
{
click
,
clickButton
}
from
"
__support__/enzyme_utils
"
;
import
{
fetchTableMetadata
}
from
"
metabase/redux/metadata
"
;
import
{
mount
}
from
"
enzyme
"
;
import
{
setIn
}
from
"
icepick
"
;
import
{
AlertApi
,
PulseApi
,
UserApi
}
from
"
metabase/services
"
;
import
{
AlertApi
,
CardApi
,
PulseApi
,
UserApi
,
CollectionsApi
,
}
from
"
metabase/services
"
;
import
Question
from
"
metabase-lib/lib/Question
"
;
import
*
as
Urls
from
"
metabase/lib/urls
"
;
import
{
INITIALIZE_QB
,
QUERY_COMPLETED
}
from
"
metabase/query_builder/actions
"
;
...
...
@@ -83,6 +88,7 @@ const initQbWithAlertMenuItemClicked = async (
};
describe
(
"
Alerts
"
,
()
=>
{
let
collection
=
null
;
let
rawDataQuestion
=
null
;
let
timeSeriesQuestion
=
null
;
let
timeSeriesWithGoalQuestion
=
null
;
...
...
@@ -95,7 +101,7 @@ describe("Alerts", () => {
const
store
=
await
createTestStore
();
// create a collection which all users have write permissions in
const
collection
=
await
createAllUsersWritableCollection
();
collection
=
await
createAllUsersWritableCollection
();
// table metadata is needed for `Question.alertType()` calls
await
store
.
dispatch
(
fetchTableMetadata
(
1
));
...
...
@@ -109,7 +115,6 @@ describe("Alerts", () => {
.
setDisplayName
(
"
Just raw, untamed data
"
)
.
setCollectionId
(
collection
.
id
),
);
cleanup
.
question
(
rawDataQuestion
);
timeSeriesQuestion
=
await
createSavedQuestion
(
Question
.
create
({
databaseId
:
1
,
tableId
:
1
,
metadata
})
...
...
@@ -125,7 +130,6 @@ describe("Alerts", () => {
.
setDisplayName
(
"
Time series line
"
)
.
setCollectionId
(
collection
.
id
),
);
cleanup
.
question
(
timeSeriesQuestion
);
timeSeriesWithGoalQuestion
=
await
createSavedQuestion
(
Question
.
create
({
databaseId
:
1
,
tableId
:
1
,
metadata
})
...
...
@@ -143,7 +147,6 @@ describe("Alerts", () => {
.
setDisplayName
(
"
Time series line with goal
"
)
.
setCollectionId
(
collection
.
id
),
);
cleanup
.
question
(
timeSeriesWithGoalQuestion
);
timeMultiSeriesWithGoalQuestion
=
await
createSavedQuestion
(
Question
.
create
({
databaseId
:
1
,
tableId
:
1
,
metadata
})
...
...
@@ -162,7 +165,6 @@ describe("Alerts", () => {
.
setDisplayName
(
"
Time multiseries line with goal
"
)
.
setCollectionId
(
collection
.
id
),
);
cleanup
.
question
(
timeMultiSeriesWithGoalQuestion
);
progressBarQuestion
=
await
createSavedQuestion
(
Question
.
create
({
databaseId
:
1
,
tableId
:
1
,
metadata
})
...
...
@@ -174,12 +176,16 @@ describe("Alerts", () => {
.
setDisplayName
(
"
Progress bar question
"
)
.
setCollectionId
(
collection
.
id
),
);
cleanup
.
question
(
progressBarQuestion
);
cleanup
.
collection
(
collection
);
});
afterAll
(
cleanup
);
afterAll
(
async
()
=>
{
await
CardApi
.
delete
({
cardId
:
rawDataQuestion
.
id
()
});
await
CardApi
.
delete
({
cardId
:
timeSeriesQuestion
.
id
()
});
await
CardApi
.
delete
({
cardId
:
timeSeriesWithGoalQuestion
.
id
()
});
await
CardApi
.
delete
({
cardId
:
timeMultiSeriesWithGoalQuestion
.
id
()
});
await
CardApi
.
delete
({
cardId
:
progressBarQuestion
.
id
()
});
await
CollectionsApi
.
update
({
id
:
collection
.
id
,
archived
:
true
});
});
describe
(
"
missing email/slack credentials
"
,
()
=>
{
forBothAdminsAndNormalUsers
(()
=>
{
...
...
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