keycloak-scim/cypress/support/pages/admin_console/manage/clients/InitialAccessTokenTab.ts
Aboullos 5227115f05
Add Clients tests, fix notification message and stabilize tests (#1999)
* Add Clients tests and fix notification message

* Remove TODO message

* Add waits and refactor

* Refactor and fix tests in realm settings

* Fix lint

* Refactor, fix tests and add stability

* Refactor and stabilize tests

* Stabilize tests

* Fix Realm settings event test and stabilize

* Set confirmModal to always force click

* Add force click and wait

* Fix masthead test

* Modify cypress.json

* Modify realm dropdown selector

* Revert hook changes
2022-02-16 17:34:54 +01:00

55 lines
1.3 KiB
TypeScript

export default class InitialAccessTokenTab {
private initialAccessTokenTab = "initialAccessToken";
private emptyAction = "no-initial-access-tokens-empty-action";
private expirationInput = "expiration";
private countInput = "count";
private countPlusBtn = '[data-testid="count"] [aria-label="Plus"]';
private saveBtn = "save";
goToInitialAccessTokenTab() {
cy.findByTestId(this.initialAccessTokenTab).click();
return this;
}
shouldBeEmpty() {
cy.findByTestId(this.emptyAction).should("exist");
return this;
}
shouldNotBeEmpty() {
cy.findByTestId(this.emptyAction).should("not.exist");
return this;
}
getFirstId(callback: (id: string) => void) {
cy.get('tbody > tr:first-child > [data-label="ID"]')
.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();
}
return this;
}
save() {
cy.findByTestId(this.saveBtn).click();
return this;
}
}