keycloak-scim/cypress/support/pages/admin_console/manage/KeyValueInput.ts
2022-04-20 19:11:46 +02:00

31 lines
818 B
TypeScript

import type { KeyValueType } from "../../../../../src/components/key-value-form/key-value-convert";
export default class KeyValueInput {
private name: string;
constructor(name: string) {
this.name = name;
}
fillKeyValue({ key, value }: KeyValueType, index = 0) {
cy.findByTestId(`${this.name}[${index}].key`).clear().type(key);
cy.findByTestId(`${this.name}[${index}].value`).clear().type(value);
cy.findByTestId(`${this.name}-add-row`).click();
return this;
}
deleteRow(index: number) {
cy.findByTestId(`${this.name}[${index}].remove`).click();
return this;
}
validateRows(numberOfRows: number) {
cy.findAllByTestId("row").should("have.length", numberOfRows);
return this;
}
save() {
cy.findByTestId("save-attributes").click();
return this;
}
}