Rayrun
← Back to Discord Forum

Sharing report from artefacts after tests

fellogen_77366posted in #help-playwright
Open in Discord
fellogen_77366

Whats the best and easy way to share report after github actions job?

Can AWS be used for it to generate new unique static website from provided zipped file (default playwright html report with trace screenshots etc).

This thread is trying to answer question "What's the best and easy way to share report after a GitHub actions job?"

3 replies

This assumes you have authenticated your AWS user through a gh action like aws-actions/configure-aws-credentials@v1-node16

- name: Push files to S3
        if: always()
        id: push_files_to_s3
        run: aws s3 sync playwright-report s3://S3_BUKET_NAME/${{env.PR_NUMBER}}_${{ github.run_id }} --include "playwright report/*" --expires "$(date -d '+30 day' --utc +'%Y-%m-%dT%H:%M:%SZ')"

I have plans to write a guide on how to do this, but may be a few months. This is the jist of sending files to an S3 bucket. There are S3 bucket configurations that need to be done to make it a visible webpage.

If you have secrets or private information in your test data, I would definitely talk to someone on infrastructure team or security team to ensure the url is built in a way that is only accessible via vpn or password protected.

fellogen_77366

Thanks mate, I've already passed this info, and actually, there was one person really familiar with our AWS. He connected the report, so it's doable for sure. And yes, he made it visible only via VPN, so that's neat.

We don't use GitHub actions, but we simply upload the playwright-report folder to a public s3 bucket and the html file can be opened from there. We also use a Slack bot to trigger pipelines and share that report when tests are done.

Answer

Sure, let's get started with AWS services to share your report after a GitHub Actions job and generate a unique static website from a zipped file.

Step 1: Set Up an S3 Bucket

First, you need to create an S3 bucket in your AWS account. This bucket will store the zipped file and serve as the source for your static website.

Step 2: Upload the Zipped File

After creating the S3 bucket, upload the zipped file containing your report to this bucket. You can use the AWS Management Console or AWS CLI for this.

Step 3: Enable Static Website Hosting

Next, enable Static Website Hosting for your S3 bucket. Go to the Properties tab of your bucket in the AWS Management Console and select "Static website hosting". Specify an index document (like index.html) that will be served when accessing your website.

Step 4: Configure Bucket Policy

To allow public access to your static website, configure a Bucket Policy that grants read access to all users or specific IAM roles/users. You can define this policy under Permissions > Bucket Policy in the AWS Management Console.

Step 5: Create CloudFront Distribution (Optional)

If you want to improve performance and add SSL/TLS encryption, consider creating a CloudFront distribution for your static website using Amazon CloudFront service.

Step 6: Route 53 DNS Configuration (Optional)

If you want to use a custom domain name for your static website, configure DNS settings using Amazon Route 53 service. Create appropriate records (like A record or CNAME record) that point to either CloudFront distribution or directly to S3 endpoint.

Step 7: Generate Pre-Signed URL

Finally, to provide secure access control and temporary URLs for downloading files from S3, generate pre-signed URLs using AWS SDKs or CLI tools like aws s3 presign. Share these URLs with users to download the zipped file.

That's it! You've now set up a unique static website using AWS services to share your report after a GitHub Actions job. This approach leverages the scalability and reliability of AWS infrastructure. For more specific requirements, consult the official AWS documentation or seek professional guidance.

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].