Skip to content

Commit

Permalink
Merge branch 'develop' into jordanpowell88/add-linting
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanpowell88 authored May 30, 2023
2 parents b03e269 + d34a148 commit 0b744ad
Show file tree
Hide file tree
Showing 44 changed files with 964 additions and 113 deletions.
2 changes: 1 addition & 1 deletion .circleci/workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ windowsWorkflowFilters: &windows-workflow-filters
- equal: [ develop, << pipeline.git.branch >> ]
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
- equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ]
- equal: [ 'ryanm/feat/unify-cdp-approach-in-electron', << pipeline.git.branch >> ]
- equal: [ 'stokes/fix_windows_e2e_test', << pipeline.git.branch >> ]
- matches:
pattern: /^release\/\d+\.\d+\.\d+$/
value: << pipeline.git.branch >>
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/stale_issues_and_pr_cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
max-operations-per-run:
description: 'max operations per run'
required: false
default: 800
default: 3000
days-before-stale:
description: 'days-before-stale'
required: false
Expand All @@ -33,7 +33,7 @@ permissions:
pull-requests: write
env:
DEFAULT_DEBUG_ONLY: true
DEFAULT_MAX_OPS: 800
DEFAULT_MAX_OPS: 3000
DEFAULT_DAYS_BEFORE_STALE: 180
DEFAULT_DAYS_BEFORE_CLOSE: 14
DEFAULT_EXEMPT_ISSUE_LABELS: 'type: feature,type: enhancement,routed-to-e2e,routed-to-ct,routed-to-tools,routed-to-cloud,prevent-stale,triaged'
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
<a href="https://www.npmjs.com/package/cypress">
<img src="https://img.shields.io/npm/dm/cypress.svg" alt="npm"/>
</a>
<a href="https://gitter.im/cypress-io/cypress">
<img src="https://img.shields.io/gitter/room/cypress-io/cypress.svg" alt="Gitter chat"/>
<a href="https://on.cypress.io/discord">
<img src="https://img.shields.io/badge/chat-on%20Discord-brightgreen" alt="Discord chat"/>
</a>
<a href="https://stackshare.io/cypress">
<img src="https://img.stackshare.io/misc/follow-on-stackshare-badge.svg" alt="StackShare"/>
Expand Down
9 changes: 5 additions & 4 deletions cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
<!-- See the ../guides/writing-the-cypress-changelog.md for details on writing the changelog. -->
## 12.12.1
## 12.13.0

_Released 05/23/2023 (PENDING)_
_Released 05/23/2023_

**Features:**

