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

56 lines
1.3 KiB
TypeScript
Raw Normal View History

2021-03-05 13:47:59 +00:00
export default class InitialAccessTokenTab {
private initialAccessTokenTab = "initialAccessToken";
private emptyAction = "no-initial-access-tokens-empty-action";
2021-03-05 13:47:59 +00:00
private expirationInput = "expiration";
private countInput = "count";
private countPlusBtn = '[data-testid="count"] [aria-label="Plus"]';
2021-03-05 13:47:59 +00:00
private saveBtn = "save";
goToInitialAccessTokenTab() {
cy.findByTestId(this.initialAccessTokenTab).click();
return this;
}
2021-03-05 13:47:59 +00:00
shouldBeEmpty() {
cy.findByTestId(this.emptyAction).should("exist");
2021-03-05 13:47:59 +00:00
return this;
}
shouldNotBeEmpty() {
cy.findByTestId(this.emptyAction).should("not.exist");
2021-03-05 13:47:59 +00:00
return this;
}
getFirstId(callback: (id: string) => void) {
cy.get('tbody > tr:first-child > [data-label="ID"]')
2021-03-05 13:47:59 +00:00
.invoke("text")
.then((text) => {
callback(text);
});
return this;
}
goToCreateFromEmptyList() {
cy.findByTestId(this.emptyAction).click();
return this;
}
fillNewTokenData(expiration: number, count: number) {
cy.findByTestId(this.expirationInput).clear().type(`${expiration}`);
cy.findByTestId(this.countInput).clear();
for (let i = 0; i < count; i++) {
cy.get(this.countPlusBtn).click();
}
2021-03-05 13:47:59 +00:00
return this;
}
save() {
cy.findByTestId(this.saveBtn).click();
2021-03-05 13:47:59 +00:00
return this;
}
}