-
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.
End to End Testing: Test Cases 8.1, 8.2
- Loading branch information
Showing
2 changed files
with
100 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,52 @@ | ||
// Test Case 8.1: | ||
describe("HR and Senior Management Login to WFH Tracking System", () => { | ||
// Use before to run setup code before the tests | ||
before(() => { | ||
// Step 1: Visit the homepage and log in once | ||
cy.visit("https://wfh-tracking-system.vercel.app/"); | ||
|
||
// Ensure the page has loaded | ||
cy.get("body").should("be.visible"); | ||
|
||
// Verify the 'Nav Bar' is visible | ||
cy.get("nav").should("contain", "All-In-One"); | ||
|
||
// Navigate to the login page | ||
cy.get("a").click(); | ||
|
||
// Step 2: Login as James Tan using cy.origin for third-party login | ||
cy.origin("https://wfhtrackingsystem.kinde.com", () => { | ||
// Input Staff ID | ||
cy.get('input[name="p_username"]').type("160075"); | ||
cy.get('button[type="submit"]').click(); | ||
|
||
// Wait for the password input to be visible | ||
cy.get('input[name="p_password"]', { timeout: 10000 }).should( | ||
"be.visible", | ||
); | ||
cy.get('input[name="p_password"]').type("password"); | ||
cy.contains('button[type="submit"]', "Continue").click({ | ||
multiple: true, | ||
}); | ||
}); | ||
}); | ||
|
||
it("should view requests and schedules", () => { | ||
// Ensure the page has loaded | ||
cy.get("body").should("be.visible"); | ||
cy.reload(); | ||
|
||
// Step 3: Navigate to Overall schedules page | ||
cy.get("nav").contains("Schedule").click(); | ||
cy.get("nav").contains("Overall and team").click(); | ||
}); | ||
|
||
// Clear sessions after each test | ||
afterEach(() => { | ||
cy.clearCookies(); | ||
cy.clearLocalStorage(); | ||
cy.window().then((win) => { | ||
win.sessionStorage.clear(); | ||
}); | ||
}); | ||
}); |
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,48 @@ | ||
// Test Case 8.2: Edge Case - Invalid HR/Senior Management Credentials | ||
describe("Invalid Login Credentials", () => { | ||
// Use before to run setup code before the tests | ||
beforeEach(() => { | ||
// Step 1: Visit the homepage and log in once | ||
cy.visit("https://wfh-tracking-system.vercel.app/"); | ||
|
||
// Ensure the page has loaded | ||
cy.get("body").should("be.visible"); | ||
|
||
// Verify the 'Nav Bar' is visible | ||
cy.get("nav").should("contain", "All-In-One"); | ||
|
||
// Navigate to the login page | ||
cy.get("a").click(); | ||
}); | ||
|
||
it("should show 'No account found with this username'", () => { | ||
// Step 2: Invalid Staff ID using cy.origin for third-party login | ||
cy.origin("https://wfhtrackingsystem.kinde.com", () => { | ||
cy.get('input[name="p_username"]').type("000000"); | ||
cy.get('button[type="submit"]').click(); | ||
cy.contains("No account found with this username"); | ||
cy.wait(2000); | ||
}); | ||
}); | ||
|
||
it("should show 'Please provide a valid password'", () => { | ||
// Step 3: Valid Staff ID and invalid password using cy.origin for third-party login | ||
cy.origin("https://wfhtrackingsystem.kinde.com", () => { | ||
cy.get('input[name="p_username"]').type("160075"); | ||
cy.get('button[type="submit"]').click(); | ||
|
||
// Wait for the password input to be visible | ||
cy.get('input[name="p_password"]', { timeout: 10000 }).should( | ||
"be.visible", | ||
); | ||
|
||
cy.get('input[name="p_password"]').type("wrongpassword"); | ||
cy.contains('button[type="submit"]', "Continue").click({ | ||
multiple: true, | ||
}); | ||
cy.wait(2000); | ||
cy.contains("Please provide a valid password"); | ||
}); | ||
}); | ||
|
||
}); |