-
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.
test: ✅ Add test cypress home,auth,search and application details
- Loading branch information
1 parent
523f857
commit 5085751
Showing
25 changed files
with
7,510 additions
and
1,024 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
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,27 @@ | ||
describe("Search Application Page", () => { | ||
beforeEach(() => { | ||
cy.visit("http://localhost:5173"); | ||
cy.login("user", "password"); | ||
}); | ||
|
||
it('should redirect to the search application page when clicking "Rechercher une application"', () => { | ||
cy.get("a.fr-btn").contains("Rechercher une application").click(); | ||
cy.url().should("include", "/recherche-application"); | ||
}); | ||
|
||
it("should display search results when a valid search term is entered", () => { | ||
cy.get("a.fr-btn").contains("Rechercher une application").click(); | ||
cy.url().should("include", "/recherche-application"); | ||
|
||
cy.get('input[placeholder="Rechercher une application"]').type("basegun"); | ||
cy.get(".card-container .fixed-card").should("have.length.greaterThan", 0); | ||
}); | ||
|
||
it("should navigate to application details when clicking on a search result tile", () => { | ||
cy.get("a.fr-btn").contains("Rechercher une application").click(); | ||
cy.url().should("include", "/recherche-application"); | ||
|
||
cy.get('input[placeholder="Rechercher une application"]').type("basegun"); | ||
cy.get(".card-container .fixed-card").first().click(); | ||
}); | ||
}); |
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,21 @@ | ||
describe("Application Details", () => { | ||
beforeEach(() => { | ||
cy.visit("http://localhost:5173"); | ||
cy.login("user", "password"); | ||
cy.get("a.fr-btn").contains("Rechercher une application").click(); | ||
cy.get('input[placeholder="Rechercher une application"]').type("basegun"); | ||
cy.get(".card-container .fixed-card").first().click(); | ||
cy.url().should("match", /\/applications\/[a-f0-9\-]+/); | ||
}); | ||
|
||
it("should navigate through the tabs", () => { | ||
cy.get('button[data-testid="test-tab-0"]').click(); | ||
cy.get("#tab-content-0").should("be.visible").and("contain.text", "Informations générales"); | ||
cy.get('button[data-testid="test-tab-1"]').click(); | ||
cy.get("#tab-content-1").should("be.visible").and("contain.text", "Description"); | ||
cy.get('button[data-testid="test-tab-2"]').click(); | ||
cy.get("#tab-content-2").should("be.visible").and("contain.text", "Objectifs"); | ||
cy.get('button[data-testid="test-tab-3"]').click(); | ||
cy.get("#tab-content-3").should("be.visible").and("contain.text", "Tags"); | ||
}); | ||
}); |
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,20 @@ | ||
describe("Authentication", () => { | ||
beforeEach(() => { | ||
cy.visit("http://localhost:5173"); | ||
}); | ||
|
||
it("should log in with valid credentials", () => { | ||
cy.login("user", "password"); | ||
cy.url().should("include", "/"); | ||
}); | ||
|
||
it("should fail to log in with invalid credentials", () => { | ||
cy.get(".fr-btn").contains("Se connecter").click(); | ||
cy.origin("http://localhost:8082", () => { | ||
cy.get("#username").type("invaliduser"); | ||
cy.get("#password").type("wrongpassword"); | ||
cy.get("#kc-login").click(); | ||
cy.get("#kc-form-wrapper").should("contain.text", "Invalid username or password"); | ||
}); | ||
}); | ||
}); |
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,11 @@ | ||
describe("Home Page", () => { | ||
beforeEach(() => { | ||
cy.visit("http://localhost:5173"); // URL de votre application | ||
}); | ||
|
||
it("should display the header elements", () => { | ||
cy.get('[data-testid="header-logo"]').should("exist").and("contain.text", "Ministère"); | ||
cy.get(".fr-header__service-title").should("exist").and("contain.text", "Référentiel des Applications"); | ||
cy.get(".fr-header__service-tagline").should("exist").and("contain.text", "Une application pour les réunir toutes"); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
<!DOCTYPE html> | ||
<!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"> | ||
<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>Components App</title> | ||
</head> | ||
<body> | ||
<div data-cy-root></div> | ||
</body> | ||
</html> | ||
</html> |
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
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
Oops, something went wrong.