Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into retry-flake
Browse files Browse the repository at this point in the history
  • Loading branch information
flotwig committed Dec 12, 2022
2 parents 7e59bf9 + eb76b57 commit 5dfff86
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 19 deletions.
4 changes: 2 additions & 2 deletions cli/types/cypress.d.ts
Expand Up @@ -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

Expand Down Expand Up @@ -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<any> | ((subject: any) => any)

Expand Down
2 changes: 1 addition & 1 deletion guides/building-release-artifacts.md
Expand Up @@ -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.
7 changes: 7 additions & 0 deletions 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)


Expand Down
7 changes: 7 additions & 0 deletions 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)


Expand Down
Expand Up @@ -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$')),
)
})
})
Expand Down
10 changes: 5 additions & 5 deletions packages/app/cypress/e2e/run-all-specs.cy.ts
Expand Up @@ -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)
Expand Down Expand Up @@ -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 })

Expand Down
2 changes: 1 addition & 1 deletion packages/app/cypress/e2e/top-nav.cy.ts
Expand Up @@ -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,
)
})
})
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/store/run-all-specs-store.ts
Expand Up @@ -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
}
}
Expand Down
12 changes: 10 additions & 2 deletions packages/data-context/src/actions/ProjectActions.ts
Expand Up @@ -22,7 +22,7 @@ export interface ProjectApiShape {
* order for CT to startup
*/
openProjectCreate(args: InitializeProjectOptions, options: OpenProjectLaunchOptions): Promise<unknown>
launchProject(browser: FoundBrowser, spec: Cypress.Spec, options?: OpenProjectLaunchOpts): Promise<void>
launchProject(browser: FoundBrowser, spec: Cypress.Spec, options?: Partial<OpenProjectLaunchOpts>): Promise<void>
insertProjectToCache(projectRoot: string): Promise<void>
removeProjectFromCache(projectRoot: string): Promise<void>
getProjectRootsFromCache(): Promise<ProjectShape[]>
Expand All @@ -46,6 +46,8 @@ export interface ProjectApiShape {
emitter: EventEmitter
}
isListening: (url: string) => Promise<void>
resetBrowserTabsForNextTest(shouldKeepTabOpen: boolean): Promise<void>
resetServer(): void
}

export interface FindSpecs<T> {
Expand Down Expand Up @@ -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<OpenProjectLaunchOpts>, specPath?: string | null) {
if (!this.ctx.currentProject) {
return null
}
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions packages/driver/cypress/e2e/commands/commands.cy.js
Expand Up @@ -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()
})
Expand Down Expand Up @@ -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()
})
Expand Down
4 changes: 2 additions & 2 deletions packages/driver/src/cypress/error_messages.ts
Expand Up @@ -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.',
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql/schemas/schema.graphql
Expand Up @@ -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(
Expand Down
3 changes: 2 additions & 1 deletion packages/graphql/src/schemaTypes/objectTypes/gql-Mutation.ts
Expand Up @@ -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
},
Expand Down
6 changes: 6 additions & 0 deletions packages/server/lib/makeDataContext.ts
Expand Up @@ -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) {
Expand Down

0 comments on commit 5dfff86

Please sign in to comment.