Skip to content

S3 screenshot driver

Andrew Goldis edited this page May 2, 2020 · 3 revisions

S3 Screenshots / Video driver

The driver generates upload URLs for S3 bucket. When set up properly the following will happen when each test suite finishes:

  • cypress agent reports to director what videos and / or failed tests screenshots are availabe.
  • director uses AWS credentials to generate
    • a temporary signed URL for each screenshot / video
    • a read URL is saved to associated test results
  • cypress agent uses the temporary URL to upload the assets
  • dashboard uses the read URL to display video / screenshots

AWS setup

Please make sure that AWS credentials with proper access to invoke s3.getSignedUrl are available in the environment.

Configuration

You can customize certain aspects of how director handles upload and read URLs generation by setting up environment variables.

SCREENSHOTS_DRIVER

Defines what screenshot driver to use. In order to use S3 driver set value:

SCREENSHOTS_DRIVER="../screenshots/s3.driver"

S3_BUCKET

Set the bucket name to store the asset. There's no default value, you have to set it before using the driver.

S3_BUCKET="your_bucket_name"

S3_REGION

AWS region, default value is "us-east-1"

S3_REGION="us-east-1"

S3_ACL

ACL settings that for new S3 items. The default value is "public-read". Read more about S3 ACL.

S3_ACL="public-read"

S3_READ_URL_PREFIX

The URL prefix to use when reading the screenshots / video. The default value is https://${S3_BUCKET}.s3.amazonaws.com/${key}.

Setting S3_READ_URL_PREFIX to http://example.com will change the generated URL to https://example.com/${key}.

S3_READ_URL_PREFIX=<null>

S3_IMAGE_KEY_PREFIX

The prefix to use when uploading the screenshots. Setting S3_IMAGE_KEY_PREFIX to images will change the generated S3 object key for screenshots images/${key}.

S3_IMAGE_KEY_PREFIX=<null>

S3_VIDEO_KEY_PREFIX

The prefix to use when uploading the videos. Setting S3_VIDEO_KEY_PREFIX to videos will change the generated S3 object key for videos videos/${key}.

S3_VIDEO_KEY_PREFIX=<null>