Skip to content

Commit 08aa9bf

Browse files
authored
Merge branch 'develop' into marktnoonan/percy-content-flake
2 parents e11b73b + 8f2855a commit 08aa9bf

21 files changed

+163
-144
lines changed

packages/app/cypress/e2e/subscriptions/specChange-subscription.cy.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,10 @@ e2e: {
230230

231231
it('handles removing the last file', () => {
232232
cy.contains('dom-content.spec').click()
233+
cy.get('button[aria-controls="reporter-inline-specs-list"]').click({ force: true })
234+
cy.get('[data-cy=specs-list-panel]').should('be.visible')
233235
cy.waitForSpecToFinish()
234236
cy.get('[data-model-state="passed"]').should('contain', 'renders the test content')
235-
236237
cy.withCtx(async (ctx, o) => {
237238
await Promise.all(o.paths.map((path) => ctx.actions.file.removeFileInProject(path)))
238239
}, {

packages/reporter/cypress/e2e/agents.cy.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ describe('agents', () => {
3636
}
3737
})
3838

39-
it('does not display agents if there are no agents', () => {
39+
it('does not render agents if there are no agents', () => {
4040
// @ts-ignore
4141
runnables.tests[0].agents = []
4242
start()
4343

44-
cy.contains('Spies / Stubs').should('not.be.visible')
44+
cy.contains('Spies / Stubs').should('not.exist')
4545
})
4646

4747
describe('when there are agents', () => {
@@ -52,7 +52,7 @@ describe('agents', () => {
5252

5353
it('collapses agents by default', () => {
5454
start()
55-
cy.get('.runnable-agents-region .instrument-content').should('not.be.visible')
55+
cy.get('.runnable-agents-region .instrument-content').should('not.exist')
5656
})
5757

5858
it('shows agents after expanding', () => {

packages/reporter/cypress/e2e/hooks.cy.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ describe('hooks', () => {
7272
.should('be.visible')
7373
})
7474

75-
it('does not display (failed) next to name for passed hooks', () => {
75+
it('does not render (failed) next to name for passed hooks', () => {
7676
cy.contains('test 1').closest('.runnable').contains('before each')
7777
.find('.hook-failed-message')
78-
.should('not.be.visible')
78+
.should('not.exist')
7979
})
8080

8181
describe('expanding/collapsing', () => {

packages/reporter/cypress/e2e/routes.cy.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ describe('routes', () => {
3636
}
3737
})
3838

39-
it('does not display if there are no routes', () => {
39+
it('does not render if there are no routes', () => {
4040
runnables.tests![0].routes = []
4141
start()
42-
cy.get('.runnable-routes-region').should('not.be.visible')
42+
cy.get('.runnable-routes-region').should('not.exist')
4343
})
4444

4545
describe('when there are routes', () => {

packages/reporter/cypress/e2e/runnables.cy.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ describe('runnables', () => {
3131
relative: 'foo/bar',
3232
},
3333
},
34-
experimentalStudioEnabled: true,
3534
}, renderProps))
3635
})
3736
}
@@ -146,7 +145,7 @@ describe('runnables', () => {
146145
cy.contains('No tests found.').should('be.visible')
147146
cy.contains('Cypress could not detect tests in this file.').should('be.visible')
148147
cy.contains('Open file in IDE').should('be.visible')
149-
cy.contains('Create test with Cypress Studio').should('be.visible')
148+
cy.contains('Create test with Cypress Studio').should('not.exist')
150149
cy.get('.help-link').should('have.attr', 'href', 'https://on.cypress.io/intro')
151150
cy.get('.help-link').should('have.attr', 'target', '_blank')
152151
cy.percySnapshot()
@@ -171,7 +170,8 @@ describe('runnables', () => {
171170
cy.get('.help-link').should('have.attr', 'target', '_blank')
172171
})
173172

174-
it('can launch studio', () => {
173+
// FIXME: When studio support is re-introduced we can enable these tests.
174+
it.skip('can launch studio', () => {
175175
start().then(() => {
176176
cy.stub(runner, 'emit')
177177

packages/reporter/cypress/e2e/suites.cy.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ describe('suites', () => {
2222
absolute: '/absolute/path/to/foo.js',
2323
},
2424
},
25-
experimentalStudioEnabled: true,
2625
})
2726
})
2827

@@ -76,8 +75,8 @@ describe('suites', () => {
7675

7776
cy.get('@suiteWrapper')
7877
.should('not.have.class', 'is-open')
79-
.find('.collapsible-content').eq(0)
80-
.should('not.be.visible')
78+
.find('.collapsible-content')
79+
.should('not.exist')
8180

8281
cy.contains('suite 1')
8382
.click()
@@ -95,8 +94,8 @@ describe('suites', () => {
9594

9695
cy.get('@suiteWrapper')
9796
.should('not.have.class', 'is-open')
98-
.find('.collapsible-content').eq(0)
99-
.should('not.be.visible')
97+
.find('.collapsible-content')
98+
.should('not.exist')
10099

101100
cy.contains('suite 1')
102101
.parents('.collapsible-header')
@@ -115,8 +114,8 @@ describe('suites', () => {
115114

116115
cy.get('@suiteWrapper')
117116
.should('not.have.class', 'is-open')
118-
.find('.collapsible-content').eq(0)
119-
.should('not.be.visible')
117+
.find('.collapsible-content')
118+
.should('not.exist')
120119

121120
cy.contains('suite 1')
122121
.parents('.collapsible-header')
@@ -130,7 +129,8 @@ describe('suites', () => {
130129
})
131130
})
132131

133-
describe('studio button', () => {
132+
// FIXME: When studio support is re-introduced we can enable these tests.
133+
describe.skip('studio button', () => {
134134
it('displays studio icon with half transparency when hovering over test title', () => {
135135
cy.contains('nested suite 1')
136136
.closest('.runnable-wrapper')

packages/reporter/cypress/e2e/test_errors.cy.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ describe('test errors', () => {
6969

7070
it('does not expand or collapse stack trace when clicking', () => {
7171
cy.get('.runnable-err-print').click()
72-
cy.get('.runnable-err-stack-trace').should('not.be.visible')
72+
cy.get('.runnable-err-stack-trace').should('not.exist')
7373
cy.contains('View stack trace').click()
7474
cy.get('.runnable-err-stack-trace').should('be.visible')
7575
cy.get('.runnable-err-print').click()
@@ -82,8 +82,8 @@ describe('test errors', () => {
8282
setError(commandErr)
8383
})
8484

85-
it('hides stack trace by default', () => {
86-
cy.get('.runnable-err-stack-trace').should('not.be.visible')
85+
it('does not render stack trace by default', () => {
86+
cy.get('.runnable-err-stack-trace').should('not.exist')
8787
})
8888

8989
it('opens stack trace on click', () => {

packages/reporter/cypress/e2e/tests.cy.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ describe('tests', () => {
3333
absolute: '/absolute/path/to/foo.js',
3434
},
3535
},
36-
experimentalStudioEnabled: true,
3736
})
3837
})
3938

@@ -70,7 +69,7 @@ describe('tests', () => {
7069
.parents('.collapsible').first()
7170
.should('not.have.class', 'is-open')
7271
.find('.collapsible-content')
73-
.should('not.be.visible')
72+
.should('not.exist')
7473
})
7574

7675
it('failed tests expands automatically', () => {
@@ -94,7 +93,7 @@ describe('tests', () => {
9493

9594
cy.get('@testWrapper')
9695
.should('not.have.class', 'is-open')
97-
.find('.collapsible-content').should('not.be.visible')
96+
.find('.collapsible-content').should('not.exist')
9897
})
9998

10099
it('expands/collapses on enter', () => {
@@ -112,7 +111,7 @@ describe('tests', () => {
112111

113112
cy.get('@testWrapper')
114113
.should('not.have.class', 'is-open')
115-
.find('.collapsible-content').should('not.be.visible')
114+
.find('.collapsible-content').should('not.exist')
116115
})
117116

118117
it('expands/collapses on space', () => {
@@ -130,7 +129,7 @@ describe('tests', () => {
130129

131130
cy.get('@testWrapper')
132131
.should('not.have.class', 'is-open')
133-
.find('.collapsible-content').should('not.be.visible')
132+
.find('.collapsible-content').should('not.exist')
134133
})
135134
})
136135

packages/reporter/src/agents/agents.tsx

+32-31
Original file line numberDiff line numberDiff line change
@@ -34,37 +34,38 @@ const AgentsList = observer(({ model }: AgentsProps) => (
3434
</tbody>
3535
))
3636

37-
const Agents = observer(({ model }: AgentsProps) => (
38-
<div
39-
className={cs('runnable-agents-region', {
40-
'no-agents': !model.agents.length,
41-
})}
42-
>
43-
<div className='instruments-container'>
44-
<ul className='hooks-container'>
45-
<li className='hook-item'>
46-
<Collapsible
47-
header={`Spies / Stubs (${model.agents.length})`}
48-
headerClass='hook-header'
49-
contentClass='instrument-content'
50-
>
51-
<table>
52-
<thead>
53-
<tr>
54-
<th>Type</th>{/* the spy/stub's name provided by the driver */}
55-
<th>Function</th>
56-
<th>Alias(es)</th>
57-
<th className='call-count'># Calls</th>
58-
</tr>
59-
</thead>
60-
<AgentsList model={model} />
61-
</table>
62-
</Collapsible>
63-
</li>
64-
</ul>
65-
</div>
66-
</div>
67-
))
37+
const Agents = observer(({ model }: AgentsProps) => {
38+
if (!model.agents.length) {
39+
return null
40+
}
41+
42+
return (
43+
<div className='runnable-agents-region'>
44+
<div className='instruments-container'>
45+
<ul className='hooks-container'>
46+
<li className='hook-item'>
47+
<Collapsible
48+
header={`Spies / Stubs (${model.agents.length})`}
49+
headerClass='hook-header'
50+
contentClass='instrument-content'
51+
>
52+
<table>
53+
<thead>
54+
<tr>
55+
<th>Type</th>{/* the spy/stub's name provided by the driver */}
56+
<th>Function</th>
57+
<th>Alias(es)</th>
58+
<th className='call-count'># Calls</th>
59+
</tr>
60+
</thead>
61+
<AgentsList model={model} />
62+
</table>
63+
</Collapsible>
64+
</li>
65+
</ul>
66+
</div>
67+
</div>)
68+
})
6869

6970
export { Agent, AgentsList }
7071

packages/reporter/src/collapsible/collapsible.scss

-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
11
.reporter {
2-
.collapsible-content {
3-
display: none;
4-
}
5-
6-
.is-open > .collapsible-content {
7-
display: block;
8-
}
9-
102
.collapsible-indicator {
113
margin-right: 8px;
124
transform: rotate(-90deg);

packages/reporter/src/collapsible/collapsible.tsx

+8-4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ interface Props {
1313
headerExtras?: ReactNode
1414
containerRef?: RefObject<HTMLDivElement>
1515
contentClass?: string
16+
hideExpander: boolean
1617
}
1718

1819
interface State {
@@ -25,6 +26,7 @@ class Collapsible extends Component<Props, State> {
2526
headerClass: '',
2627
headerStyle: {},
2728
contentClass: '',
29+
hideExpander: false,
2830
}
2931

3032
constructor (props: Props) {
@@ -56,17 +58,19 @@ class Collapsible extends Component<Props, State> {
5658
style={this.props.headerStyle}
5759
tabIndex={-1}
5860
>
59-
<ChevronIcon className='collapsible-indicator' />
61+
{!this.props.hideExpander && <ChevronIcon className='collapsible-indicator' />}
6062
<span className='collapsible-header-text'>
6163
{this.props.header}
6264
</span>
6365
</div>
6466
</div>
6567
{this.props.headerExtras}
6668
</div>
67-
<div className={cs('collapsible-content', this.props.contentClass)}>
68-
{this.state.isOpen && this.props.children}
69-
</div>
69+
{this.state.isOpen && (
70+
<div className={cs('collapsible-content', this.props.contentClass)}>
71+
{this.props.children}
72+
</div>
73+
)}
7074
</div>
7175
)
7276
}

packages/reporter/src/errors/errors.scss

-5
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,9 @@ $code-border-radius: 4px;
5656
}
5757

5858
.studio-err-wrapper {
59-
display: none;
6059
text-align: center;
6160
}
6261

63-
&.studio-active .attempt-failed .studio-err-wrapper {
64-
display: block;
65-
}
66-
6762
.runnable-err {
6863
border-left: 2px solid $fail;
6964
background-color: $err-background;

packages/reporter/src/hooks/hooks.scss

-5
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242

4343
.hook-failed-message {
4444
color: $red-400;
45-
display: none;
4645
}
4746

4847
.hook-open-in-ide {
@@ -66,9 +65,5 @@
6665
}
6766
}
6867
}
69-
70-
.hook-failed .hook-failed-message {
71-
display: inline;
72-
}
7368
}
7469
}

packages/reporter/src/hooks/hooks.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ export interface HookHeaderProps {
2020

2121
const HookHeader = ({ model, number }: HookHeaderProps) => (
2222
<span className='hook-name'>
23-
{model.hookName} {number && `(${number})`} <span className='hook-failed-message'>(failed)</span>
23+
{model.hookName} {number && `(${number})`}
24+
{model.failed && <span className='hook-failed-message'> (failed)</span>}
2425
</span>
2526
)
2627

@@ -66,7 +67,7 @@ const Hook = observer(({ model, showNumber }: HookProps) => (
6667
header={<HookHeader model={model} number={showNumber ? model.hookNumber : undefined} />}
6768
headerClass='hook-header'
6869
headerExtras={model.invocationDetails && <HookOpenInIDE invocationDetails={model.invocationDetails} />}
69-
isOpen={true}
70+
isOpen
7071
>
7172
<ul className='commands-container'>
7273
{_.map(model.commands, (command) => <Command key={command.id} model={command} aliasesWithDuplicates={model.aliasesWithDuplicates} />)}

packages/reporter/src/instruments/instruments.scss

-5
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,4 @@
3434
color: $fail;
3535
}
3636
}
37-
38-
.no-agents .instruments-container,
39-
.no-routes .instruments-container {
40-
display: none;
41-
}
4237
}

0 commit comments

Comments
 (0)