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
ab4ae529
Unverified
Commit
ab4ae529
authored
1 year ago
by
Sloan Sparger
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix admin landing page e2e test flakes (#37653)
parent
73ff8b97
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
e2e/test/scenarios/admin-2/whitelabel.cy.spec.js
+22
-56
22 additions, 56 deletions
e2e/test/scenarios/admin-2/whitelabel.cy.spec.js
with
22 additions
and
56 deletions
e2e/test/scenarios/admin-2/whitelabel.cy.spec.js
+
22
−
56
View file @
ab4ae529
...
...
@@ -286,53 +286,36 @@ describeEE("formatting > whitelabel", () => {
describe
(
"
Landing Page
"
,
()
=>
{
beforeEach
(()
=>
{
cy
.
intercept
(
"
PUT
"
,
"
/api/setting/landing-page
"
).
as
(
"
putLandingPage
"
);
});
it
(
"
should allow users to provide internal urls
"
,
()
=>
{
cy
.
intercept
(
"
GET
"
,
"
/api/setting
"
).
as
(
"
getSettings
"
);
cy
.
signInAsAdmin
();
cy
.
visit
(
"
/admin/settings/whitelabel
"
);
cy
.
location
(
"
origin
"
).
then
(
origin
=>
{
// test root / path
testValidLandingPageInput
({
input
:
"
/
"
,
expected
:
origin
+
"
/
"
});
// test relative url
testValidLandingPageInput
({
input
:
"
/test-1
"
,
expected
:
origin
+
"
/test-1
"
,
});
});
// test no input
testValidLandingPageInput
({
input
:
""
,
expected
:
origin
+
"
/
"
});
it
(
"
should allow users to provide internal urls
"
,
()
=>
{
cy
.
findByTestId
(
"
landing-page
"
).
click
().
clear
().
type
(
"
/test-1
"
).
blur
();
cy
.
wait
([
"
@putLandingPage
"
,
"
@getSettings
"
]);
// test absolute url matching the page's origin
testValidLandingPageInput
({
input
:
origin
+
"
/test-2
"
,
expected
:
origin
+
"
/test-2
"
,
});
});
cy
.
findByTestId
(
"
landing-page-error
"
).
should
(
"
not.exist
"
);
cy
.
findByRole
(
"
navigation
"
).
findByText
(
"
Exit admin
"
).
click
();
cy
.
url
().
should
(
"
include
"
,
"
/test-1
"
);
});
it
(
"
should not allow users to provide external urls
"
,
()
=>
{
cy
.
signInAsAdmin
();
cy
.
visit
(
"
/admin/settings/whitelabel
"
);
cy
.
findByTestId
(
"
landing-page
"
).
click
().
clear
().
type
(
"
/test-2
"
).
blur
();
cy
.
wait
([
"
@putLandingPage
"
,
"
@getSettings
"
]
);
cy
.
location
(
"
origin
"
).
then
(
origin
=>
{
// first set to a valid value
testValidLandingPageInput
({
input
:
"
/
"
,
expected
:
origin
+
"
/
"
});
// test that setting invalid value errors and is not persisted
cy
.
visit
(
"
/admin/settings/whitelabel
"
);
cy
.
findByTestId
(
"
landing-page
"
)
.
click
()
.
type
(
"
{selectAll}
"
+
"
{backspace}
"
+
"
https://google.com
"
)
.
blur
();
cy
.
findByTestId
(
"
landing-page-error
"
)
.
findByText
(
"
This field must be a relative URL.
"
)
.
should
(
"
exist
"
);
cy
.
findByText
(
"
Exit admin
"
).
click
();
cy
.
url
().
should
(
"
eq
"
,
origin
+
"
/
"
);
});
// set to valid value then test invalid value is not persisted
cy
.
findByTestId
(
"
landing-page
"
)
.
click
()
.
clear
()
.
type
(
"
https://google.com
"
)
.
blur
();
cy
.
findByTestId
(
"
landing-page-error
"
)
.
findByText
(
"
This field must be a relative URL.
"
)
.
should
(
"
exist
"
);
cy
.
findByRole
(
"
navigation
"
).
findByText
(
"
Exit admin
"
).
click
();
cy
.
url
().
should
(
"
include
"
,
"
/test-2
"
);
});
});
});
...
...
@@ -355,20 +338,3 @@ const helpLink = () => popover().findByRole("link", { name: "Help" });
const
getHelpLinkCustomDestinationInput
=
()
=>
cy
.
findByPlaceholderText
(
"
Enter a URL it should go to
"
);
const
testValidLandingPageInput
=
({
input
,
expected
})
=>
{
cy
.
visit
(
"
/admin/settings/whitelabel
"
);
const
field
=
cy
.
findByTestId
(
"
landing-page
"
);
field
.
click
().
clear
();
if
(
input
)
{
field
.
type
(
input
);
}
field
.
blur
();
cy
.
findByTestId
(
"
landing-page
"
).
click
().
clear
();
cy
.
wait
(
"
@putLandingPage
"
);
cy
.
findByTestId
(
"
landing-page-error
"
).
should
(
"
not.exist
"
);
cy
.
findByText
(
"
Exit admin
"
).
click
();
cy
.
url
().
should
(
"
eq
"
,
expected
);
};
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