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
b46e77df
Unverified
Commit
b46e77df
authored
2 years ago
by
Anton Kulyk
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add dashboard layout visual tests (#24971)
* Add dashboard layout visual tests * Simplify test * Await card queries
parent
5aed3a84
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/metabase-visual/dashboard/dashboard-layout.cy.spec.js
+52
-0
52 additions, 0 deletions
...est/metabase-visual/dashboard/dashboard-layout.cy.spec.js
with
52 additions
and
0 deletions
frontend/test/metabase-visual/dashboard/dashboard-layout.cy.spec.js
0 → 100644
+
52
−
0
View file @
b46e77df
import
{
restore
}
from
"
__support__/e2e/helpers
"
;
import
{
SAMPLE_DATABASE
}
from
"
__support__/e2e/cypress_sample_database
"
;
const
{
ORDERS_ID
}
=
SAMPLE_DATABASE
;
const
X_RAYED_ORDERS_TABLE_CARD_COUNT
=
8
;
describe
(
"
visual tests > dashboard
"
,
()
=>
{
const
VIEWPORT_WIDTH
=
2500
;
const
VIEWPORT_HEIGHT
=
1500
;
beforeEach
(()
=>
{
restore
();
cy
.
signInAsAdmin
();
cy
.
viewport
(
VIEWPORT_WIDTH
,
VIEWPORT_HEIGHT
);
cy
.
intercept
(
"
GET
"
,
"
/app/assets/geojson/**
"
).
as
(
"
geojson
"
);
cy
.
intercept
(
"
POST
"
,
"
/api/dashboard/*/dashcard/*/card/*/query
"
).
as
(
"
getCardQuery
"
,
);
cy
.
intercept
(
"
POST
"
,
"
/api/dashboard/save
"
);
cy
.
visit
(
`/auto/dashboard/table/
${
ORDERS_ID
}
`
);
// Need to wait until cards load before saving the dashboard
cy
.
wait
(
"
@geojson
"
,
{
timeout
:
10000
});
cy
.
button
(
"
Save this
"
).
click
();
cy
.
findByText
(
"
Your dashboard was saved
"
);
cy
.
findByText
(
"
See it
"
).
click
();
cy
.
wait
(
"
@getCardQuery
"
);
// Ensure all the card queries were awaited. Learn more:
// https://github.com/cypress-io/cypress/issues/14916
cy
.
get
(
"
@getCardQuery.all
"
).
should
(
"
have.length
"
,
X_RAYED_ORDERS_TABLE_CARD_COUNT
,
);
// Ensure the UI is in place after loading
cy
.
get
(
"
.Card
"
).
contains
(
"
18,760
"
);
// first number card
cy
.
findByText
(
"
How these transactions are distributed
"
);
// markdown card
cy
.
findByText
(
"
Incredible Aluminum Knife
"
);
// one of the table card records
});
it
(
"
layout
"
,
()
=>
{
cy
.
createPercySnapshot
(
"
view mode
"
);
cy
.
icon
(
"
pencil
"
).
click
();
cy
.
createPercySnapshot
(
"
edit mode
"
);
});
});
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