- Add Git-related messages for the [Runs page](https://docs.cypress.io/guides/core-concepts/cypress-app#Runs) and [Debug page](https://docs.cypress.io/guides/cloud/runs#Debug) when users aren't using Git or there are no recorded runs for the current branch. Fixes [#26680](https://github.com/cypress-io/cypress/issues/26680).
- Adds Git-related messages for the [Runs page](https://docs.cypress.io/guides/core-concepts/cypress-app#Runs) and [Debug page](https://docs.cypress.io/guides/cloud/runs#Debug) when users aren't using Git or there are no recorded runs for the current branch. Fixes [#26680](https://github.com/cypress-io/cypress/issues/26680).

**Bugfixes:**

- Reverted [#26452](https://github.com/cypress-io/cypress/pull/26630) which introduced a bug that prevents users from using End to End with Yarn 3. Fixed in [#26735](https://github.com/cypress-io/cypress/pull/26735). Fixes [#26676](https://github.com/cypress-io/cypress/issues/26676).
- Reverted [#26452](https://github.com/cypress-io/cypress/pull/26452) which introduced a bug that prevents users from using End to End with Yarn 3. Fixed in [#26735](https://github.com/cypress-io/cypress/pull/26735). Fixes [#26676](https://github.com/cypress-io/cypress/issues/26676).
- Moved `types` condition to the front of `package.json#exports` since keys there are meant to be order-sensitive. Fixed in [#26630](https://github.com/cypress-io/cypress/pull/26630).
- Fixed an issue where newly-installed dependencies would not be detected during Component Testing setup. Addresses [#26685](https://github.com/cypress-io/cypress/issues/26685).
- Fixed a UI regression that was flashing an "empty" state inappropriately when loading the Debug page. Fixed in [#26761](https://github.com/cypress-io/cypress/pull/26761).
- Fixed an issue in Component Testing setup where TypeScript version 5 was not properly detected. Fixes [#26204](https://github.com/cypress-io/cypress/issues/26204).

**Misc:**

Expand Down
7 changes: 7 additions & 0 deletions npm/vite-plugin-cypress-esm/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# [@cypress/vite-plugin-cypress-esm-v1.0.1](https://github.com/cypress-io/cypress/compare/@cypress/vite-plugin-cypress-esm-v1.0.0...@cypress/vite-plugin-cypress-esm-v1.0.1) (2023-05-23)


### Bug Fixes

* Vite esm plugin issues ([#26714](https://github.com/cypress-io/cypress/issues/26714)) ([38b9526](https://github.com/cypress-io/cypress/commit/38b952622e034928df0d6e5d571e83c22d98ce86))

# @cypress/vite-plugin-cypress-esm-v1.0.0 (2023-05-04)


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cypress",
"version": "12.12.0",
"version": "12.13.0",
"description": "Cypress is a next generation front end testing tool built for the modern web",
"private": true,
"scripts": {
Expand Down
33 changes: 33 additions & 0 deletions packages/app/cypress/e2e/cypress-in-cypress.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,4 +395,37 @@ describe('Cypress in Cypress', { viewportWidth: 1500, defaultCommandTimeout: 100
expect(ctx.actions.project.initializeActiveProject).to.be.called
})
})

describe('runSpec mutation', () => {
it('should trigger expected spec from POST', () => {
startAtSpecsPage('e2e')

cy.contains('E2E specs').should('be.visible')

cy.withCtx(async (ctx) => {
const url = `http://127.0.0.1:${ctx.gqlServerPort}/__launchpad/graphql?`
const payload = `{"query":"mutation{\\nrunSpec(specPath:\\"cypress/e2e/dom-content.spec.js\\"){\\n__typename\\n... on RunSpecResponse{\\ntestingType\\nbrowser{\\nid\\nname\\n}\\nspec{\\nid\\nname\\n}\\n}\\n}\\n}","variables":null}`

ctx.coreData.app.browserStatus = 'open'

/*
Note: If this test starts failing, this fetch is the likely culprit.
Validate the GQL payload above is still valid by logging the fetch response JSON
*/

await ctx.util.fetch(
url,
{
method: 'POST',
headers: {
'content-type': 'application/json',
},
body: payload,
},
)
})

cy.contains('Dom Content').should('be.visible')
})
})
})
4 changes: 3 additions & 1 deletion packages/app/cypress/e2e/specs_list_e2e.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ describe('App: Spec List (E2E)', () => {
it('lists files after folders when in same directory', () => {
cy.findAllByTestId('row-directory-depth-2').first().click()

cy.get('[id="speclist-cypress/e2e/admin_users/"]')
const rowId = getPathForPlatform('speclist-cypress/e2e/admin_users/').replaceAll('\\', '\\\\')

cy.get(`[id="${rowId}"]`)
.next()
.should('contain', 'admin.user')
.next()
Expand Down
9 changes: 5 additions & 4 deletions packages/app/src/runner/event-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,6 @@ export class EventManager {
runnerUiStore.setAutomationStatus(connected)
})

this.ws.on('change:to:url', (url) => {
window.location.href = url
})

this.ws.on('update:telemetry:context', (contextString) => {
const context = JSON.parse(contextString)

Expand Down Expand Up @@ -815,7 +811,12 @@ export class EventManager {

stop () {
this.localBus.removeAllListeners()

// Grab existing listeners for url change event, we want to preserve them
const urlChangeListeners = this.ws.listeners('change:to:url')

this.ws.off()
urlChangeListeners.forEach((listener) => this.ws.on('change:to:url', listener))
}

async teardown (state: MobxRunnerStore, isRerun = false) {
Expand Down
4 changes: 4 additions & 0 deletions packages/app/src/runner/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ export function createWebsocket (config: Cypress.Config) {
ws.emit('runner:connected')
})

ws.on('change:to:url', (url) => {
window.location.href = url
})

return ws
}

Expand Down
2 changes: 2 additions & 0 deletions packages/config/src/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import _ from 'lodash'
import Debug from 'debug'
import {
defaultSpecPattern,
defaultExcludeSpecPattern,
options,
breakingOptions,
breakingRootOptions,
Expand All @@ -17,6 +18,7 @@ import * as validation from './validation'

export {
defaultSpecPattern,
defaultExcludeSpecPattern,
options,
breakingOptions,
BreakingOption,
Expand Down
7 changes: 6 additions & 1 deletion packages/config/src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ export const defaultSpecPattern = {
component: '**/*.cy.{js,jsx,ts,tsx}',
}

export const defaultExcludeSpecPattern = {
e2e: '*.hot-update.js',
component: ['**/__snapshots__/*', '**/__image_snapshots__/*'],
}

// NOTE:
// If you add/remove/change a config value, make sure to update the following
// - cli/types/index.d.ts (including allowed config options on TestOptions)
Expand Down Expand Up @@ -271,7 +276,7 @@ const driverConfigOptions: Array<DriverConfigOption> = [
requireRestartOnChange: 'server',
}, {
name: 'excludeSpecPattern',
defaultValue: (options: Record<string, any> = {}) => options.testingType === 'component' ? ['**/__snapshots__/*', '**/__image_snapshots__/*'] : '*.hot-update.js',
defaultValue: (options: Record<string, any> = {}) => options.testingType === 'component' ? defaultExcludeSpecPattern.component : defaultExcludeSpecPattern.e2e,
validation: validate.isStringOrArrayOfStrings,
overrideLevel: 'any',
}, {
Expand Down
17 changes: 16 additions & 1 deletion packages/data-context/src/actions/ElectronActions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { App, BrowserWindow, OpenDialogOptions, OpenDialogReturnValue, SaveDialogOptions, SaveDialogReturnValue } from 'electron'
import type { App, BrowserWindow, OpenDialogOptions, OpenDialogReturnValue, SaveDialogOptions, SaveDialogReturnValue, Notification } from 'electron'
import os from 'os'
import type { DataContext } from '..'
import _ from 'lodash'
Expand All @@ -13,6 +13,7 @@ export interface ElectronApiShape {
copyTextToClipboard(text: string): void
isMainWindowFocused(): boolean
focusMainWindow(): void
createNotification(title: string, body: string): Notification
}

export class ElectronActions {
Expand Down Expand Up @@ -104,4 +105,18 @@ export class ElectronActions {
return obj.filePath || null
})
}

showSystemNotification (title: string, body: string, onClick?: () => void) {
const notification = this.ctx.electronApi.createNotification(title, body)

const defaultOnClick = async () => {
await this.ctx.actions.browser.focusActiveBrowserWindow()
}

const clickHandler = onClick || defaultOnClick

notification.on('click', clickHandler)

notification.show()
}
}
Loading

0 comments on commit 0b744ad

Please sign in to comment.