diff --git a/cli/types/cypress.d.ts b/cli/types/cypress.d.ts index a4705a530c1b..91d80c342334 100644 --- a/cli/types/cypress.d.ts +++ b/cli/types/cypress.d.ts @@ -362,7 +362,7 @@ declare namespace Cypress { /** * Utility functions for ensuring various properties about a subject. - * @see https://on.cypress.io/custom-queries + * @see https://on.cypress.io/api/custom-queries */ ensure: Ensure @@ -1613,7 +1613,7 @@ declare namespace Cypress { /** * Invoke a command synchronously, without using the command queue. * - * @see https://on.cypress.io/custom-queries + * @see https://on.cypress.io/api/custom-queries */ now(name: string, ...args: any[]): Promise | ((subject: any) => any) diff --git a/guides/building-release-artifacts.md b/guides/building-release-artifacts.md index 4cbc053208c7..349c393fcf28 100644 --- a/guides/building-release-artifacts.md +++ b/guides/building-release-artifacts.md @@ -35,6 +35,6 @@ The npm package requires a corresponding binary of the same version. In producti You can build the Cypress binary locally by running `yarn binary-build`. You can use Linux to build the Cypress binary (just like it is in CI) by running `yarn binary-build` inside of `yarn docker`. -If you're on macOS and building locally, you'll need a code-signing certificate in your keychain, which you can get by following the [instructions on Apple's website](https://developer.apple.com/library/archive/documentation/Security/Conceptual/CodeSigningGuide/Procedures/Procedures.html#//apple_ref/doc/uid/TP40005929-CH4-SW30). Also, you'll also most likely want to skip notarization since it requires an Apple Developer Program account - set `SKIP_NOTARIZATION=1` when building locally to do this. +If you're on macOS and building locally, you'll need a code-signing certificate in your keychain, which you can get by following the [instructions on Apple's website](https://developer.apple.com/library/archive/documentation/Security/Conceptual/CodeSigningGuide/Procedures/Procedures.html#//apple_ref/doc/uid/TP40005929-CH4-SW30). Also, you'll also most likely want to skip notarization since it requires an Apple Developer Program account - set `SKIP_NOTARIZATION=1` when building locally to do this. [More info about code signing in CI](./code-signing.md). `yarn binary-zip` can be used to zip the built binary together. diff --git a/npm/grep/CHANGELOG.md b/npm/grep/CHANGELOG.md index 6a23cc3926bb..ea29de2e18e7 100644 --- a/npm/grep/CHANGELOG.md +++ b/npm/grep/CHANGELOG.md @@ -1,3 +1,10 @@ +# [@cypress/grep-v3.1.2](https://github.com/cypress-io/cypress/compare/@cypress/grep-v3.1.1...@cypress/grep-v3.1.2) (2022-12-09) + + +### Bug Fixes + +* declare used babel dependencies ([#24842](https://github.com/cypress-io/cypress/issues/24842)) ([910f912](https://github.com/cypress-io/cypress/commit/910f912373bf857a196e2a0d1a73606e3ee199be)) + # [@cypress/grep-v3.1.1](https://github.com/cypress-io/cypress/compare/@cypress/grep-v3.1.0...@cypress/grep-v3.1.1) (2022-12-08) diff --git a/npm/webpack-preprocessor/CHANGELOG.md b/npm/webpack-preprocessor/CHANGELOG.md index 689ed2348ed7..dba1dd0ff6be 100644 --- a/npm/webpack-preprocessor/CHANGELOG.md +++ b/npm/webpack-preprocessor/CHANGELOG.md @@ -1,3 +1,10 @@ +# [@cypress/webpack-preprocessor-v5.15.7](https://github.com/cypress-io/cypress/compare/@cypress/webpack-preprocessor-v5.15.6...@cypress/webpack-preprocessor-v5.15.7) (2022-12-09) + + +### Bug Fixes + +* declare used babel dependencies ([#24842](https://github.com/cypress-io/cypress/issues/24842)) ([910f912](https://github.com/cypress-io/cypress/commit/910f912373bf857a196e2a0d1a73606e3ee199be)) + # [@cypress/webpack-preprocessor-v5.15.6](https://github.com/cypress-io/cypress/compare/@cypress/webpack-preprocessor-v5.15.5...@cypress/webpack-preprocessor-v5.15.6) (2022-12-02) diff --git a/packages/app/cypress/e2e/cypress-in-cypress-component.cy.ts b/packages/app/cypress/e2e/cypress-in-cypress-component.cy.ts index 325d6b1999b8..1971468fd7e9 100644 --- a/packages/app/cypress/e2e/cypress-in-cypress-component.cy.ts +++ b/packages/app/cypress/e2e/cypress-in-cypress-component.cy.ts @@ -147,7 +147,7 @@ describe('Cypress In Cypress CT', { viewportWidth: 1500, defaultCommandTimeout: expect(ctx.actions.browser.setActiveBrowserById).to.have.been.calledWith(browserId) expect(genId).to.eql('firefox-firefox-stable') expect(ctx.actions.project.launchProject).to.have.been.calledWith( - ctx.coreData.currentTestingType, undefined, o.sinon.match(new RegExp('cypress\-in\-cypress\/src\/TestComponent\.spec\.jsx$')), + ctx.coreData.currentTestingType, { shouldLaunchNewTab: false }, o.sinon.match(new RegExp('cypress\-in\-cypress\/src\/TestComponent\.spec\.jsx$')), ) }) }) diff --git a/packages/app/cypress/e2e/run-all-specs.cy.ts b/packages/app/cypress/e2e/run-all-specs.cy.ts index 342de684b079..2acc735672f5 100644 --- a/packages/app/cypress/e2e/run-all-specs.cy.ts +++ b/packages/app/cypress/e2e/run-all-specs.cy.ts @@ -45,9 +45,10 @@ describe('run-all-specs', () => { cy.waitForSpecToFinish({ passCount: 2 }) - cy.withCtx((ctx, { specs }) => { + cy.withCtx((ctx, { specs, RUN_ALL_SPECS_KEY }) => { + expect(ctx.actions.project.launchProject).to.have.been.calledWith('e2e', { shouldLaunchNewTab: true }, RUN_ALL_SPECS_KEY) expect(ctx.project.runAllSpecs).to.include.members(specs.map((spec) => spec.relative)) - }, { specs: subDirectorySpecs }) + }, { specs: subDirectorySpecs, RUN_ALL_SPECS_KEY }) for (const spec of subDirectorySpecs) { cy.get('.runnable-title').contains(spec.name) @@ -100,10 +101,9 @@ describe('run-all-specs', () => { clickRunAllSpecs('all') - cy.withCtx((ctx, { specs, runAllSpecsKey }) => { - expect(ctx.actions.project.launchProject).to.have.been.calledWith('e2e', undefined, runAllSpecsKey) + cy.withCtx((ctx, { specs }) => { expect(ctx.project.runAllSpecs).to.include.members(specs.map((spec) => spec.relative)) - }, { specs: Object.values(ALL_SPECS), runAllSpecsKey: RUN_ALL_SPECS_KEY }) + }, { specs: Object.values(ALL_SPECS) }) cy.waitForSpecToFinish({ passCount: 6 }) diff --git a/packages/app/cypress/e2e/top-nav.cy.ts b/packages/app/cypress/e2e/top-nav.cy.ts index 0a324de0360d..87819647e20a 100644 --- a/packages/app/cypress/e2e/top-nav.cy.ts +++ b/packages/app/cypress/e2e/top-nav.cy.ts @@ -110,7 +110,7 @@ describe('App Top Nav Workflows', () => { expect(ctx.actions.browser.setActiveBrowserById).to.have.been.calledWith(browserId) expect(genId).to.eql('edge-chromium-stable') expect(ctx.actions.project.launchProject).to.have.been.calledWith( - ctx.coreData.currentTestingType, undefined, undefined, + ctx.coreData.currentTestingType, { shouldLaunchNewTab: false }, undefined, ) }) }) diff --git a/packages/app/src/store/run-all-specs-store.ts b/packages/app/src/store/run-all-specs-store.ts index 066360cdf46a..d1f50b7bd218 100644 --- a/packages/app/src/store/run-all-specs-store.ts +++ b/packages/app/src/store/run-all-specs-store.ts @@ -22,7 +22,7 @@ query RunAllSpecsData { gql` mutation RunAllSpecs ($specPath: String!, $runAllSpecs: [String!]!) { setRunAllSpecs(runAllSpecs: $runAllSpecs) - launchOpenProject(specPath: $specPath) { + launchOpenProject(specPath: $specPath, shouldLaunchNewTab: true) { id } } diff --git a/packages/data-context/src/actions/ProjectActions.ts b/packages/data-context/src/actions/ProjectActions.ts index 605d499de02b..2a200c767a53 100644 --- a/packages/data-context/src/actions/ProjectActions.ts +++ b/packages/data-context/src/actions/ProjectActions.ts @@ -22,7 +22,7 @@ export interface ProjectApiShape { * order for CT to startup */ openProjectCreate(args: InitializeProjectOptions, options: OpenProjectLaunchOptions): Promise - launchProject(browser: FoundBrowser, spec: Cypress.Spec, options?: OpenProjectLaunchOpts): Promise + launchProject(browser: FoundBrowser, spec: Cypress.Spec, options?: Partial): Promise insertProjectToCache(projectRoot: string): Promise removeProjectFromCache(projectRoot: string): Promise getProjectRootsFromCache(): Promise @@ -46,6 +46,8 @@ export interface ProjectApiShape { emitter: EventEmitter } isListening: (url: string) => Promise + resetBrowserTabsForNextTest(shouldKeepTabOpen: boolean): Promise + resetServer(): void } export interface FindSpecs { @@ -228,7 +230,7 @@ export class ProjectActions { } } - async launchProject (testingType: Cypress.TestingType | null, options?: OpenProjectLaunchOpts, specPath?: string | null) { + async launchProject (testingType: Cypress.TestingType | null, options?: Partial, specPath?: string | null) { if (!this.ctx.currentProject) { return null } @@ -261,6 +263,12 @@ export class ProjectActions { specType: testingType === 'e2e' ? 'integration' : 'component', } + // Used for run-all-specs feature + if (options?.shouldLaunchNewTab) { + await this.api.resetBrowserTabsForNextTest(true) + this.api.resetServer() + } + await this.api.launchProject(browser, activeSpec ?? emptySpec, options) return diff --git a/packages/driver/cypress/e2e/commands/commands.cy.js b/packages/driver/cypress/e2e/commands/commands.cy.js index 00c9c21deb16..e1fd6147814b 100644 --- a/packages/driver/cypress/e2e/commands/commands.cy.js +++ b/packages/driver/cypress/e2e/commands/commands.cy.js @@ -91,7 +91,7 @@ describe('src/cy/commands/commands', () => { it('throws when attempting to add an existing query', (done) => { cy.on('fail', (err) => { expect(err.message).to.eq('`Cypress.Commands.addQuery()` is used to create new queries, but `get` is an existing Cypress command or query, or is reserved internally by Cypress.\n\n If you want to override an existing command or query, use `Cypress.Commands.overrideQuery()` instead.') - expect(err.docsUrl).to.eq('https://on.cypress.io/custom-queries') + expect(err.docsUrl).to.eq('https://on.cypress.io/api/custom-queries') done() }) @@ -139,7 +139,7 @@ describe('src/cy/commands/commands', () => { it('throws when attempting to add a query with the same name as an internal function', (done) => { cy.on('fail', (err) => { expect(err.message).to.eq('`Cypress.Commands.addQuery()` cannot create a new query named `addCommand` because that name is reserved internally by Cypress.') - expect(err.docsUrl).to.eq('https://on.cypress.io/custom-queries') + expect(err.docsUrl).to.eq('https://on.cypress.io/api/custom-queries') done() }) diff --git a/packages/driver/src/cypress/error_messages.ts b/packages/driver/src/cypress/error_messages.ts index bf25609772bb..dfb61ace1c9c 100644 --- a/packages/driver/src/cypress/error_messages.ts +++ b/packages/driver/src/cypress/error_messages.ts @@ -853,11 +853,11 @@ export default { }, invalid_new_query: { message: '`Cypress.Commands.addQuery()` is used to create new queries, but `{{name}}` is an existing Cypress command or query, or is reserved internally by Cypress.\n\n If you want to override an existing command or query, use `Cypress.Commands.overrideQuery()` instead.', - docsUrl: 'https://on.cypress.io/custom-queries', + docsUrl: 'https://on.cypress.io/api/custom-queries', }, reserved_command_query: { message: '`Cypress.Commands.addQuery()` cannot create a new query named `{{name}}` because that name is reserved internally by Cypress.', - docsUrl: 'https://on.cypress.io/custom-queries', + docsUrl: 'https://on.cypress.io/api/custom-queries', }, invalid_overwrite: { message: 'Cannot overwite command for: `{{name}}`. An existing command does not exist by that name.', diff --git a/packages/graphql/schemas/schema.graphql b/packages/graphql/schemas/schema.graphql index 42f5379c2919..2dc07eb675c1 100644 --- a/packages/graphql/schemas/schema.graphql +++ b/packages/graphql/schemas/schema.graphql @@ -1255,7 +1255,7 @@ type Mutation { internal_clearProjectPreferencesCache(projectTitle: String!): Boolean """Launches project from open_project global singleton""" - launchOpenProject(specPath: String): CurrentProject + launchOpenProject(shouldLaunchNewTab: Boolean, specPath: String): CurrentProject """Sets the active browser""" launchpadSetBrowser( diff --git a/packages/graphql/src/schemaTypes/objectTypes/gql-Mutation.ts b/packages/graphql/src/schemaTypes/objectTypes/gql-Mutation.ts index 52fc5dae1699..d47fe99f7413 100644 --- a/packages/graphql/src/schemaTypes/objectTypes/gql-Mutation.ts +++ b/packages/graphql/src/schemaTypes/objectTypes/gql-Mutation.ts @@ -294,10 +294,11 @@ export const mutation = mutationType({ type: CurrentProject, description: 'Launches project from open_project global singleton', args: { + shouldLaunchNewTab: booleanArg(), specPath: stringArg(), }, resolve: async (_, args, ctx) => { - await ctx.actions.project.launchProject(ctx.coreData.currentTestingType, undefined, args.specPath) + await ctx.actions.project.launchProject(ctx.coreData.currentTestingType, { shouldLaunchNewTab: args.shouldLaunchNewTab ?? false }, args.specPath) return ctx.lifecycleManager }, diff --git a/packages/server/lib/makeDataContext.ts b/packages/server/lib/makeDataContext.ts index 466e2f52476d..82857e8bc6cb 100644 --- a/packages/server/lib/makeDataContext.ts +++ b/packages/server/lib/makeDataContext.ts @@ -155,6 +155,12 @@ export function makeDataContext (options: MakeDataContextOptions): DataContext { return devServer }, isListening, + resetBrowserTabsForNextTest (shouldKeepTabOpen: boolean) { + return openProject.resetBrowserTabsForNextTest(shouldKeepTabOpen) + }, + resetServer () { + return openProject.getProject()?.server.reset() + }, }, electronApi: { openExternal (url: string) {