Test pod describe (#2040)
This commit is contained in:
@@ -559,6 +559,7 @@ const TenantDetails = ({ classes, match, history }: ITenantDetailsProps) => {
|
||||
label: "Pods",
|
||||
value: "pods",
|
||||
component: Link,
|
||||
id: "tenant-pod-tab",
|
||||
to: getRoutePath("pods"),
|
||||
},
|
||||
}}
|
||||
|
||||
@@ -478,13 +478,13 @@ const PodDescribe = ({
|
||||
variant="scrollable"
|
||||
scrollButtons="auto"
|
||||
>
|
||||
<Tab label="Summary" />
|
||||
<Tab label="Annotations" />
|
||||
<Tab label="Labels" />
|
||||
<Tab label="Conditions" />
|
||||
<Tab label="Tolerations" />
|
||||
<Tab label="Volumes" />
|
||||
<Tab label="Containers" />
|
||||
<Tab id="pod-describe-summary"label="Summary" />
|
||||
<Tab id="pod-describe-annotations"label="Annotations" />
|
||||
<Tab id="pod-describe-labels"label="Labels" />
|
||||
<Tab id="pod-describe-conditions"label="Conditions" />
|
||||
<Tab id="pod-describe-tolerations"label="Tolerations" />
|
||||
<Tab id="pod-describe-volumes"label="Volumes" />
|
||||
<Tab id="pod-describe-containers"label="Containers" />
|
||||
</Tabs>
|
||||
{renderTabComponent(curTab, describeInfo)}
|
||||
</Grid>
|
||||
|
||||
@@ -14,7 +14,16 @@
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import { loginToOperator, createTenant, createTenantWithoutAuditLog, deleteTenant } from './utils';
|
||||
import { t, Selector } from 'testcafe';
|
||||
import {
|
||||
loginToOperator,
|
||||
createTenant,
|
||||
createTenantWithoutAuditLog,
|
||||
deleteTenant,
|
||||
redirectToTenantsList,
|
||||
goToPodInTenant,
|
||||
goToPodSection
|
||||
} from './utils';
|
||||
|
||||
fixture("For user with default permissions").page("http://localhost:9090");
|
||||
|
||||
@@ -31,3 +40,31 @@ test("Create Tenant Without Audit Log", async (t) => {
|
||||
await createTenantWithoutAuditLog(tenantName);
|
||||
await deleteTenant(tenantName);
|
||||
});
|
||||
|
||||
|
||||
test("Test describe section for PODs in new tenant", async (t) => {
|
||||
const tenantName = `tenant-${Math.floor(Math.random() * 10000)}`;
|
||||
await loginToOperator();
|
||||
await createTenant(tenantName);
|
||||
await t.wait(15000) // wait for PODs to be created
|
||||
await testPODDescribe(tenantName);
|
||||
await redirectToTenantsList();
|
||||
await deleteTenant(tenantName);
|
||||
});
|
||||
|
||||
const testPODDescribe = async (tenantName: string) => {
|
||||
await goToPodInTenant(tenantName);
|
||||
await goToPodSection(1);
|
||||
await checkPVCSDescribeHasSections();
|
||||
}
|
||||
|
||||
const checkPVCSDescribeHasSections = async () => {
|
||||
await t
|
||||
.expect(Selector("#pod-describe-summary").exists).ok()
|
||||
.expect(Selector("#pod-describe-annotations").exists).ok()
|
||||
.expect(Selector("#pod-describe-labels").exists).ok()
|
||||
.expect(Selector("#pod-describe-conditions").exists).ok()
|
||||
.expect(Selector("#pod-describe-tolerations").exists).ok()
|
||||
.expect(Selector("#pod-describe-volumes").exists).ok()
|
||||
.expect(Selector("#pod-describe-containers").exists).ok();
|
||||
}
|
||||
|
||||
@@ -16,10 +16,11 @@
|
||||
|
||||
import { Selector, t } from 'testcafe';
|
||||
|
||||
const host: string = "http://localhost:9090";
|
||||
|
||||
export const loginToOperator = async () => {
|
||||
await t
|
||||
.navigateTo("http://localhost:9090/login")
|
||||
.navigateTo(`${host}/login`)
|
||||
.typeText("#jwt", "anyrandompasswordwillwork")
|
||||
.click("#do-login");
|
||||
}
|
||||
@@ -30,12 +31,12 @@ export const createTenant = async (tenantName: string) => {
|
||||
await checkTenantExists(tenantName);
|
||||
}
|
||||
|
||||
export const createTenantWithoutAuditLog = async (tenantName) => {
|
||||
export const createTenantWithoutAuditLog = async (tenantName: string) => {
|
||||
await fillTenantInformation(tenantName);
|
||||
await t
|
||||
.click("#wizard-step-audit-log")
|
||||
.click("#enableLogging")
|
||||
.click("#wizard-button-Create");
|
||||
.click("#wizard-step-audit-log")
|
||||
.click("#enableLogging")
|
||||
.click("#wizard-button-Create");
|
||||
await checkTenantExists(tenantName);
|
||||
}
|
||||
|
||||
@@ -49,7 +50,7 @@ const fillTenantInformation = async (tenantName: string) => {
|
||||
.wait(1000);
|
||||
}
|
||||
|
||||
const checkTenantExists = async (tenantName) => {
|
||||
const checkTenantExists = async (tenantName: string) => {
|
||||
await t
|
||||
.wait(1000)
|
||||
.click("#close")
|
||||
@@ -68,8 +69,36 @@ export const deleteTenant = async (tenantName: string) => {
|
||||
.notOk();
|
||||
}
|
||||
|
||||
|
||||
const goToTenant = async (tenantName) => {
|
||||
export const goToTenant = async (tenantName: string) => {
|
||||
await t.click(Selector(`#list-tenant-${tenantName}`))
|
||||
}
|
||||
|
||||
export const goToVolumesInTenant = async (tenantName: string) => {
|
||||
const path: string = `${host}/namespaces/${tenantName}/tenants/${tenantName}/volumes`;
|
||||
await redirectToPath(path);
|
||||
}
|
||||
|
||||
export const goToPodsInTenant = async (tenantName: string) => {
|
||||
await t.click(`#list-tenant-${tenantName}`);
|
||||
await t.click(Selector(`a[href$="/pods"]`))
|
||||
}
|
||||
|
||||
export const goToPodInTenant = async (tenantName: string) => {
|
||||
await goToPodsInTenant(tenantName);
|
||||
await t.click(Selector("div.ReactVirtualized__Table__row").child(0));
|
||||
}
|
||||
|
||||
export const goToPodSection = async (index: number) => {
|
||||
await t
|
||||
.expect(Selector(`#simple-tab-${index}`).exists)
|
||||
.ok()
|
||||
.click(Selector(`#simple-tab-${index}`));
|
||||
}
|
||||
|
||||
export const redirectToTenantsList = async () => {
|
||||
await redirectToPath(`${host}/tenants`);
|
||||
}
|
||||
|
||||
export const redirectToPath = async (path: string) => {
|
||||
await t.navigateTo(path);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user