From 9505edd007322e788be18dcea52890de4b951adc Mon Sep 17 00:00:00 2001 From: Ryan Manuel Date: Mon, 13 Jun 2022 09:29:39 -0500 Subject: [PATCH 01/32] chore: downgrade windows resource class to large (#22258) --- circle.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/circle.yml b/circle.yml index 1c0f5ed6a45d..4bdb9eab5e0d 100644 --- a/circle.yml +++ b/circle.yml @@ -98,7 +98,7 @@ executors: machine: image: windows-server-2019-vs2019:stable shell: bash.exe -eo pipefail - resource_class: windows.xlarge + resource_class: windows.large environment: PLATFORM: windows @@ -2581,21 +2581,21 @@ windows-workflow: &windows-workflow - node_modules_install: name: windows-node-modules-install executor: windows - resource_class: windows.xlarge + resource_class: windows.large only-cache-for-root-user: true - build: name: windows-build context: test-runner:env-canary executor: windows - resource_class: windows.xlarge + resource_class: windows.large requires: - windows-node-modules-install - run-app-integration-tests-chrome: name: windows-run-app-integration-tests-chrome executor: windows - resource_class: windows.xlarge + resource_class: windows.large context: test-runner:launchpad-tests requires: - windows-build @@ -2603,7 +2603,7 @@ windows-workflow: &windows-workflow - run-launchpad-integration-tests-chrome: name: windows-run-launchpad-integration-tests-chrome executor: windows - resource_class: windows.xlarge + resource_class: windows.large context: test-runner:launchpad-tests requires: - windows-build @@ -2619,7 +2619,7 @@ windows-workflow: &windows-workflow <<: *full-windows-workflow-filters name: windows-unit-tests executor: windows - resource_class: windows.xlarge + resource_class: windows.large requires: - windows-build @@ -2627,7 +2627,7 @@ windows-workflow: &windows-workflow <<: *full-windows-workflow-filters name: windows-create-build-artifacts executor: windows - resource_class: windows.xlarge + resource_class: windows.large context: - test-runner:sign-windows-binary - test-runner:upload From 474f02698050969e409e616b6ea1e20a16a3067e Mon Sep 17 00:00:00 2001 From: Mike Plummer Date: Mon, 13 Jun 2022 12:00:23 -0500 Subject: [PATCH 02/32] fix: Time out loading embed html for migration video, stub in e2e tests (#22165) --- .../src/sources/MigrationDataSource.ts | 8 +- .../unit/sources/MigrationDataSource.spec.ts | 77 +++++++++++++++++++ .../launchpad/cypress/e2e/migration.cy.ts | 40 +++++++--- 3 files changed, 114 insertions(+), 11 deletions(-) create mode 100644 packages/data-context/test/unit/sources/MigrationDataSource.spec.ts diff --git a/packages/data-context/src/sources/MigrationDataSource.ts b/packages/data-context/src/sources/MigrationDataSource.ts index 8e099ea2a7db..849b28ada639 100644 --- a/packages/data-context/src/sources/MigrationDataSource.ts +++ b/packages/data-context/src/sources/MigrationDataSource.ts @@ -104,8 +104,12 @@ export class MigrationDataSource { const versionData = await this.ctx.versions.versionData() const embedOnLink = `https://on.cypress.io/v10-video-embed/${versionData.current.version}` + // Time out request if it takes longer than 3 seconds + const controller = new AbortController() + const timeoutId = setTimeout(() => controller.abort(), 3000) + try { - const response = await this.ctx.util.fetch(embedOnLink, { method: 'GET' }) + const response = await this.ctx.util.fetch(embedOnLink, { method: 'GET', signal: controller.signal }) const { videoHtml } = await response.json() this.ctx.update((d) => { @@ -116,6 +120,8 @@ export class MigrationDataSource { } catch { // fail silently, no user-facing error is needed return null + } finally { + clearTimeout(timeoutId) } } diff --git a/packages/data-context/test/unit/sources/MigrationDataSource.spec.ts b/packages/data-context/test/unit/sources/MigrationDataSource.spec.ts new file mode 100644 index 000000000000..4af5f767172d --- /dev/null +++ b/packages/data-context/test/unit/sources/MigrationDataSource.spec.ts @@ -0,0 +1,77 @@ +import { expect } from 'chai' +import dedent from 'dedent' +import sinon from 'sinon' + +import { DataContext } from '../../../src' +import { MigrationDataSource } from '../../../src/sources' +import { createTestDataContext } from '../helper' + +const pkg = require('@packages/root') + +describe('MigrationDataSource', () => { + context('.migration', () => { + let ctx: DataContext + let fetchStub: sinon.SinonStub + + beforeEach(() => { + ctx = createTestDataContext('open') + + ctx.coreData.currentTestingType = 'e2e' + + fetchStub = sinon.stub() + + sinon.stub(ctx.util, 'fetch').callsFake(fetchStub) + }) + + afterEach(() => { + fetchStub.reset() + sinon.restore() + }) + + describe('getVideoEmbedHtml', () => { + const expectedPayload = { + videoHtml: dedent` +