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
9946598e
Unverified
Commit
9946598e
authored
3 years ago
by
Nemanja Glumac
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add embedding smoke tests when embedding is enabled (#20764)
parent
b7167616
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/scenarios/embedding/embedding-smoketests.cy.spec.js
+95
-0
95 additions, 0 deletions
...abase/scenarios/embedding/embedding-smoketests.cy.spec.js
with
95 additions
and
0 deletions
frontend/test/metabase/scenarios/embedding/embedding-smoketests.cy.spec.js
+
95
−
0
View file @
9946598e
...
...
@@ -95,6 +95,78 @@ describe("scenarios > embedding > smoke tests", () => {
ensureEmbeddingIsDisabled
();
});
});
context
(
"
embedding enabled
"
,
()
=>
{
[
"
question
"
,
"
dashboard
"
].
forEach
(
object
=>
{
it
(
`should be able to publish/embed and then unpublish a
${
object
}
without filters`
,
()
=>
{
const
embeddableObject
=
object
===
"
question
"
?
"
card
"
:
"
dashboard
"
;
const
objectName
=
object
===
"
question
"
?
"
Orders
"
:
"
Orders in a dashboard
"
;
cy
.
intercept
(
"
PUT
"
,
`/api/
${
embeddableObject
}
/1`
).
as
(
"
embedObject
"
);
cy
.
intercept
(
"
GET
"
,
`/api/
${
embeddableObject
}
/embeddable`
).
as
(
"
currentlyEmbeddedObject
"
,
);
visitAndEnableSharing
(
object
);
cy
.
findByText
(
"
Parameters
"
);
cy
.
findByText
(
/This
(
question|dashboard
)
doesn't have any parameters to configure yet./
,
);
cy
.
findByText
(
/You will need to publish this
(
question|dashboard
)
before you can embed it in another application./
,
);
cy
.
button
(
"
Publish
"
).
click
();
cy
.
wait
(
"
@embedObject
"
);
visitIframe
();
cy
.
contains
(
objectName
);
cy
.
contains
(
"
37.65
"
);
if
(
isOSS
)
{
cy
.
contains
(
"
Powered by Metabase
"
)
.
closest
(
"
a
"
)
.
should
(
"
have.attr
"
,
"
href
"
)
.
and
(
"
eq
"
,
"
https://metabase.com/
"
);
}
else
{
cy
.
contains
(
"
Powered by Metabase
"
).
should
(
"
not.exist
"
);
}
cy
.
visit
(
embeddingPage
);
cy
.
wait
(
"
@currentlyEmbeddedObject
"
);
const
sectionName
=
new
RegExp
(
`Embedded
${
object
}
s`
,
"
i
"
);
cy
.
contains
(
sectionName
)
.
closest
(
"
li
"
)
.
find
(
"
tbody tr
"
)
.
should
(
"
have.length
"
,
1
)
.
and
(
"
contain
"
,
objectName
);
visitAndEnableSharing
(
object
);
cy
.
findByText
(
"
Danger zone
"
);
cy
.
findByText
(
/This will disable embedding for this
(
question|dashboard
)
./
,
);
cy
.
button
(
"
Unpublish
"
).
click
();
cy
.
wait
(
"
@embedObject
"
);
visitIframe
();
cy
.
findByText
(
"
Embedding is not enabled for this object.
"
);
cy
.
visit
(
embeddingPage
);
cy
.
wait
(
"
@currentlyEmbeddedObject
"
);
cy
.
contains
(
/No
(
questions|dashboards
)
have been embedded yet./
);
});
});
});
});
function
resetEmbedding
()
{
...
...
@@ -133,3 +205,26 @@ function ensureEmbeddingIsDisabled() {
"
.disabled
"
,
);
}
function
visitIframe
()
{
cy
.
document
().
then
(
doc
=>
{
const
iframe
=
doc
.
querySelector
(
"
iframe
"
);
cy
.
visit
(
iframe
.
src
);
});
}
function
visitAndEnableSharing
(
object
)
{
if
(
object
===
"
question
"
)
{
visitQuestion
(
"
1
"
);
cy
.
icon
(
"
share
"
).
click
();
cy
.
findByText
(
/Embed this
(
question|dashboard
)
in an application/
).
click
();
}
if
(
object
===
"
dashboard
"
)
{
cy
.
visit
(
"
/dashboard/1
"
);
cy
.
icon
(
"
share
"
).
click
();
cy
.
findByText
(
"
Sharing and embedding
"
).
click
();
cy
.
findByText
(
/Embed this
(
question|dashboard
)
in an application/
).
click
();
}
}
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