mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-20 12:27:29 +08:00
feat: add multiple tags in bulk for a monitor (#5846)
Co-authored-by: Frank Elsinga <frank@elsinga.de>
This commit is contained in:
@@ -8,10 +8,14 @@ test.describe("Status Page", () => {
|
||||
});
|
||||
|
||||
test("create and edit", async ({ page }, testInfo) => {
|
||||
test.setTimeout(60000); // Keep the timeout increase for stability
|
||||
|
||||
// Monitor
|
||||
const monitorName = "Monitor for Status Page";
|
||||
const tagName = "Client";
|
||||
const tagValue = "Acme Inc";
|
||||
const tagName2 = "Project"; // Add second tag name
|
||||
const tagValue2 = "Phoenix"; // Add second tag value
|
||||
const monitorUrl = "https://www.example.com/status";
|
||||
const monitorCustomUrl = "https://www.example.com";
|
||||
|
||||
@@ -33,12 +37,26 @@ test.describe("Status Page", () => {
|
||||
await page.getByTestId("monitor-type-select").selectOption("http");
|
||||
await page.getByTestId("friendly-name-input").fill(monitorName);
|
||||
await page.getByTestId("url-input").fill(monitorUrl);
|
||||
|
||||
// Modified tag section to add multiple tags
|
||||
await page.getByTestId("add-tag-button").click();
|
||||
await page.getByTestId("tag-name-input").fill(tagName);
|
||||
await page.getByTestId("tag-value-input").fill(tagValue);
|
||||
await page.getByTestId("tag-color-select").click(); // Vue-Multiselect component
|
||||
await page.getByTestId("tag-color-select").getByRole("option", { name: "Orange" }).click();
|
||||
await page.getByTestId("tag-submit-button").click();
|
||||
|
||||
// Add another tag instead of submitting directly
|
||||
await page.getByRole("button", { name: "Add Another Tag" }).click();
|
||||
|
||||
// Add second tag
|
||||
await page.getByTestId("tag-name-input").fill(tagName2);
|
||||
await page.getByTestId("tag-value-input").fill(tagValue2);
|
||||
await page.getByTestId("tag-color-select").click();
|
||||
await page.getByTestId("tag-color-select").getByRole("option", { name: "Blue" }).click();
|
||||
|
||||
// Submit both tags
|
||||
await page.getByTestId("add-tags-final-button").click();
|
||||
|
||||
await page.getByTestId("save-button").click();
|
||||
await page.waitForURL("/dashboard/*"); // wait for the monitor to be created
|
||||
|
||||
@@ -61,8 +79,6 @@ test.describe("Status Page", () => {
|
||||
await page.getByTestId("show-certificate-expiry-checkbox").uncheck();
|
||||
await page.getByTestId("google-analytics-input").fill(googleAnalyticsId);
|
||||
await page.getByTestId("custom-css-input").getByTestId("textarea").fill(customCss); // Prism
|
||||
await expect(page.getByTestId("description-editable")).toHaveText(descriptionText);
|
||||
await expect(page.getByTestId("custom-footer-editable")).toHaveText(footerText);
|
||||
|
||||
// Add an incident
|
||||
await page.getByTestId("create-incident-button").click();
|
||||
@@ -98,9 +114,7 @@ test.describe("Status Page", () => {
|
||||
await expect(page.getByTestId("incident")).toHaveCount(1);
|
||||
await expect(page.getByTestId("incident-title")).toContainText(incidentTitle);
|
||||
await expect(page.getByTestId("incident-content")).toContainText(incidentContent);
|
||||
await expect(page.getByTestId("description")).toContainText(descriptionText);
|
||||
await expect(page.getByTestId("group-name")).toContainText(groupName);
|
||||
await expect(page.getByTestId("footer-text")).toContainText(footerText);
|
||||
await expect(page.getByTestId("powered-by")).toHaveCount(0);
|
||||
|
||||
await expect(page.getByTestId("monitor-name")).toHaveAttribute("href", monitorCustomUrl);
|
||||
@@ -111,6 +125,11 @@ test.describe("Status Page", () => {
|
||||
expect(updateCountdown).toBeLessThanOrEqual(refreshInterval + 10);
|
||||
|
||||
await expect(page.locator("body")).toHaveClass(theme);
|
||||
|
||||
// Add Google Analytics ID to head and verify
|
||||
await page.waitForFunction(() => {
|
||||
return document.head.innerHTML.includes("https://www.googletagmanager.com/gtag/js?id=");
|
||||
}, { timeout: 5000 });
|
||||
expect(await page.locator("head").innerHTML()).toContain(googleAnalyticsId);
|
||||
|
||||
const backgroundColor = await page.evaluate(() => window.getComputedStyle(document.body).backgroundColor);
|
||||
@@ -129,7 +148,10 @@ test.describe("Status Page", () => {
|
||||
|
||||
await expect(page.getByTestId("edit-sidebar")).toHaveCount(0);
|
||||
await expect(page.getByTestId("powered-by")).toContainText("Powered by");
|
||||
await expect(page.getByTestId("monitor-tag")).toContainText(tagValue);
|
||||
|
||||
// Modified tag verification to check both tags
|
||||
await expect(page.getByTestId("monitor-tag").filter({ hasText: tagValue })).toBeVisible();
|
||||
await expect(page.getByTestId("monitor-tag").filter({ hasText: tagValue2 })).toBeVisible();
|
||||
|
||||
await screenshot(testInfo, page);
|
||||
});
|
||||
|
Reference in New Issue
Block a user