Skip to content

Commit

Permalink
Merge branch 'develop' into tgriesser/unify/merge-with-develop-09-08
Browse files Browse the repository at this point in the history
* develop: (31 commits)
  fix: `everyNthFrame` should only be applied for Chrome 89+ (#18392)
  docs: General updates to contributing guide (#18283)
  chore: Update Chrome (beta) to 95.0.4638.40 (#18389)
  chore: use circleci timings split for e2e tests (#18367)
  fix: fixed title (#18370)
  chore(deps): update dependency electron to v14 🌟 (#18384)
  chore(server): share client route (#18215)
  fix: Prevent Cypress from crashing when argument parsing "spec: {}" (#18312)
  chore: update husky dev dependency to v7 (#18345)
  feat: add defineConfig function to help type config (#18302)
  chore: Update Chrome (stable) to 94.0.4606.71 (#18324)
  feat: allow to use TypeScript in the config file (#18300)
  allow select to be called with empty array (#18329)
  fix(vite-dev-server): windows `supportFile` + preserve optimize entries (#18286)
  chore: fix semantic-release dry run (#18332)
  fix(driver): improve status_code_flags_invalid error message (#18316)
  chore(deps): update dependency electron to v13.5.0 🌟 (#18318)
  chore: Update Chrome (stable) to 94.0.4606.61 and Chrome (beta) to 95.0.4638.32 (#18229)
  fix(proxy-logging): use constant consoleProps object (#18207)
  feat(driver): Add "overwrite" option to cy.screenshot() (#18280)
  ...
  • Loading branch information
tgriesser committed Oct 8, 2021
2 parents 837977f + 9265669 commit 6399c98
Show file tree
Hide file tree
Showing 166 changed files with 108 additions and 78 deletions.
120 changes: 63 additions & 57 deletions CONTRIBUTING.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browser-versions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"chrome:beta": "95.0.4638.32",
"chrome:beta": "95.0.4638.40",
"chrome:stable": "94.0.4606.71"
}
18 changes: 14 additions & 4 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,20 @@ commands:
steps:
- restore_cached_workspace
- run:
command: yarn workspace @packages/server test ./test/e2e/$(( $CIRCLE_NODE_INDEX ))_*spec* --browser <<parameters.browser>>
command: |
ALL_SPECS=`circleci tests glob "/root/cypress/packages/server/test/e2e/*spec*"`
SPECS=
for file in $ALL_SPECS; do
# filter out non_root tests, they have their own stage
if [[ "$file" == *"non_root"* ]]; then
echo "Skipping $file"
continue
fi
SPECS="$SPECS $file"
done
SPECS=`echo $SPECS | xargs -n 1 | circleci tests split --split-by=timings`
echo SPECS=$SPECS
yarn workspace @packages/server test $SPECS --browser <<parameters.browser>>
- verify-mocha-results
- store_test_results:
path: /tmp/cypress
Expand Down Expand Up @@ -1038,9 +1051,6 @@ jobs:
- run: yarn test
# run type checking for each individual package
- run: yarn lerna run types
# check for compile errors with the releaserc scripts
- run: yarn test-npm-package-release-script

- verify-mocha-results:
expectedResultCount: 9
- store_test_results:
Expand Down
2 changes: 1 addition & 1 deletion cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ yarn test-watch --scope cypress
yarn test-debug --scope cypress
```

### Updating snaphots
### Updating snapshots

Prepend `SNAPSHOT_UPDATE=1` to any test command. See [`snap-shot-it` instructions](https://github.com/bahmutov/snap-shot-it#advanced-use) for more info.

Expand Down
6 changes: 3 additions & 3 deletions packages/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ yarn test-integration cli_spec ## shorthand, uses globbing to find spec
yarn test <path/to/test>
yarn test test/e2e/1_async_timeouts_spec.js
## or
yarn test-e2e 1_async ## shorthand, uses globbing to find spec
yarn test-e2e async_timeouts ## shorthand, uses globbing to find spec
```

To keep the browser open after a spec run (for easier debugging and iterating on specs), you can pass the `--no-exit` flag to the e2e test command. Live reloading due to spec changes should also work:
```sh
yarn test test/e2e/2_go_spec.js --browser chrome --no-exit
yarn test test/e2e/go_spec.js --browser chrome --no-exit
```

### Updating snaphots
Expand All @@ -88,5 +88,5 @@ Prepend `SNAPSHOT_UPDATE=1` to any test command. See [`snap-shot-it` instruction
```bash
SNAPSHOT_UPDATE=1 yarn test test/unit/api_spec.js
SNAPSHOT_UPDATE=1 yarn test test/integration/cli_spec.js
SNAPSHOT_UPDATE=1 yarn test-e2e 1_async
SNAPSHOT_UPDATE=1 yarn test-e2e async_timeout
```
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 5 additions & 3 deletions packages/server/lib/browsers/cdp_automation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ export type CyCookie = Pick<chrome.cookies.Cookie, 'name' | 'value' | 'expiratio
// https://developer.chrome.com/extensions/cookies#method-getAll
type CyCookieFilter = chrome.cookies.GetAllDetails

export const screencastOpts: Protocol.Page.StartScreencastRequest = {
format: 'jpeg',
everyNthFrame: Number(process.env.CYPRESS_EVERY_NTH_FRAME || 5),
export function screencastOpts (everyNthFrame = Number(process.env.CYPRESS_EVERY_NTH_FRAME || 5)): Protocol.Page.StartScreencastRequest {
return {
format: 'jpeg',
everyNthFrame,
}
}

function convertSameSiteExtensionToCdp (str: CyCookie['sameSite']): Protocol.Network.CookieSameSite | undefined {
Expand Down
7 changes: 4 additions & 3 deletions packages/server/lib/browsers/chrome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const debug = debugModule('cypress:server:browsers:chrome')
const LOAD_EXTENSION = '--load-extension='
const CHROME_VERSIONS_WITH_BUGGY_ROOT_LAYER_SCROLLING = '66 67'.split(' ')
const CHROME_VERSION_INTRODUCING_PROXY_BYPASS_ON_LOOPBACK = 72
const CHROME_VERSION_WITH_FPS_INCREASE = 89

const CHROME_PREFERENCE_PATHS = {
default: path.join('Default', 'Preferences'),
Expand Down Expand Up @@ -260,7 +261,7 @@ const _connectToChromeRemoteInterface = function (port, onError, browserDisplayN
})
}

const _maybeRecordVideo = async function (client, options) {
const _maybeRecordVideo = async function (client, options, browserMajorVersion) {
if (!options.onScreencastFrame) {
debug('options.onScreencastFrame is false')

Expand All @@ -273,7 +274,7 @@ const _maybeRecordVideo = async function (client, options) {
client.send('Page.screencastFrameAck', { sessionId: meta.sessionId })
})

await client.send('Page.startScreencast', screencastOpts)
await client.send('Page.startScreencast', browserMajorVersion >= CHROME_VERSION_WITH_FPS_INCREASE ? screencastOpts() : screencastOpts(1))

return client
}
Expand Down Expand Up @@ -528,7 +529,7 @@ export = {
await originalBrowserKill.apply(launchedBrowser, args)
}

await this._maybeRecordVideo(criClient, options)
await this._maybeRecordVideo(criClient, options, browser.majorVersion)
await this._navigateUsingCRI(criClient, url)
await this._handleDownloads(criClient, options.downloadsFolder, automation)

Expand Down
2 changes: 1 addition & 1 deletion packages/server/lib/project-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ export class ProjectBase<TServer extends Server> extends EE {
projectRoot,
}: {
projectRoot: string
configFile?: string | boolean
configFile?: string | false
onSettingsChanged?: false | (() => void)
}) {
// bail if we havent been told to
Expand Down
2 changes: 1 addition & 1 deletion packages/server/lib/util/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const debug = Debug('cypress:server:settings')

interface SettingsOptions {
testingType?: 'component' |'e2e'
configFile?: string | boolean
configFile?: string | false
args?: {
runProject?: string
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ describe('e2e config', () => {
})
})

it('supports custom configFile in a default TypeScript file', function () {
return e2e.exec(this, {
project: Fixtures.projectPath('config-with-ts'),
})
})

it('throws error when multiple default config file are found in project', function () {
const projectRoot = Fixtures.projectPath('pristine')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ foo\
const haveRoot = !process.env.USE_HIGH_PORTS && (process.geteuid() === 0)

if (!haveRoot) {
console.warn('(e2e tests warning) You are not running as root; therefore, 2_cookies_spec cannot cover the case where the default (80/443) HTTP(s) port is used. Alternate ports (2121/2323) will be used instead.')
console.warn('(e2e tests warning) You are not running as root; therefore, cookies_spec cannot cover the case where the default (80/443) HTTP(s) port is used. Alternate ports (2121/2323) will be used instead.')
}

let httpPort = 2121
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// TODO: rename this file to 5_module_api_spec
// TODO: rename this file to module_api_spec

const path = require('path')
const _ = require('lodash')
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/types/src/browser.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const BROWSER_FAMILY = ['chromium', 'firefox'] as const

type BrowserName = 'electron' | 'chrome' | 'chromium' | 'firefox' | string
export type BrowserName = 'electron' | 'chrome' | 'chromium' | 'firefox' | string

export type BrowserChannel = 'stable' | 'canary' | 'beta' | 'dev' | 'nightly' | string

Expand Down
7 changes: 6 additions & 1 deletion packages/types/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ export interface LaunchArgs {
// Global mode is triggered by CLI via `--global` or when there is no `projectRoot` (essentially when the Cypress Config file can't be found)
global: boolean
project: string // projectRoot
/**
* in run mode, the path of the project run
* path is relative if specified with --project,
* absolute if implied by current working directory
*/
runProject?: string
projectRoot: string // same as above
testingType: Cypress.TestingType
Expand All @@ -45,7 +50,7 @@ type WebSocketOptionsCallback = (...args: any[]) => any
export interface OpenProjectLaunchOptions {
args?: LaunchArgs

configFile?: string | boolean
configFile?: string | false
browsers?: Cypress.Browser[]

// Callback to reload the Desktop GUI when cypress.json is changed.
Expand Down

0 comments on commit 6399c98

Please sign in to comment.