diff --git a/packages/data-context/src/sources/VersionsDataSource.ts b/packages/data-context/src/sources/VersionsDataSource.ts index 534370bda72d..604b5bebd5cc 100644 --- a/packages/data-context/src/sources/VersionsDataSource.ts +++ b/packages/data-context/src/sources/VersionsDataSource.ts @@ -139,6 +139,7 @@ export class VersionsDataSource { 'x-os-name': os.platform(), 'x-arch': os.arch(), 'x-initial-launch': String(this._initialLaunch), + 'x-logged-in': String(!!this.ctx.user), } if (this._currentTestingType) { diff --git a/packages/data-context/test/unit/sources/VersionsDataSource.spec.ts b/packages/data-context/test/unit/sources/VersionsDataSource.spec.ts index 456a89392867..4597ad830e36 100644 --- a/packages/data-context/test/unit/sources/VersionsDataSource.spec.ts +++ b/packages/data-context/test/unit/sources/VersionsDataSource.spec.ts @@ -52,6 +52,7 @@ describe('VersionsDataSource', () => { 'x-initial-launch': String(true), 'x-machine-id': 'abcd123', 'x-testing-type': 'e2e', + 'x-logged-in': 'false', }, }).resolves({ json: sinon.stub().resolves({ @@ -104,6 +105,7 @@ describe('VersionsDataSource', () => { 'x-arch': 'x64', 'x-initial-launch': String(false), 'x-testing-type': 'component', + 'x-logged-in': 'false', }, }).resolves({ json: sinon.stub().resolves({ @@ -136,6 +138,7 @@ describe('VersionsDataSource', () => { 'x-initial-launch': String(true), 'x-machine-id': 'abcd123', 'x-testing-type': 'e2e', + 'x-logged-in': 'false', }, }) .rejects() @@ -162,6 +165,7 @@ describe('VersionsDataSource', () => { 'x-initial-launch': String(true), 'x-machine-id': 'abcd123', 'x-testing-type': 'e2e', + 'x-logged-in': 'false', }, }) .callsFake(async () => new Response('Error')) diff --git a/packages/launchpad/cypress/e2e/open-mode.cy.ts b/packages/launchpad/cypress/e2e/open-mode.cy.ts index f51ef39e5732..58a2ee5b600b 100644 --- a/packages/launchpad/cypress/e2e/open-mode.cy.ts +++ b/packages/launchpad/cypress/e2e/open-mode.cy.ts @@ -28,21 +28,53 @@ describe('Launchpad: Open Mode', () => { cy.get('h1').should('contain', 'Choose a Browser') }) - it('includes x-framework and x-dev-server in request to Cypress manifest, even when launched in e2e mode', () => { - cy.withCtx((ctx, o) => { - o.sinon.spy(ctx.util.fetch) + describe('request for Cypress manifest', () => { + beforeEach(() => { + cy.withCtx((ctx, o) => { + o.sinon.spy(ctx.util.fetch) + }) + + cy.scaffoldProject('todos') + cy.openProject('todos', ['--e2e']) }) - cy.scaffoldProject('todos') - cy.openProject('todos', ['--e2e']) - cy.visitLaunchpad() - cy.get('h1').should('contain', 'Choose a Browser') - cy.withCtx((ctx, o) => { - expect(ctx.util.fetch).to.have.been.calledWithMatch('https://download.cypress.io/desktop.json', { - headers: { - 'x-framework': 'react', - 'x-dev-server': 'webpack', - }, + it('includes x-framework and x-dev-server, even when launched in e2e mode', () => { + cy.visitLaunchpad() + cy.get('h1').should('contain', 'Choose a Browser') + cy.withCtx((ctx, o) => { + expect(ctx.util.fetch).to.have.been.calledWithMatch('https://download.cypress.io/desktop.json', { + headers: { + 'x-framework': 'react', + 'x-dev-server': 'webpack', + }, + }) + }) + }) + + describe('logged-in state', () => { + it(`sends 'false' when not logged in`, () => { + cy.visitLaunchpad() + cy.get('h1').should('contain', 'Choose a Browser') + cy.withCtx((ctx, o) => { + expect(ctx.util.fetch).to.have.been.calledWithMatch('https://download.cypress.io/desktop.json', { + headers: { + 'x-logged-in': 'false', + }, + }) + }) + }) + + it(`sends 'true' when logged in`, () => { + cy.loginUser() + cy.visitLaunchpad() + cy.get('h1').should('contain', 'Choose a Browser') + cy.withCtx((ctx, o) => { + expect(ctx.util.fetch).to.have.been.calledWithMatch('https://download.cypress.io/desktop.json', { + headers: { + 'x-logged-in': 'true', + }, + }) + }) }) }) })