Skip to content

Commit

Permalink
chore(runner,runner-ct): reduce duplication with packages/runner-shar…
Browse files Browse the repository at this point in the history
…ed (#16866)

* move snapshot-controls to shared package

* share visit-failure component

* share blank-contents

* share message component

* move message styling to shared

* stub scss in unit tests

* remove whitespace

* make dup files match

* share selector playground

* share script error

* share automation-disconnected

* remove old file

* share no-automation

* share error messages

* share errors

* make iframe model files similar

* share iframe-model

* share selector playground

* share style

* share highlight in selector playground

* share dom file

* update import

* share aut-iframe

* wip: shared event manager

* remove CT event manager

* move studio to shared runner package

* fix tests

* use shared event manager in CT runner

* comment back in code

* rename viewporth width/height to width/height

* fix ts errors

* share viewport info

* share header

* revert changed test

* remove old code

* fix tests and move test to shared package

* move tests to shared package

* make container files similar

* share container in runner

* share container

* move test

* move spec

* update tsconfig]

* update headeR

* fix styling

* style

* refactor

* refactor

* reduce public modules

* Update packages/runner-shared/src/event-manager.js

Co-authored-by: Zach Bloomquist <github@chary.us>

* fix percy regression

* fix regression in style

* improve types, try reverting style

* add runner-shared tests to pipeline

Co-authored-by: Zach Bloomquist <github@chary.us>
Co-authored-by: Barthélémy Ledoux <bart@cypress.io>
  • Loading branch information
3 people authored Jun 16, 2021
1 parent 3029f01 commit 929cac8
Show file tree
Hide file tree
Showing 98 changed files with 1,072 additions and 3,196 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"stop-only": "npx stop-only --skip .cy,.publish,.projects,node_modules,dist,dist-test,fixtures,lib,bower_components,src,__snapshots__ --exclude e2e.ts,cypress-tests.ts,unwritten.spec.ts",
"stop-only-all": "yarn stop-only --folder packages",
"pretest": "yarn ensure-deps",
"test": "yarn lerna exec yarn test --scope cypress --scope \"'@packages/{electron,extension,https-proxy,launcher,net-stubbing,network,proxy,rewriter,runner,socket}'\"",
"test": "yarn lerna exec yarn test --scope cypress --scope \"'@packages/{electron,extension,https-proxy,launcher,net-stubbing,network,proxy,rewriter,runner,runner-shared,socket}'\"",
"test-debug": "lerna exec yarn test-debug --ignore \"'@packages/{desktop-gui,driver,root,static,web-config}'\"",
"pretest-e2e": "yarn ensure-deps",
"test-e2e": "lerna exec yarn test-e2e --ignore \"'@packages/{desktop-gui,driver,root,static,web-config}'\"",
Expand Down
3 changes: 2 additions & 1 deletion packages/driver/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
/// <reference path="../ts/index.d.ts" />
export const $Cypress: Cypress.Cypress

export default $Cypress
export const $: typeof JQuery
export default $Cypress
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react'
import { mount } from '@cypress/react'
import RunnerCt from '../../src/app/RunnerCt'
import '@packages/runner/src/main.scss'
import eventManager from '../../src/lib/event-manager'
import { eventManager } from '@packages/runner-shared'
import { testSpecFile } from '../fixtures/testSpecFile'
import { makeState, fakeConfig, getPort } from './utils'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react'
import { mount } from '@cypress/react'
import RunnerCt from '../../src/app/RunnerCt'
import '@packages/runner/src/main.scss'
import eventManager from '../../src/lib/event-manager'
import { eventManager } from '@packages/runner-shared'
import { testSpecFile } from '../fixtures/testSpecFile'
import { makeState, fakeConfig, getPort } from './utils'

Expand Down
2 changes: 1 addition & 1 deletion packages/runner-ct/cypress/component/ScriptError.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import React from 'react'
import { mount } from '@cypress/react'
import ScriptError from '../../src/errors/script-error'
import { ScriptError } from '@packages/runner-shared'

