-
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: Separate test files
- Loading branch information
1 parent
7ea4e98
commit 3ea302b
Showing
26 changed files
with
1,806 additions
and
2,012 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// Test Case 10.1: View Application History | ||
describe('Staff Able to View Application History', () => { | ||
// 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/'); // Adjust the URL if needed | ||
|
||
// 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: Log in as Samsul Saifullah using cy.origin for third-party login | ||
cy.origin('https://wfhtrackingsystem.kinde.com', () => { | ||
cy.get('input[name="p_username"]').type('151495'); | ||
cy.get('button[type="submit"]').click(); | ||
|
||
cy.get('input[name="p_password"]', { timeout: 10000 }).should('be.visible'); | ||
|
||
cy.get('input[name="p_password"]').type('password'); | ||
cy.get('button[type="submit"]').click({ multiple: true }); | ||
}); | ||
}); | ||
|
||
it('should view "My Schedule" page and "Create new arrangement" page', () => { | ||
// Step 3: Navigate to the "My arrangement requests" page | ||
cy.get('nav').should('contain', 'All-In-One'); | ||
cy.get('nav').contains('Arrangement').click(); | ||
cy.get('nav').contains('My requests').click(); | ||
|
||
// Step 4: Navigate to the my arrangement request page | ||
cy.get('button').contains('Processed').click(); | ||
|
||
const formatDate = (date) => { | ||
const year = date.getFullYear(); | ||
const month = String(date.getMonth() + 1).padStart(2, '0'); // Months are 0-indexed | ||
const day = String(date.getDate()).padStart(2, '0'); | ||
return `${year}-${month}-${day}`; | ||
}; | ||
|
||
// Get today's date | ||
const today = new Date(); | ||
const threeDaysLater = new Date(today); | ||
const fourDaysLater = new Date(today); | ||
const sixDaysLater = new Date(today); | ||
|
||
// Adjust the future dates | ||
threeDaysLater.setDate(today.getDate() + 3); | ||
fourDaysLater.setDate(today.getDate() + 4); | ||
sixDaysLater.setDate(today.getDate() + 6); | ||
|
||
|
||
cy.contains(formatDate(threeDaysLater).toString()).should('exist'); | ||
cy.contains(formatDate(fourDaysLater).toString()).should('exist'); | ||
cy.contains(formatDate(sixDaysLater).toString()).should('exist'); | ||
['AM', 'Approved', 'Rejected', 'Withdrawn'].forEach((status) => { | ||
cy.contains(status).should('exist'); | ||
}); | ||
|
||
}); | ||
|
||
}); |
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,71 @@ | ||
//Test Case 10.2: Filter by Start Date | ||
describe('Staff Able to filter Application History', () => { | ||
// 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/'); // Adjust the URL if needed | ||
|
||
// 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: Log in as Samsul Saifullah using cy.origin for third-party login | ||
cy.origin('https://wfhtrackingsystem.kinde.com', () => { | ||
cy.get('input[name="p_username"]').type('151495'); | ||
cy.get('button[type="submit"]').click(); | ||
|
||
cy.get('input[name="p_password"]', { timeout: 10000 }).should('be.visible'); | ||
|
||
cy.get('input[name="p_password"]').type('password'); | ||
cy.get('button[type="submit"]').click({ multiple: true }); | ||
}); | ||
}); | ||
|
||
it('should view "My arrangement requests" page', () => { | ||
// Step 3: Navigate to the "My arrangement requests" page | ||
cy.get('nav').should('contain', 'All-In-One'); | ||
cy.get('nav').contains('Arrangement').click(); | ||
cy.get('nav').contains('My requests').click(); | ||
|
||
// Step 4: Navigate to the My arrangement requests page | ||
cy.get('button').contains('Processed').click(); | ||
cy.wait(2000); | ||
|
||
const formatDate = (date) => { | ||
const year = date.getFullYear(); | ||
const month = String(date.getMonth() + 1).padStart(2, '0'); // Months are 0-indexed | ||
const day = String(date.getDate()).padStart(2, '0'); | ||
return `${year}-${month}-${day}`; | ||
}; | ||
|
||
// Get today's date and 3 days later from current date | ||
const today = new Date(); | ||
const threeDaysLater = new Date(today); | ||
|
||
// Adjust the future dates | ||
threeDaysLater.setDate(today.getDate() + 3); | ||
|
||
// filter by date | ||
cy.get('input[placeholder="Start date (YYYY-MM-DD)"]') | ||
.click() // Click to focus on the input | ||
.type(formatDate(threeDaysLater).toString()); | ||
|
||
cy.get('svg#search-icn') // Click on Search Icon | ||
.click(); | ||
cy.wait(2000); | ||
|
||
|
||
// Check that the processed arrangement requests exists | ||
cy.contains(formatDate(threeDaysLater).toString()).should('exist'); | ||
['AM', 'Approved'].forEach((status) => { | ||
cy.contains(status).should('exist'); | ||
}); | ||
|
||
}); | ||
|
||
}); |
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,45 @@ | ||
// /Test Case 10.3: Edge Case - No WFH Application History Exists | ||
describe('Staff do not have WFH Arrangement History', () => { | ||
// 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/'); // Adjust the URL if needed | ||
|
||
// 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: Log in as Nara Young using cy.origin for third-party login | ||
cy.origin('https://wfhtrackingsystem.kinde.com', () => { | ||
cy.get('input[name="p_username"]').type('151513'); | ||
cy.get('button[type="submit"]').click(); | ||
|
||
cy.get('input[name="p_password"]', { timeout: 10000 }).should('be.visible'); | ||
|
||
cy.get('input[name="p_password"]').type('password'); | ||
cy.get('button[type="submit"]').click({ multiple: true }); | ||
}); | ||
}); | ||
|
||
it('should show "No arrangement requests found."', () => { | ||
// Step 3: Navigate to the "My arrangement requests" page | ||
cy.get('nav').should('contain', 'All-In-One'); | ||
cy.get('nav').contains('Arrangement').click(); | ||
cy.get('nav').contains('My requests').click(); | ||
|
||
cy.contains('No arrangement requests found.').should('exist'); | ||
|
||
// Step 4: Navigate to the Processed tab | ||
cy.get('button').contains('Processed').click(); | ||
|
||
cy.contains('No arrangement requests found.').should('exist'); | ||
|
||
|
||
}); | ||
|
||
}); |
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,60 @@ | ||
//Test Case 13.1: Withdraw Entire Approved Recurring WFH Arrangement | ||
describe('Withdraw Entire Approved Recurring WFH Arrangement ', () => { | ||
// 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/'); // Adjust the URL if needed | ||
|
||
// 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: Log in as Manni Devi using cy.origin for third-party login | ||
cy.origin('https://wfhtrackingsystem.kinde.com', () => { | ||
cy.get('input[name="p_username"]').type('210018'); | ||
cy.get('button[type="submit"]').click(); | ||
|
||
cy.get('input[name="p_password"]', { timeout: 10000 }).should('be.visible'); | ||
|
||
cy.get('input[name="p_password"]').type('password'); | ||
cy.get('button[type="submit"]').click({ multiple: true }); | ||
}); | ||
}); | ||
|
||
it('should be able to withdraw approved arrangements', () => { | ||
// Step 3: Navigate to the "My arrangement requests" page | ||
cy.get('nav').should('contain', 'All-In-One'); | ||
cy.get('nav').contains('Arrangement').click(); | ||
cy.get('nav').contains('My requests').click(); | ||
|
||
cy.get('button').contains('Processed').click(); | ||
cy.wait(2000); | ||
|
||
cy.get('button[id="arrangement-sheet-trigger"]').eq(2).click({ force: true }); | ||
|
||
// Interact with the <select> element | ||
cy.get('button[role="combobox"]').first().click(); // Click the first matching button | ||
|
||
|
||
// Wait for the dropdown content to be visible (optional, for stability) | ||
cy.get('[role="listbox"]').should('be.visible'); | ||
|
||
// Click on the "AM" option | ||
cy.get('[role="option"]').contains('Withdraw entire arrangement').click(); | ||
|
||
cy.get('textarea') // Use the appropriate selector for your textarea | ||
.click() // Click on the textarea to focus it | ||
.type('Testing WFH E2E Test Case 13.1'); // Type the desired text | ||
|
||
// Submit | ||
cy.get('button[type="submit"]').click(); | ||
|
||
cy.contains('Arrangement(s) updated successfully').should('exist'); | ||
|
||
}); | ||
}); |
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,61 @@ | ||
//Test Case 13.2: Withdraw a Specific Day from an Approved Recurring WFH Arrangement | ||
describe('Withdraw Sepcific Approved Recurring WFH Arrangement ', () => { | ||
// 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/'); // Adjust the URL if needed | ||
|
||
// 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: Log in as Manni Devi using cy.origin for third-party login | ||
cy.origin('https://wfhtrackingsystem.kinde.com', () => { | ||
cy.get('input[name="p_username"]').type('210018'); | ||
cy.get('button[type="submit"]').click(); | ||
|
||
cy.get('input[name="p_password"]', { timeout: 10000 }).should('be.visible'); | ||
|
||
cy.get('input[name="p_password"]').type('password'); | ||
cy.get('button[type="submit"]').click({ multiple: true }); | ||
}); | ||
}); | ||
|
||
it('should be able to withdraw one approved recurring arrangements', () => { | ||
// Step 3: Navigate to the "My arrangement requests" page | ||
cy.get('nav').should('contain', 'All-In-One'); | ||
cy.get('nav').contains('Arrangement').click(); | ||
cy.get('nav').contains('My requests').click(); | ||
|
||
cy.get('button').contains('Processed').click(); | ||
cy.wait(2000); | ||
|
||
// Step 4: Navigate to the my arrangement request page | ||
cy.get('button[id="arrangement-sheet-trigger"]').eq(3).click({ force: true }); | ||
|
||
// Interact with the <select> element | ||
cy.get('button[role="combobox"]').first().click(); // Click the first matching button | ||
|
||
|
||
// Wait for the dropdown content to be visible (optional, for stability) | ||
cy.get('[role="listbox"]').should('be.visible'); | ||
|
||
// Click on the "AM" option | ||
cy.get('[role="option"]').contains('Withdraw this specific arrangement').click(); | ||
|
||
cy.get('textarea') // Use the appropriate selector for your textarea | ||
.click() // Click on the textarea to focus it | ||
.type('Testing WFH E2E Test Case 13.2'); // Type the desired text | ||
|
||
// Submit | ||
cy.get('button[type="submit"]').click(); | ||
|
||
cy.contains('Arrangement(s) updated successfully').should('exist'); | ||
|
||
}); | ||
}); |
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,61 @@ | ||
// Test Case 13.3: Withdraw an Approved Ad-Hoc WFH Arrangement & Test Case 13.4: Edge Case - Withdrawal Less Than 24 Hours Before WFH Day | ||
describe('Withdraw an Approved Ad-Hoc WFH Arrangement ', () => { | ||
// 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/'); // Adjust the URL if needed | ||
|
||
// 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: Log in as Manni Devi using cy.origin for third-party login | ||
cy.origin('https://wfhtrackingsystem.kinde.com', () => { | ||
cy.get('input[name="p_username"]').type('210018'); | ||
cy.get('button[type="submit"]').click(); | ||
|
||
cy.get('input[name="p_password"]', { timeout: 10000 }).should('be.visible'); | ||
|
||
cy.get('input[name="p_password"]').type('password'); | ||
cy.get('button[type="submit"]').click({ multiple: true }); | ||
}); | ||
}); | ||
|
||
it('should be able to withdraw approved ad-hoc arrangements', () => { | ||
// Step 3: Navigate to the "My arrangement requests" page | ||
cy.get('nav').should('contain', 'All-In-One'); | ||
cy.get('nav').contains('Arrangement').click(); | ||
cy.get('nav').contains('My requests').click(); | ||
|
||
cy.get('button').contains('Processed').click(); | ||
cy.wait(2000); | ||
|
||
// Step 4: Navigate to the my arrangement request page | ||
cy.get('button[id="arrangement-sheet-trigger"]').eq(1).click({ force: true }); | ||
|
||
// Interact with the <select> element | ||
cy.get('button[role="combobox"]').first().click(); // Click the first matching button | ||
|
||
|
||
// Wait for the dropdown content to be visible (optional, for stability) | ||
cy.get('[role="listbox"]').should('be.visible'); | ||
|
||
// Click on the "AM" option | ||
cy.get('[role="option"]').contains('Withdraw').click(); | ||
|
||
cy.get('textarea') // Use the appropriate selector for your textarea | ||
.click() // Click on the textarea to focus it | ||
.type('Testing WFH E2E Test Case 13.3'); // Type the desired text | ||
|
||
// Submit | ||
cy.get('button[type="submit"]').click(); | ||
|
||
cy.contains('Arrangement(s) updated successfully').should('exist'); | ||
|
||
}); | ||
}); |
Oops, something went wrong.