forked from ZenUml/core
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(cypress): add e2e test for if-fragment layout (#234)
* test(cypress): add e2e test for if-fragment layout - Create new HTML file for testing if-fragment layout - Add Cypress e2e test to verify correct rendering of if-fragment - Check participants, messages, and fragment details in the test - Include snapshot testing for visual verification * Add expected image for if fragment test.
- Loading branch information
Showing
3 changed files
with
60 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
<meta name="viewport" content="width=device-width,initial-scale=1.0" /> | ||
<title>vue-sequence smoke 1</title> | ||
<style> | ||
body { | ||
margin: 0; /* mostly for demo on mobile */ | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div id="diagram" class="diagram"> | ||
<pre class="zenuml" style="margin: 0"> | ||
title Issue 232 - wrong layout for if-fragment | ||
Client -> Server:SendRequest | ||
|
||
if(true){ | ||
Server -> Server: processRequest | ||
}</pre | ||
> | ||
</div> | ||
<!-- built files will be auto injected --> | ||
<script type="module" src="/src/main-cy.ts"></script> | ||
</body> | ||
</html> |
Binary file added
BIN
+30.2 KB
..._image_snapshots__/If Fragment Test should render if fragment correctly #0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,32 @@ | ||
/* eslint-disable no-undef */ | ||
import "cypress-plugin-snapshots/commands"; | ||
|
||
describe("If Fragment Test", function () { | ||
it("should render if fragment correctly", function () { | ||
cy.visit("http://127.0.0.1:8080/cy/if-fragment.html"); | ||
// Wait for the privacy icon to be loaded | ||
cy.get(".privacy>span>svg", { timeout: 5000 }).should("be.visible"); | ||
|
||
// Verify the participants are rendered | ||
cy.get(".participant").should("have.length", 2); | ||
cy.get(".participant").eq(0).should("contain", "Client"); | ||
cy.get(".participant").eq(1).should("contain", "Server"); | ||
|
||
// Verify the initial message | ||
cy.get(".message").first().should("contain", "SendRequest"); | ||
|
||
// Verify the if fragment | ||
cy.get(".fragment").should("exist"); | ||
cy.get(".fragment .header").should("contain", "Alt"); | ||
cy.get(".fragment .condition").should("contain", "true"); | ||
|
||
// Verify the self message inside if block | ||
cy.get(".fragment .message").should("contain", "processRequest"); | ||
|
||
// Take a snapshot of the rendered diagram | ||
cy.document().toMatchImageSnapshot({ | ||
imageConfig: { threshold: 0.01 }, | ||
capture: "viewport", | ||
}); | ||
}); | ||
}); |