Currently, we are working on a project that uses Vue3 for the frontend and we are writing tests for the application using Playwright. Within our components, there is a download icon that, when clicked, triggers a handler to retrieve a presigned URL from S3. This presigned URL is then opened using window.open(s3_URL).
Here is the code for the handler:
await axios(url, requestOptionsGet) // Fetches the presigned URL
.then(response => {
// Check for 200 or 400 responses
})
.then(async response => {
const service_response = response as SERVICE_RESPONSE;
const s3DownloadUrl = service_response?.url;
window.open(s3DownloadUrl);// Opens the file in a new window for download
})
.catch(errorResponse => {
// Handle any errors
});
Now, we want to write Playwright tests for this functionality. Any suggestions on how to approach this would be greatly appreciated.