sorry-cypress在AWS环境下截图与视频上传/展示失败求助
问题:sorry-cypress无法上传/展示S3存储的截图与视频
已花费三天配置sorry-cypress仪表盘,当前无法在仪表盘中上传、下载或展示Cypress测试过程中生成的截图与视频。
运行环境为Windows 11 + Docker Desktop,已通过Docker搭建完整的sorry-cypress服务(dashboard、director、API及MongoDB均正常运行,可通过http://localhost:<端口>访问,仪表盘能正常显示测试执行状态及结果,但无截图与视频展示)。
最初使用MinIO作为截图驱动未成功,切换为Amazon AWS S3驱动后,已创建对应IAM用户并配置基础权限,同时将存储桶设为公开,但测试后存储桶仍为空,仪表盘无图片与视频内容。
经观察发现,仪表盘生成的图片链接缺失docker-compose.full.yml中配置的AWS S3_REGION环境变量:
- sorry-cypress仪表盘指向的链接:
https://tportal-tests-dashboard.s3.amazonaws.com/c7bb5026f575dc63da0f95e6be5883c7.png - 手动上传至AWS S3的图片正确链接:
https://tportal-tests-dashboard.s3.eu-central-1.amazonaws.com/c7bb5026f575dc63da0f95e6be5883c7.png
已确认AWS_ACCESS_KEY_ID与AWS_SECRET_ACCESS_KEY配置正确(通过AWS控制台查看最近使用记录验证)。测试执行命令为:
npx cypress-cloud --parallel --record --key Ij0RfK --ci-build-id skap7
恳请告知还需进行哪些配置,才能让sorry-cypress-director正常访问AWS、上传截图与视频并在仪表盘展示?
配置信息
1. docker-compose.full.yml
version: '3.6' services: mongo: image: 'mongo:4.4' volumes: - ./data/data-mongo-cypress:/data/db director: image: 'agoldis/sorry-cypress-director:latest' environment: DASHBOARD_URL: 'http://localhost:8080' MONGODB_URI: 'mongodb://mongo:27017' MONGODB_DATABASE: 'sorry-cypress' EXECUTION_DRIVER: '../execution/mongo/driver' SCREENSHOTS_DRIVER: '../screenshots/s3.driver' GITLAB_JOB_RETRIES: 'false' AWS_ACCESS_KEY_ID: '<set from AWS>' AWS_SECRET_ACCESS_KEY: '<set from AWS>' S3_BUCKET: 'tportal-tests-dashboard' S3_REGION: 'eu-central-1' S3_ACL: 'public-read' PROBE_LOGGER: 'true' ports: - 1234:1234 depends_on: - mongo api: image: 'agoldis/sorry-cypress-api:latest' environment: MONGODB_URI: 'mongodb://mongo:27017' MONGODB_DATABASE: 'sorry-cypress' APOLLO_PLAYGROUND: 'false' ports: - 4000:4000 depends_on: - mongo dashboard: image: 'agoldis/sorry-cypress-dashboard:latest' environment: GRAPHQL_SCHEMA_URL: 'http://localhost:4000' GRAPHQL_CLIENT_CREDENTIALS: '' CI_URL: '' PORT: 8080 ports: - 8080:8080 depends_on: - mongo - api
2. AWS存储桶策略
{ "Version": "2012-10-17", "Statement": [ { "Sid": "SorryCypressUpload", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::6538********:user/sorry-cypress_dashboard" }, "Action": [ "s3:PutObject", "s3:PutObjectAcl" ], "Resource": "arn:aws:s3:::tportal-tests-dashboard/*" } ] }
3. AWS用户权限策略
{ "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": [ "s3:PutObject", "s3:PutObjectAcl" ], "Resource": "arn:aws:s3:::tportal-tests-dashboard/*" } ] }
4. cypress.config.js
const { defineConfig } = require("cypress"); const { cloudPlugin } = require("cypress-cloud/plugin"); module.exports = defineConfig({ projectId: "Ij0RfK", // setupNodeEvents can be defined in either // the e2e or component configuration e2e: { baseUrl: "https://localhost:44415/create-account/", viewportHeight: 900, viewportWidth: 1440, scrollBehavior: false, defaultCommandTimeout: 500, setupNodeEvents(on, config) { return cloudPlugin(on, config); }, }, $schema: "https://on.cypress.io/cypress.schema.json", });
5. currents.config.js
// currents.config.js module.exports = { projectId: "Ij0RfK", recordKey: "xxx", // Sorry Cypress users - set the director service URL cloudServiceUrl: "http://localhost:1234/", };
内容的提问来源于stack exchange,提问作者TantrumV
相关产品推荐
相关产品推荐

