OrangeHRM Test Case - Profile Picture Upload With Invalid File
OrangeHRM Test Case - Profile Picture Upload With Invalid File
## Test Case: Error Handling for Uploading an Invalid File Format as Profile
Picture
**Precondition**:
1. OrangeHRM 3.0 site is launched on a compatible browser (e.g., Chrome, Firefox,
Edge).
2. A valid ESS user account is logged in to the OrangeHRM portal.
3. The user has navigated to the "Personal Information" page.
4. A non-image file (e.g., a .txt or .pdf file) less than 1 MB in size is available
on the local machine for testing.
5. The system is configured to accept only specific image formats (e.g., PNG, JPEG,
GIF) for profile picture uploads.
**Steps**:
1. On the "Personal Information" page, locate the photograph displayed at the top
left corner.
2. Click on the photograph to access the "Photograph" screen.
3. On the "Photograph" screen, click the "Choose a file" button to open the file
explorer.
4. Browse the local machine and select a non-image file (e.g., a .txt or .pdf
file).
5. Verify that the selected file’s name appears in the "Choose a file" box.
6. Click the "Upload" button to attempt to upload the file.
7. Observe the system’s response and any error messages displayed.
**Test Data**:
- File 1:
- Name: "test_document.txt"
- Type: Text file (.txt)
- Size: 500 KB
- Location: "C:\TestFiles\test_document.txt"
- File 2:
- Name: "sample.pdf"
- Type: PDF file (.pdf)
- Size: 800 KB
- Location: "C:\TestFiles\sample.pdf"
**Expected Result**:
- The file upload attempt fails.
- An error message is displayed on the "Photograph" screen, such as "Invalid file
format. Only PNG, JPEG, or GIF files are allowed."
- The profile picture remains unchanged, retaining the original or default image.
- The page does not refresh with a new image, and the user stays on the
"Photograph" screen.
- The system prevents the invalid file from being saved to the server.
**Post-condition**:
- The user’s profile picture in the OrangeHRM database remains unchanged.
- The user remains on the "Photograph" screen, with the option to select a valid
file or cancel the operation.
- No invalid files are stored on the server, ensuring data integrity.
**Note**:
- Test with multiple invalid file types (e.g., .docx, .zip, .exe) to ensure
consistent error handling.
- Verify that the error message is clear, user-friendly, and specifies the allowed
file formats.
- Check the system’s behavior with edge cases, such as files exactly at or slightly
above the 1 MB size limit, to confirm size validation works correctly.
- Ensure that the system logs the failed upload attempt for audit purposes, if
applicable.
- Consider testing with a corrupted image file (e.g., a .png file with invalid
content) to verify additional validation checks.