keycloak-scim/cypress/support/pages/admin_console/manage/clients/AdvancedTab.ts

109 lines
2.4 KiB
TypeScript
Raw Normal View History

import moment from "moment";
export default class AdvancedTab {
2022-01-08 09:27:57 +00:00
private setToNowBtn = "#setToNow";
private clearBtn = "#clear";
private pushBtn = "#push";
private notBeforeInput = "#kc-not-before";
2022-01-08 09:27:57 +00:00
private clusterNodesExpandBtn =
".pf-c-expandable-section .pf-c-expandable-section__toggle";
private testClusterAvailability = "#testClusterAvailability";
2022-01-08 09:27:57 +00:00
private registerNodeManuallyBtn = "no-nodes-registered-empty-action";
private nodeHostInput = "#nodeHost";
private addNodeConfirmBtn = "#add-node-confirm";
2022-01-08 09:27:57 +00:00
private accessTokenSignatureAlgorithmInput = "#accessTokenSignatureAlgorithm";
private fineGrainSaveBtn = "#fineGrainSave";
private fineGrainRevertBtn = "#fineGrainRevert";
private advancedTab = "advancedTab";
2022-01-08 09:27:57 +00:00
goToAdvancedTab() {
cy.findByTestId(this.advancedTab).click();
return this;
}
2022-01-08 09:27:57 +00:00
setRevocationToNow() {
cy.get(this.setToNowBtn).click();
return this;
}
2022-01-08 09:27:57 +00:00
clearRevocation() {
cy.get(this.clearBtn).click();
return this;
}
2022-01-08 09:27:57 +00:00
pushRevocation() {
cy.get(this.pushBtn).click();
return this;
}
2022-01-08 09:27:57 +00:00
checkRevacationIsNone() {
cy.get(this.notBeforeInput).should("have.value", "None");
return this;
}
2022-01-08 09:27:57 +00:00
checkRevocationIsSetToNow() {
cy.get(this.notBeforeInput).should("have.value", moment().format("LLL"));
return this;
}
expandClusterNode() {
2022-01-08 09:27:57 +00:00
cy.get(this.clusterNodesExpandBtn).click();
return this;
}
checkTestClusterAvailability(active: boolean) {
cy.get(this.testClusterAvailability).should(
(active ? "not." : "") + "have.class",
"pf-m-disabled"
);
return this;
}
2022-01-08 09:27:57 +00:00
registerNodeManually() {
cy.findByTestId(this.registerNodeManuallyBtn).click();
return this;
}
fillHost(host: string) {
2022-01-08 09:27:57 +00:00
cy.get(this.nodeHostInput).type(host);
return this;
}
2022-01-08 09:27:57 +00:00
saveHost() {
cy.get(this.addNodeConfirmBtn).click();
return this;
}
selectAccessTokenSignatureAlgorithm(algorithm: string) {
2022-01-08 09:27:57 +00:00
cy.get(this.accessTokenSignatureAlgorithmInput).click();
cy.get(this.accessTokenSignatureAlgorithmInput + " + ul")
.contains(algorithm)
.click();
return this;
}
checkAccessTokenSignatureAlgorithm(algorithm: string) {
2022-01-08 09:27:57 +00:00
cy.get(this.accessTokenSignatureAlgorithmInput).should(
"have.text",
algorithm
);
return this;
}
2022-01-08 09:27:57 +00:00
saveFineGrain() {
cy.get(this.fineGrainSaveBtn).click();
return this;
}
2022-01-08 09:27:57 +00:00
revertFineGrain() {
cy.get(this.fineGrainRevertBtn).click();
return this;
}
}