- Notifications
You must be signed in to change notification settings - Fork928
test(site): add e2e tests for appearance#12950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
3 commits Select commitHold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
82 changes: 82 additions & 0 deletionssite/e2e/tests/deployment/appearance.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import { chromium, expect, test } from "@playwright/test"; | ||
import { expectUrl } from "../../expectUrl"; | ||
import { randomName, requiresEnterpriseLicense } from "../../helpers"; | ||
test("set application name", async ({ page }) => { | ||
requiresEnterpriseLicense(); | ||
await page.goto("/deployment/appearance", { waitUntil: "domcontentloaded" }); | ||
const applicationName = randomName(); | ||
// Fill out the form | ||
const form = page.locator("form", { hasText: "Application name" }); | ||
await form | ||
.getByLabel("Application name", { exact: true }) | ||
.fill(applicationName); | ||
await form.getByRole("button", { name: "Submit" }).click(); | ||
// Open a new session without cookies to see the login page | ||
const browser = await chromium.launch(); | ||
const incognitoContext = await browser.newContext(); | ||
await incognitoContext.clearCookies(); | ||
const incognitoPage = await incognitoContext.newPage(); | ||
await incognitoPage.goto("/", { waitUntil: "domcontentloaded" }); | ||
// Verify the application name | ||
const name = incognitoPage.locator("h1", { hasText: applicationName }); | ||
await expect(name).toBeVisible(); | ||
// Shut down browser | ||
await incognitoPage.close(); | ||
await browser.close(); | ||
}); | ||
test("set application logo", async ({ page }) => { | ||
requiresEnterpriseLicense(); | ||
await page.goto("/deployment/appearance", { waitUntil: "domcontentloaded" }); | ||
const imageLink = "/icon/azure.png"; | ||
// Fill out the form | ||
const form = page.locator("form", { hasText: "Logo URL" }); | ||
await form.getByLabel("Logo URL", { exact: true }).fill(imageLink); | ||
await form.getByRole("button", { name: "Submit" }).click(); | ||
// Open a new session without cookies to see the login page | ||
const browser = await chromium.launch(); | ||
const incognitoContext = await browser.newContext(); | ||
await incognitoContext.clearCookies(); | ||
const incognitoPage = await incognitoContext.newPage(); | ||
await incognitoPage.goto("/", { waitUntil: "domcontentloaded" }); | ||
// Verify banner | ||
const logo = incognitoPage.locator("img"); | ||
await expect(logo).toHaveAttribute("src", imageLink); | ||
// Shut down browser | ||
await incognitoPage.close(); | ||
await browser.close(); | ||
}); | ||
test("set service banner", async ({ page }) => { | ||
requiresEnterpriseLicense(); | ||
await page.goto("/deployment/appearance", { waitUntil: "domcontentloaded" }); | ||
const message = "Mary has a little lamb."; | ||
// Fill out the form | ||
const form = page.locator("form", { hasText: "Service Banner" }); | ||
await form.getByLabel("Enabled", { exact: true }).check(); | ||
await form.getByLabel("Message", { exact: true }).fill(message); | ||
await form.getByRole("button", { name: "Submit" }).click(); | ||
// Verify service banner | ||
await page.goto("/workspaces", { waitUntil: "domcontentloaded" }); | ||
await expectUrl(page).toHavePathName("/workspaces"); | ||
const bar = page.locator("div.service-banner", { hasText: message }); | ||
await expect(bar).toBeVisible(); | ||
}); |
2 changes: 1 addition & 1 deletionsite/src/modules/dashboard/ServiceBanner/ServiceBannerView.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletionssite/src/pages/DeploySettingsPage/AppearanceSettingsPage/AppearanceSettingsPageView.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.