E2E Multiple File Upload
This is a working draft, not yet finalized
These tests are designed to verify the functionality of a file upload feature on a web application, specifically at the URL https://accelerate.unic.ac.cy/en/myfiles. The tests are likely executed in a headless browser environment, such as Puppeteer, although the specific browser automation library is not explicitly mentioned in the code snippet.
Here's a breakdown of what each part of the code does:
· Setup and Imports:
· The code imports a page object from login.js, which is a Puppeteer page object used to interact with the browser.
· It also imports a cleanup script (cleanup.js) to close the browser after all tests are completed.
· The expect function from the Chai library is used for assertions.
· Test Suite: The test suite is named "MY FILES Upload File Tests" and has a timeout of 30,000 milliseconds (30 seconds).
· Test 1: File Upload Success:
· Navigates to the file upload page.
· Clicks the upload button to open the file upload modal.
· Uploads two files (test.png and test2.png) from the local file system.
· Waits for a success message and verifies its content.
· Test 2: Verify First File Visibility:
· Checks if the first uploaded file (test.png) is visible in the file list on the main page.
· Test 3: Verify Second File Visibility:
· Checks if the second uploaded file (test2.png) is visible in the file list on the main page.
· Test 4: Click on the First Uploaded File:
· Clicks on the first uploaded file (test.png) and waits for the corresponding page to load.
· Verifies that the URL has changed to indicate the file page has loaded.
· Test 5: Verify Filename on the First File's Page:
· Verifies that the filename displayed on the file's page is correct (test.png).
· Test 6: Return to My Files Main View:
· Clicks the "Back" button to return to the main "My Files" page.
· Verifies that the navigation back to the main page is successful.
· Test 7: Click on the Second Uploaded File:
· Clicks on the second uploaded file (test2.png) and waits for the corresponding page to load.
· Verifies that the URL has changed to indicate the file page has loaded.
· Test 8: Verify Filename on the Second File's Page:
· Verifies that the filename displayed on the second file's page is correct (test2.png).
Overall, these tests ensure that files can be uploaded successfully, are visible on the main page, and that the correct file pages load when the files are clicked.