describe('ScriptError', () => {
it('renders an error', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/runner-ct/src/app/Plugins.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'

import State from '../lib/state'
import { Hidden } from '../lib/Hidden'
import { namedObserver } from '../lib/mobx'
import { namedObserver } from '@packages/runner-shared'
import { PLUGIN_BAR_HEIGHT } from './RunnerCt'

import styles from './RunnerCt.module.scss'
Expand Down
9 changes: 5 additions & 4 deletions packages/runner-ct/src/app/ReporterContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ import cs from 'classnames'
import { ReporterHeaderProps } from '@packages/reporter/src/header/header'
import { Reporter } from '@packages/reporter/src/main'

import errorMessages from '../errors/error-messages'
import EventManager from '../lib/event-manager'
import { errorMessages, namedObserver, eventManager as EventManager } from '@packages/runner-shared'
import State from '../lib/state'
import { namedObserver } from '../lib/mobx'
import { ReporterHeader } from './ReporterHeader'
import { NoSpec } from './NoSpec'

Expand All @@ -15,7 +13,10 @@ import styles from './RunnerCt.module.scss'
interface ReporterContainerProps {
state: State
eventManager: typeof EventManager
config: Cypress.RuntimeConfigOptions
config: {
configFile: string
[key: string]: unknown
}
}

export const ReporterContainer = namedObserver('ReporterContainer',
Expand Down
2 changes: 1 addition & 1 deletion packages/runner-ct/src/app/ReporterHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ReporterHeaderProps } from '@packages/reporter/src/header/header'
import Stats from '@packages/reporter/src/header/stats'
import Controls from '@packages/reporter/src/header/controls'
import { StatsStore } from '@packages/reporter/src/header/stats-store'
import { namedObserver } from '../lib/mobx'
import { namedObserver } from '@packages/runner-shared'
import styles from './ReporterHeader.module.scss'

export const EmptyReporterHeader: React.FC = () => {
Expand Down
3 changes: 1 addition & 2 deletions packages/runner-ct/src/app/RunnerCt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ library.add(fas)
library.add(fab)

import State from '../lib/state'
import EventManager from '../lib/event-manager'
import { eventManager as EventManager, namedObserver } from '@packages/runner-shared'
import { useGlobalHotKey } from '../lib/useHotKey'
import { animationFrameDebounce } from '../lib/debounce'
import { LeftNavMenu } from './LeftNavMenu'
import { SpecContent } from './SpecContent'
import { hideIfScreenshotting, hideSpecsListIfNecessary } from '../lib/hideGuard'
import { namedObserver } from '../lib/mobx'
import { SpecList } from './SpecList/SpecList'
import { NoSpec } from './NoSpec'

Expand Down
26 changes: 19 additions & 7 deletions packages/runner-ct/src/app/SpecContent.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import cs from 'classnames'
import * as React from 'react'
import SplitPane from 'react-split-pane'
import { Message, namedObserver, eventManager as EventManager, Header } from '@packages/runner-shared'

import Header from '../header/header'
import { Iframes } from '../iframe/iframes'
import { animationFrameDebounce } from '../lib/debounce'
import { Message } from '../message/message'
import { KeyboardHelper } from './KeyboardHelper'
import { NoSpec } from './NoSpec'
import { Plugins } from './Plugins'
import { ReporterContainer } from './ReporterContainer'
import { PLUGIN_BAR_HEIGHT } from './RunnerCt'
import State from '../lib/state'
import EventManager from '../lib/event-manager'
import { hideIfScreenshotting, hideReporterIfNecessary } from '../lib/hideGuard'

import styles from './RunnerCt.module.scss'
import { namedObserver } from '../lib/mobx'

interface SpecContentProps {
state: State
eventManager: typeof EventManager
config: Cypress.RuntimeConfigOptions
config: {
configFile: string
[key: string]: unknown
}
}

interface SpecContentWrapperProps {
Expand Down Expand Up @@ -62,15 +62,27 @@ export const SpecContent = namedObserver('SpecContent', (props: SpecContentProps
},
)}
>
<Header {...props} />
<Header {...props} runner='ct' />
{props.state.spec
? <Iframes {...props} />
: (
<NoSpec>
<KeyboardHelper />
</NoSpec>
)}
<Message state={props.state} />
<Message
state={{
messageTitle: props.state.messageTitle,
messageControls: props.state.messageControls,
messageDescription: props.state.messageDescription,
messageType: props.state.messageType,
messageStyles: {
state: props.state.messageStyles.state,
styles: props.state.messageStyles.styles,
messageType: props.state.messageType,
},
}}
/>
</div>
<Plugins
key="plugins"
Expand Down
2 changes: 1 addition & 1 deletion packages/runner-ct/src/app/useScreenshotHandler.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react'
import { runInAction } from 'mobx'
import EventManager from '../lib/event-manager'
import { eventManager as EventManager } from '@packages/runner-shared'
import State from '../lib/state'

/**
Expand Down
24 changes: 0 additions & 24 deletions packages/runner-ct/src/errors/error-messages.js

This file was deleted.

111 changes: 0 additions & 111 deletions packages/runner-ct/src/header/header.tsx

This file was deleted.

Loading

4 comments on commit 929cac8

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 929cac8 Jun 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/7.5.1/circle-develop-929cac807a93e045c7d0f18926f8b5a65ca083db/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 929cac8 Jun 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppVeyor has built the win32 x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/7.5.1/appveyor-develop-929cac807a93e045c7d0f18926f8b5a65ca083db/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 929cac8 Jun 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppVeyor has built the win32 ia32 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/7.5.1/appveyor-develop-929cac807a93e045c7d0f18926f8b5a65ca083db/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 929cac8 Jun 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/7.5.1/circle-develop-929cac807a93e045c7d0f18926f8b5a65ca083db/cypress.tgz

Please sign in to comment.