Tenant Monitoring Screen TestCafe UI tests (#2161)

This commit is contained in:
jinapurapu
2022-07-15 12:06:48 -07:00
committed by GitHub
parent 118cf97e1d
commit 0c12fbdd23
5 changed files with 81 additions and 0 deletions

View File

@@ -78,6 +78,7 @@ const CodeMirrorWrapper = ({
onChange={(evn) => {
onBeforeChange(null, null, evn.target.value);
}}
id={"code_wrapper"}
padding={15}
style={{
fontSize: 12,

View File

@@ -562,6 +562,7 @@ const TenantMonitoring = ({ classes }: ITenantMonitoring) => {
<Grid item xs={12} textAlign={"right"}>
<Button
type="submit"
id={"submit_button"}
variant="contained"
color="primary"
disabled={!checkValid()}

View File

@@ -325,6 +325,7 @@ const TenantDetails = ({ classes }: ITenantDetailsProps) => {
}}
tooltip={"Edit YAML"}
color="primary"
id={"yaml_button"}
variant="outlined"
aria-label="Edit YAML"
onClick={() => {

View File

@@ -25,6 +25,7 @@ import {
goToPodSection,
goToPvcInTenant,
goToPvcSection,
checkMonitoringFieldsAcceptValues,
} from "./utils";
fixture("For user with default permissions").page("http://localhost:9090");
@@ -94,3 +95,9 @@ const checkPvcDescribeHasSections = async () => {
.expect(Selector("#pvc-describe-labels").exists)
.ok();
};
test("Test Prometheus config fields can be edited and submitted", async (t) => {
const tenantName = `storage-lite`;
await loginToOperator();
await checkMonitoringFieldsAcceptValues(tenantName);
});

View File

@@ -111,6 +111,11 @@ export const goToPvcSection = async (index: number) => {
.click(Selector(`#simple-tab-${index}`));
};
export const goToMonitoringSection = async (tenantName: string) => {
await t.click(`#list-tenant-${tenantName}`).wait(2000);
await t.click(Selector(`a[href$="/monitoring"]`));
};
export const redirectToTenantsList = async () => {
await redirectToPath(`${host}/tenants`);
};
@@ -118,3 +123,69 @@ export const redirectToTenantsList = async () => {
export const redirectToPath = async (path: string) => {
await t.navigateTo(path);
};
export const checkMonitoringFieldsAcceptValues = async (tenantName: string) => {
await goToMonitoringSection(tenantName);
await t
.typeText("#image", "quay.io/prometheus/prometheus:latest", {
replace: true,
})
.typeText("#sidecarImage", "library/alpine:latest", { replace: true })
.typeText("#initImage", "library/busybox:1.33.1", { replace: true })
.typeText("#diskCapacityGB", "1", { replace: true })
.typeText("#cpuRequest", "1", { replace: true })
.typeText("#memRequest", "1", { replace: true })
.typeText("#serviceAccountName", "monitoringTestServiceAccountName", {
replace: true,
})
.typeText("#storageClassName", "monitoringTestStorageClassName", {
replace: true,
})
.click("#submit_button")
.click("#yaml_button")
.expect(Selector("#code_wrapper").exists)
.ok();
await t
.expect(
(
await Selector("#code_wrapper").textContent
).includes("image: quay.io/prometheus/prometheus:latest")
)
.ok()
.expect(
(
await Selector("#code_wrapper").textContent
).includes("initimage: library/busybox:1.33.1")
)
.ok()
.expect(
(
await Selector("#code_wrapper").textContent
).includes("diskCapacityGB: 1")
)
.ok()
.expect((await Selector("#code_wrapper").textContent).includes('cpu: "1"'))
.ok()
.expect(
(await Selector("#code_wrapper").textContent).includes("memory: 1Gi")
)
.ok()
.expect(
(
await Selector("#code_wrapper").textContent
).includes("serviceAccountName: monitoringTestServiceAccountName")
)
.ok()
.expect(
(
await Selector("#code_wrapper").textContent
).includes("sidecarimage: library/alpine:latest")
)
.ok()
.expect(
(
await Selector("#code_wrapper").textContent
).includes("storageClassName: monitoringTestStorageClassName")
)
.ok();
};