2021-03-05 13:47:59 +00:00
|
|
|
export default class InitialAccessTokenTab {
|
2021-03-24 14:07:49 +00:00
|
|
|
private initialAccessTokenTab = "initialAccessToken";
|
|
|
|
|
2021-06-16 11:35:03 +00:00
|
|
|
private emptyAction = "no-initial-access-tokens-empty-action";
|
2021-03-05 13:47:59 +00:00
|
|
|
|
|
|
|
private expirationInput = "expiration";
|
|
|
|
private countInput = "count";
|
2022-02-16 16:34:54 +00:00
|
|
|
private countPlusBtn = '[data-testid="count"] [aria-label="Plus"]';
|
2021-03-05 13:47:59 +00:00
|
|
|
private saveBtn = "save";
|
|
|
|
|
2021-03-24 14:07:49 +00:00
|
|
|
goToInitialAccessTokenTab() {
|
2021-09-17 13:23:34 +00:00
|
|
|
cy.findByTestId(this.initialAccessTokenTab).click();
|
2021-03-24 14:07:49 +00:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2021-03-05 13:47:59 +00:00
|
|
|
shouldBeEmpty() {
|
2021-09-17 13:23:34 +00:00
|
|
|
cy.findByTestId(this.emptyAction).should("exist");
|
2021-03-05 13:47:59 +00:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
shouldNotBeEmpty() {
|
2021-09-17 13:23:34 +00:00
|
|
|
cy.findByTestId(this.emptyAction).should("not.exist");
|
2021-03-05 13:47:59 +00:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2022-02-16 16:34:54 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2022-02-16 16:34:54 +00:00
|
|
|
goToCreateFromEmptyList() {
|
2021-09-17 13:23:34 +00:00
|
|
|
cy.findByTestId(this.emptyAction).click();
|
2022-02-16 16:34:54 +00:00
|
|
|
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() {
|
2021-09-17 13:23:34 +00:00
|
|
|
cy.findByTestId(this.saveBtn).click();
|
2021-03-05 13:47:59 +00:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|