-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14940 from cypress-io/feat/resizeable-specs-list
feat(component-testing): Make specs-list resizeable
- Loading branch information
Showing
15 changed files
with
353 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"plugins": [ | ||
"cypress", | ||
"@cypress/dev" | ||
], | ||
"extends": [ | ||
"plugin:@cypress/dev/general", | ||
"plugin:@cypress/dev/tests", | ||
"plugin:@cypress/dev/react" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"env": { | ||
"cypress/globals": true | ||
}, | ||
"rules": { | ||
"react/jsx-filename-extension": [ | ||
"warn", | ||
{ | ||
"extensions": [ | ||
".js", | ||
".jsx", | ||
".tsx" | ||
] | ||
} | ||
] | ||
}, | ||
"overrides": [ | ||
{ | ||
"files": [ | ||
"lib/*" | ||
], | ||
"rules": { | ||
"no-console": 1 | ||
} | ||
}, | ||
{ | ||
"files": [ | ||
"**/*.json" | ||
], | ||
"rules": { | ||
"quotes": "off", | ||
"comma-dangle": "off" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/// <reference types="@percy/cypress" /> | ||
import React from 'react' | ||
import { mount } from '@cypress/react' | ||
import App from '../../src/app/app' | ||
import State from '../../src/lib/state' | ||
import '@packages/runner/src/main.scss' | ||
|
||
class FakeEventManager { | ||
start = () => { } | ||
on = () => { } | ||
stop = () => {} | ||
notifyRunningSpec = () => { } | ||
} | ||
|
||
describe('App', () => { | ||
it('renders App', () => { | ||
cy.viewport(1000, 500) | ||
const state = new State({ | ||
reporterWidth: 500, | ||
spec: null, | ||
specs: [{ relative: '/test.js', absolute: 'root/test.js', name: 'test.js' }], | ||
}) | ||
|
||
mount( | ||
<App | ||
state={state} | ||
// @ts-ignore - this is difficult to stub. Real one breaks things. | ||
eventManager={new FakeEventManager()} | ||
config={{ projectName: 'Project', env: {} }} | ||
/>, | ||
) | ||
|
||
cy.percySnapshot() | ||
}) | ||
|
||
context('specs-list resizing', () => { | ||
beforeEach(() => { | ||
cy.viewport(1000, 500) | ||
const state = new State({ | ||
reporterWidth: 500, | ||
spec: null, | ||
specs: [{ relative: '/test.js', absolute: 'root/test.js', name: 'test.js' }], | ||
}) | ||
|
||
mount( | ||
<App | ||
state={state} | ||
// @ts-ignore - this is difficult to stub. Real one breaks things. | ||
eventManager={new FakeEventManager()} | ||
config={{ projectName: 'Project', env: {} }} | ||
/>, | ||
) | ||
}) | ||
|
||
it('closes the spec list when selecting a spec', () => { | ||
cy.get('[data-cy=specs-list-resize-box').should('have.css', 'width', '300px') | ||
|
||
cy.get('[data-cy=resizer]').trigger('mousedown', 'center') | ||
cy.get('[data-cy=resizer]').trigger('mousemove', 'center', { | ||
clientX: 450, | ||
}) | ||
|
||
cy.get('[data-cy=resizer]').trigger('mouseup', 'center') | ||
|
||
cy.get('[data-cy=specs-list-resize-box').should('have.css', 'width', '425px') | ||
}) | ||
|
||
it('restore specs list width after closing and reopen', () => { | ||
cy.get('[data-cy=resizer]').trigger('mousedown', 'center') | ||
cy.get('[data-cy=resizer]').trigger('mousemove', 'center', { | ||
clientX: 500, | ||
}) | ||
|
||
cy.get('[data-cy=resizer]').trigger('mouseup', 'center') | ||
cy.get('[data-cy=specs-list-resize-box').should('have.css', 'width', '475px') | ||
|
||
cy.get('[aria-label="Open the menu"').click() | ||
cy.get('[data-cy=specs-list]').then(([el]) => { | ||
// for some reason should("not.be.visible") doesn't work here so ensure that specs list was outside of screen | ||
expect(el.getBoundingClientRect().x).to.be.lessThan(0) | ||
}) | ||
|
||
cy.get('[aria-label="Open the menu"').click() | ||
|
||
cy.get('[data-cy=specs-list-resize-box').should('have.css', 'width', '475px') | ||
}) | ||
}) | ||
}) |
1 change: 0 additions & 1 deletion
1
packages/runner-ct/cypress/component/SpecList/SpecList.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
e71af5a
There was a problem hiding this comment.
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:
e71af5a
There was a problem hiding this comment.
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:
e71af5a
There was a problem hiding this comment.
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:
e71af5a
There was a problem hiding this comment.
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: