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
34d895a3
Unverified
Commit
34d895a3
authored
1 year ago
by
Kamil Mielnik
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Add an e2e test to reproduce issue 28756 (#33004)
* Add reproduction test for #28756 * Reuse DASHBOARD_SLOW_TIMEOUT
parent
858573b5
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
e2e/test/scenarios/dashboard/reproductions/28756-toast-to-enable-notifications-when-no-permissions.cy.spec.js
+78
-0
78 additions, 0 deletions
...st-to-enable-notifications-when-no-permissions.cy.spec.js
with
78 additions
and
0 deletions
e2e/test/scenarios/dashboard/reproductions/28756-toast-to-enable-notifications-when-no-permissions.cy.spec.js
0 → 100644
+
78
−
0
View file @
34d895a3
import
{
assoc
}
from
"
icepick
"
;
import
_
from
"
underscore
"
;
import
{
SAMPLE_DATABASE
}
from
"
e2e/support/cypress_sample_database
"
;
import
{
restore
,
undoToast
,
visitDashboard
}
from
"
e2e/support/helpers
"
;
import
{
DASHBOARD_SLOW_TIMEOUT
}
from
"
metabase/dashboard/constants
"
;
const
{
PRODUCTS_ID
}
=
SAMPLE_DATABASE
;
const
UNRESTRICTED_COLLECTION_NAME
=
"
Unrestricted collection
"
;
const
RESTRICTED_COLLECTION_NAME
=
"
Restricted collection
"
;
const
ADMIN_GROUP_ID
=
"
2
"
;
const
TOAST_TIMEOUT_SAFETY_MARGIN
=
1000
;
const
TOAST_TIMEOUT
=
DASHBOARD_SLOW_TIMEOUT
+
TOAST_TIMEOUT_SAFETY_MARGIN
;
const
TOAST_MESSAGE
=
"
Would you like to be notified when this dashboard is done loading?
"
;
describe
(
"
issue 28756
"
,
()
=>
{
beforeEach
(()
=>
{
restore
();
cy
.
signInAsAdmin
();
cy
.
createCollection
({
name
:
RESTRICTED_COLLECTION_NAME
}).
then
(
({
body
:
restrictedCollection
})
=>
{
restrictCollectionForNonAdmins
(
restrictedCollection
.
id
);
cy
.
createCollection
({
name
:
UNRESTRICTED_COLLECTION_NAME
}).
then
(
({
body
:
unrestrictedCollection
})
=>
{
cy
.
createQuestionAndDashboard
({
dashboardDetails
:
{
collection_id
:
unrestrictedCollection
.
id
,
},
questionDetails
:
{
name
:
"
28756 Question
"
,
query
:
{
"
source-table
"
:
PRODUCTS_ID
,
},
collection_id
:
restrictedCollection
.
id
,
},
}).
then
(({
body
:
{
dashboard_id
}
})
=>
{
cy
.
wrap
(
dashboard_id
).
as
(
"
dashboardId
"
);
});
},
);
},
);
});
it
(
"
should not show a toast to enable notifications to user with no permissions to see the card (metabase#28756)
"
,
()
=>
{
cy
.
signInAsNormalUser
();
cy
.
clock
();
cy
.
get
(
"
@dashboardId
"
).
then
(
dashboardId
=>
{
visitDashboard
(
dashboardId
);
cy
.
tick
(
TOAST_TIMEOUT
);
undoToast
().
should
(
"
not.exist
"
);
cy
.
findByText
(
TOAST_MESSAGE
).
should
(
"
not.exist
"
);
});
});
});
function
restrictCollectionForNonAdmins
(
collectionId
)
{
cy
.
request
(
"
GET
"
,
"
/api/collection/graph
"
).
then
(
({
body
:
{
revision
,
groups
}
})
=>
{
cy
.
request
(
"
PUT
"
,
"
/api/collection/graph
"
,
{
revision
,
groups
:
_
.
mapObject
(
groups
,
(
groupPermissions
,
groupId
)
=>
{
const
permission
=
groupId
===
ADMIN_GROUP_ID
?
"
write
"
:
"
none
"
;
return
assoc
(
groupPermissions
,
collectionId
,
permission
);
}),
});
},
);
}
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