Skip to content

Commit e235863

Browse files
authored
Test pod describe (#2040)
1 parent 6b7948b commit e235863

File tree

4 files changed

+83
-16
lines changed

4 files changed

+83
-16
lines changed

portal-ui/src/screens/Console/Tenants/TenantDetails/TenantDetails.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,7 @@ const TenantDetails = ({ classes, match, history }: ITenantDetailsProps) => {
559559
label: "Pods",
560560
value: "pods",
561561
component: Link,
562+
id: "tenant-pod-tab",
562563
to: getRoutePath("pods"),
563564
},
564565
}}

portal-ui/src/screens/Console/Tenants/TenantDetails/pods/PodDescribe.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -478,13 +478,13 @@ const PodDescribe = ({
478478
variant="scrollable"
479479
scrollButtons="auto"
480480
>
481-
<Tab label="Summary" />
482-
<Tab label="Annotations" />
483-
<Tab label="Labels" />
484-
<Tab label="Conditions" />
485-
<Tab label="Tolerations" />
486-
<Tab label="Volumes" />
487-
<Tab label="Containers" />
481+
<Tab id="pod-describe-summary"label="Summary" />
482+
<Tab id="pod-describe-annotations"label="Annotations" />
483+
<Tab id="pod-describe-labels"label="Labels" />
484+
<Tab id="pod-describe-conditions"label="Conditions" />
485+
<Tab id="pod-describe-tolerations"label="Tolerations" />
486+
<Tab id="pod-describe-volumes"label="Volumes" />
487+
<Tab id="pod-describe-containers"label="Containers" />
488488
</Tabs>
489489
{renderTabComponent(curTab, describeInfo)}
490490
</Grid>

portal-ui/tests/operator/tenants.ts

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,16 @@
1414
// You should have received a copy of the GNU Affero General Public License
1515
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

17-
import { loginToOperator, createTenant, createTenantWithoutAuditLog, deleteTenant } from './utils';
17+
import { t, Selector } from 'testcafe';
18+
import {
19+
loginToOperator,
20+
createTenant,
21+
createTenantWithoutAuditLog,
22+
deleteTenant,
23+
redirectToTenantsList,
24+
goToPodInTenant,
25+
goToPodSection
26+
} from './utils';
1827

1928
fixture("For user with default permissions").page("http://localhost:9090");
2029

@@ -31,3 +40,31 @@ test("Create Tenant Without Audit Log", async (t) => {
3140
await createTenantWithoutAuditLog(tenantName);
3241
await deleteTenant(tenantName);
3342
});
43+
44+
45+
test("Test describe section for PODs in new tenant", async (t) => {
46+
const tenantName = `tenant-${Math.floor(Math.random() * 10000)}`;
47+
await loginToOperator();
48+
await createTenant(tenantName);
49+
await t.wait(15000) // wait for PODs to be created
50+
await testPODDescribe(tenantName);
51+
await redirectToTenantsList();
52+
await deleteTenant(tenantName);
53+
});
54+
55+
const testPODDescribe = async (tenantName: string) => {
56+
await goToPodInTenant(tenantName);
57+
await goToPodSection(1);
58+
await checkPVCSDescribeHasSections();
59+
}
60+
61+
const checkPVCSDescribeHasSections = async () => {
62+
await t
63+
.expect(Selector("#pod-describe-summary").exists).ok()
64+
.expect(Selector("#pod-describe-annotations").exists).ok()
65+
.expect(Selector("#pod-describe-labels").exists).ok()
66+
.expect(Selector("#pod-describe-conditions").exists).ok()
67+
.expect(Selector("#pod-describe-tolerations").exists).ok()
68+
.expect(Selector("#pod-describe-volumes").exists).ok()
69+
.expect(Selector("#pod-describe-containers").exists).ok();
70+
}

portal-ui/tests/operator/utils.ts

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616

1717
import { Selector, t } from 'testcafe';
1818

19+
const host: string = "http://localhost:9090";
1920

2021
export const loginToOperator = async () => {
2122
await t
22-
.navigateTo("http://localhost:9090/login")
23+
.navigateTo(`${host}/login`)
2324
.typeText("#jwt", "anyrandompasswordwillwork")
2425
.click("#do-login");
2526
}
@@ -30,12 +31,12 @@ export const createTenant = async (tenantName: string) => {
3031
await checkTenantExists(tenantName);
3132
}
3233

33-
export const createTenantWithoutAuditLog = async (tenantName) => {
34+
export const createTenantWithoutAuditLog = async (tenantName: string) => {
3435
await fillTenantInformation(tenantName);
3536
await t
36-
.click("#wizard-step-audit-log")
37-
.click("#enableLogging")
38-
.click("#wizard-button-Create");
37+
.click("#wizard-step-audit-log")
38+
.click("#enableLogging")
39+
.click("#wizard-button-Create");
3940
await checkTenantExists(tenantName);
4041
}
4142

@@ -49,7 +50,7 @@ const fillTenantInformation = async (tenantName: string) => {
4950
.wait(1000);
5051
}
5152

52-
const checkTenantExists = async (tenantName) => {
53+
const checkTenantExists = async (tenantName: string) => {
5354
await t
5455
.wait(1000)
5556
.click("#close")
@@ -68,8 +69,36 @@ export const deleteTenant = async (tenantName: string) => {
6869
.notOk();
6970
}
7071

71-
72-
const goToTenant = async (tenantName) => {
72+
export const goToTenant = async (tenantName: string) => {
7373
await t.click(Selector(`#list-tenant-${tenantName}`))
7474
}
7575

76+
export const goToVolumesInTenant = async (tenantName: string) => {
77+
const path: string = `${host}/namespaces/${tenantName}/tenants/${tenantName}/volumes`;
78+
await redirectToPath(path);
79+
}
80+
81+
export const goToPodsInTenant = async (tenantName: string) => {
82+
await t.click(`#list-tenant-${tenantName}`);
83+
await t.click(Selector(`a[href$="/pods"]`))
84+
}
85+
86+
export const goToPodInTenant = async (tenantName: string) => {
87+
await goToPodsInTenant(tenantName);
88+
await t.click(Selector("div.ReactVirtualized__Table__row").child(0));
89+
}
90+
91+
export const goToPodSection = async (index: number) => {
92+
await t
93+
.expect(Selector(`#simple-tab-${index}`).exists)
94+
.ok()
95+
.click(Selector(`#simple-tab-${index}`));
96+
}
97+
98+
export const redirectToTenantsList = async () => {
99+
await redirectToPath(`${host}/tenants`);
100+
}
101+
102+
export const redirectToPath = async (path: string) => {
103+
await t.navigateTo(path);
104+
}

0 commit comments

Comments
 (0)