added flow edit details test (#2950)

This commit is contained in:
Erik Jan de Wit 2022-07-12 16:29:59 +02:00 committed by GitHub
parent 29b0f553a2
commit 71dd267a59
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 35 additions and 10 deletions

View file

@ -87,6 +87,20 @@ describe("Authentication test", () => {
});
});
it("Should edit flow details", () => {
const name = "Copy of browser";
listingPage.goToItemDetails(name);
const commonPage = new CommonPage();
commonPage
.actionToolbarUtils()
.clickActionToggleButton()
.clickDropdownItem("Edit info");
duplicateFlowModal.fill(name, "Other description");
masthead.checkNotificationMessage("Flow successfully updated");
});
it("Should change requirement of cookie", () => {
listingPage.goToItemDetails("Copy of browser");

View file

@ -20,9 +20,18 @@ export default class ActionToolbarPage extends CommonElements {
return this;
}
private getDropdownItem(itemName: string) {
return cy.get(this.dropdownMenuItem).contains(itemName);
}
checkActionItemExists(itemName: string, exists: boolean) {
const condition = exists ? "exist" : "not.exist";
cy.get(this.dropdownMenuItem).contains(itemName).should(condition);
this.getDropdownItem(itemName).should(condition);
return this;
}
clickDropdownItem(itemName: string) {
this.getDropdownItem(itemName).click();
return this;
}
}

View file

@ -1,14 +1,14 @@
export default class DuplicateFlowModal {
private aliasInput = "alias";
private nameInput = "name";
private descriptionInput = "description";
private confirmButton = "confirm";
private errorText = ".pf-m-error";
fill(name?: string, description?: string) {
cy.findByTestId(this.aliasInput).clear();
cy.findByTestId(this.nameInput).clear();
if (name) {
cy.findByTestId(this.aliasInput).type(name);
if (description) cy.get(this.descriptionInput).type(description);
cy.findByTestId(this.nameInput).type(name);
if (description) cy.findByTestId(this.descriptionInput).type(description);
}
cy.findByTestId(this.confirmButton).click();

View file

@ -23,7 +23,7 @@ export default class FlowDetails {
expectPriorityChange(execution: string, callback: () => void) {
cy.findAllByTestId(execution).then((rowDetails) => {
const executionId = rowDetails.children().attr("id");
const executionId = rowDetails.children().attr("data-id");
cy.intercept(
"POST",
`/admin/realms/test/authentication/executions/${executionId}/lower-priority`
@ -101,7 +101,7 @@ export default class FlowDetails {
description: string,
type: "Basic flow" | "Client flow"
) {
cy.findByTestId("alias").type(name);
cy.findByTestId("name").type(name);
cy.findByTestId("description").type(description);
cy.get("#flowType").click().parent().contains(type).click();
cy.findByTestId("create").click();

View file

@ -81,7 +81,7 @@ export const FlowRow = ({
<DataListCell key={`${execution.id}-name`}>
{!execution.authenticationFlow && (
<FlowTitle
id={`title-id-${execution.id}`}
id={execution.id}
key={execution.id}
title={execution.displayName!}
/>

View file

@ -15,7 +15,9 @@ export const FlowTitle = ({ id, title }: FlowTitleProps) => {
className="keycloak__authentication__title"
isFlat
>
<CardBody id={id}>{title}</CardBody>
<CardBody data-id={id} id={`title-id-${id}`}>
{title}
</CardBody>
</Card>
);
};

View file

@ -32,7 +32,7 @@ export const NameDescription = () => {
type="text"
id="kc-name"
name="alias"
data-testid="alias"
data-testid="name"
ref={register({ required: true })}
validated={
errors.alias ? ValidatedOptions.error : ValidatedOptions.default