forked from keycloak/keycloak
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix incorrect branching for some authentication flow diagrams. Fixes k…
…eycloak#28479 (keycloak#28480) * Refactor node creation in FlowDiagram Signed-off-by: Anil Dhurjaty <[email protected]> * Fix flow diagram incorrect branching display Signed-off-by: Anil Dhurjaty <[email protected]> * Enable react unit testing with vitest Signed-off-by: Anil Dhurjaty <[email protected]> * Add react tests for FlowDiagram Signed-off-by: Anil Dhurjaty <[email protected]> * Add cypress test for browser flow diagram Signed-off-by: Anil Dhurjaty <[email protected]> --------- Signed-off-by: Anil Dhurjaty <[email protected]>
- Loading branch information
Showing
6 changed files
with
661 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
js/apps/admin-ui/cypress/support/pages/admin-ui/manage/authentication/FlowDiagram.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
type Edge = { from: string; to: string }; | ||
|
||
export default class FlowDiagram { | ||
exists() { | ||
cy.get(".react-flow").should("exist"); | ||
} | ||
|
||
edgesExist(edges: Edge[]) { | ||
edges.forEach((edge) => { | ||
this.#labelToId(edge.from).then((fromId) => { | ||
this.#labelToId(edge.to).then((toId) => { | ||
const label = `Edge from ${fromId} to ${toId}`; | ||
cy.get(`[aria-label="${label}"]`); | ||
}); | ||
}); | ||
}); | ||
return this; | ||
} | ||
|
||
#labelToId(label: string) { | ||
return cy.findByText(label).then((node) => { | ||
const id = node.attr("data-id"); | ||
if (id) { | ||
return cy.wrap(id); | ||
} | ||
// if data-id does not exist, we're looking at a subflow, which has the data-id | ||
// on the grandparent | ||
return cy | ||
.wrap(node) | ||
.parent() | ||
.parent() | ||
.then((n) => cy.wrap(n.attr("data-id"))); | ||
}); | ||
} | ||
} |
Oops, something went wrong.