Skip to content

Commit 4e5a015

Browse files
authored
Merge pull request #4032 from cypress-io/dx-210-icon-not-rendering-properly-test-runner
fix: add two missing icons to test runner docs
2 parents c3e6625 + 53f8ed6 commit 4e5a015

File tree

2 files changed

+104
-34
lines changed

2 files changed

+104
-34
lines changed

content/guides/core-concepts/test-runner.md

Lines changed: 102 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -13,55 +13,88 @@ title: The Test Runner
1313

1414
## Overview
1515

16-
Cypress runs tests in a unique interactive runner that allows you to see commands as they execute while also viewing the application under test.
16+
Cypress runs tests in a unique interactive runner that allows you to see
17+
commands as they execute while also viewing the application under test.
1718

1819
<DocsImage src="/img/guides/gui-diagram.png" alt="Cypress Test Runner"></DocsImage>
1920

2021
## Command Log
2122

22-
The lefthand side of the Test Runner is a visual representation of your test suite. Each test block is properly nested and each test, when clicked, displays every Cypress command and assertion executed within the test's block as well as any command or assertion executed in relevant `before`, `beforeEach`, `afterEach`, and `after` hooks.
23+
The lefthand side of the Test Runner is a visual representation of your test
24+
suite. Each test block is properly nested and each test, when clicked, displays
25+
every Cypress command and assertion executed within the test's block as well as
26+
any command or assertion executed in relevant `before`, `beforeEach`,
27+
`afterEach`, and `after` hooks.
2328

2429
<DocsImage src="/img/guides/command-log.png" alt="Cypress Test Runner" width-600 ></DocsImage>
2530

2631
### Open files in your IDE
2732

28-
There are some places in the Command Log that display a link to the relevant file where the code is located. Clicking on this link will open the file in your [preferred file opener](/guides/tooling/IDE-integration#File-Opener-Preference).
33+
There are some places in the Command Log that display a link to the relevant
34+
file where the code is located. Clicking on this link will open the file in your
35+
[preferred file opener](/guides/tooling/IDE-integration#File-Opener-Preference).
2936

3037
<DocsImage src="/img/guides/open-file-in-IDE.gif" alt="Open file your IDE" ></DocsImage>
3138

3239
### Hovering on Commands
3340

34-
Each command and assertion, when hovered over, restores the Application Under Test (righthand side) to the state it was in when that command executed. This allows you to 'time-travel' back to previous states of your application when testing.
41+
Each command and assertion, when hovered over, restores the Application Under
42+
Test (righthand side) to the state it was in when that command executed. This
43+
allows you to 'time-travel' back to previous states of your application when
44+
testing.
3545

3646
<Alert type="info">
3747

38-
By default, Cypress keeps 50 tests worth of snapshots and command data for time traveling. If you are seeing extremely high memory consumption in your browser, you may want to lower the `numTestsKeptInMemory` in your [configuration](/guides/references/configuration#Global).
48+
By default, Cypress keeps 50 tests worth of snapshots and command data for time
49+
traveling. If you are seeing extremely high memory consumption in your browser,
50+
you may want to lower the `numTestsKeptInMemory` in your
51+
[configuration](/guides/references/configuration#Global).
3952

4053
</Alert>
4154

4255
### Clicking on Commands
4356

44-
Each command, assertion, or error, when clicked on, displays extra information in the dev tools console. Clicking also 'pins' the Application Under Test (righthand side) to its previous state when the command executed.
57+
Each command, assertion, or error, when clicked on, displays extra information
58+
in the dev tools console. Clicking also 'pins' the Application Under Test
59+
(righthand side) to its previous state when the command executed.
4560

4661
<DocsImage src="/img/guides/clicking-commands.png" alt="Click to console.log and to pin" ></DocsImage>
4762

4863
## Errors
4964

50-
Cypress prints several pieces of information when an error occurs during a Cypress test.
51-
52-
1. **Error name**: This is the type of the error (e.g. AssertionError, CypressError)
53-
1. **Error message**: This generally tells you what went wrong. It can vary in length. Some are short like in the example, while some are long, and may tell you exactly how to fix the error.
54-
1. **Learn more:** Some error messages contain a Learn more link that will take you to relevant Cypress documentation.
55-
1. **Code frame file**: This is usually the top line of the stack trace and it shows the file, line number, and column number that is highlighted in the code frame below. Clicking on this link will open the file in your [preferred file opener](https://on.cypress.io/IDE-integration#File-Opener-Preference) and highlight the line and column in editors that support it.
56-
1. **Code frame**: This shows a snippet of code where the failure occurred, with the relevant line and column highlighted.
57-
1. **View stack trace**: Clicking this toggles the visibility of the stack trace. Stack traces vary in length. Clicking on a blue file path will open the file in your [preferred file opener](https://on.cypress.io/IDE-integration#File-Opener-Preference).
58-
1. **Print to console button**: Click this to print the full error to your DevTools console. This will usually allow you to click on lines in the stack trace and open files in your DevTools.
65+
Cypress prints several pieces of information when an error occurs during a
66+
Cypress test.
67+
68+
1. **Error name**: This is the type of the error (e.g. AssertionError,
69+
CypressError)
70+
1. **Error message**: This generally tells you what went wrong. It can vary in
71+
length. Some are short like in the example, while some are long, and may tell
72+
you exactly how to fix the error.
73+
1. **Learn more:** Some error messages contain a Learn more link that will take
74+
you to relevant Cypress documentation.
75+
1. **Code frame file**: This is usually the top line of the stack trace and it
76+
shows the file, line number, and column number that is highlighted in the
77+
code frame below. Clicking on this link will open the file in your
78+
[preferred file opener](https://on.cypress.io/IDE-integration#File-Opener-Preference)
79+
and highlight the line and column in editors that support it.
80+
1. **Code frame**: This shows a snippet of code where the failure occurred, with
81+
the relevant line and column highlighted.
82+
1. **View stack trace**: Clicking this toggles the visibility of the stack
83+
trace. Stack traces vary in length. Clicking on a blue file path will open
84+
the file in your
85+
[preferred file opener](https://on.cypress.io/IDE-integration#File-Opener-Preference).
86+
1. **Print to console button**: Click this to print the full error to your
87+
DevTools console. This will usually allow you to click on lines in the stack
88+
trace and open files in your DevTools.
5989

6090
<DocsImage src="/img/guides/command-failure-error.png" alt="example command failure error" ></DocsImage>
6191

6292
## Instrument Panel
6393

64-
For certain commands like [`cy.intercept()`](/api/commands/intercept), [`cy.stub()`](/api/commands/stub), and [`cy.spy()`](/api/commands/spy), an extra instrument panel is displayed above the test to give more information about the state of your tests.
94+
For certain commands like [`cy.intercept()`](/api/commands/intercept),
95+
[`cy.stub()`](/api/commands/stub), and [`cy.spy()`](/api/commands/spy), an extra
96+
instrument panel is displayed above the test to give more information about the
97+
state of your tests.
6598

6699
### Routes
67100

@@ -77,7 +110,10 @@ For certain commands like [`cy.intercept()`](/api/commands/intercept), [`cy.stub
77110

78111
## Application Under Test
79112

80-
The righthand side of the Test Runner is used to display the Application Under Test (AUT): the application that was navigated to using a [`cy.visit()`](/api/commands/visit) or any subsequent routing calls made from the visited application.
113+
The righthand side of the Test Runner is used to display the Application Under
114+
Test (AUT): the application that was navigated to using a
115+
[`cy.visit()`](/api/commands/visit) or any subsequent routing calls made from
116+
the visited application.
81117

82118
In the example below, we wrote the following code in our test file:
83119

@@ -87,23 +123,37 @@ cy.visit('https://example.cypress.io')
87123
cy.title().should('include', 'Kitchen Sink')
88124
```
89125

90-
In the corresponding Application Preview below, you can see `https://example.cypress.io` is being displayed in the righthand side. Not only is the application visible, but it is fully interactable. You can open your developer tools to inspect elements as you would in your normal application. The DOM is completely available for debugging.
126+
In the corresponding Application Preview below, you can see
127+
`https://example.cypress.io` is being displayed in the righthand side. Not only
128+
is the application visible, but it is fully interactable. You can open your
129+
developer tools to inspect elements as you would in your normal application. The
130+
DOM is completely available for debugging.
91131

92132
<DocsImage src="/img/guides/application-under-test.png" alt="Application Under Test" ></DocsImage>
93133

94-
The AUT also displays in the size and orientation specified in your tests. You can change the size or orientation with the [`cy.viewport()`](/api/commands/viewport) command or in your [Cypress configuration](/guides/references/configuration#Viewport). If the AUT does not fit within the current browser window, it is scaled appropriately to fit within the window.
134+
The AUT also displays in the size and orientation specified in your tests. You
135+
can change the size or orientation with the
136+
[`cy.viewport()`](/api/commands/viewport) command or in your
137+
[Cypress configuration](/guides/references/configuration#Viewport). If the AUT
138+
does not fit within the current browser window, it is scaled appropriately to
139+
fit within the window.
95140

96-
The current size and scale of the AUT is displayed in the top right corner of the window.
141+
The current size and scale of the AUT is displayed in the top right corner of
142+
the window.
97143

98-
The image below shows that our application is displaying at `1000px` width, `660px` height and scaled to `100%`.
144+
The image below shows that our application is displaying at `1000px` width,
145+
`660px` height and scaled to `100%`.
99146

100147
<DocsImage src="/img/guides/viewport-scaling.png" alt="Viewport Scaling" ></DocsImage>
101148

102-
_Note: The righthand side may also be used to display syntax errors in your test file that prevent the tests from running._
149+
_Note: The righthand side may also be used to display syntax errors in your test
150+
file that prevent the tests from running._
103151

104152
<DocsImage src="/img/guides/errors.png" alt="Errors" ></DocsImage>
105153

106-
_Note: Internally, the AUT renders within an iframe. This can sometimes cause unexpected behaviors [explained here.](/api/commands/window#Cypress-uses-2-different-windows)_
154+
_Note: Internally, the AUT renders within an iframe. This can sometimes cause
155+
unexpected behaviors
156+
[explained here.](/api/commands/window#Cypress-uses-2-different-windows)_
107157

108158
## Selector Playground
109159

@@ -117,7 +167,8 @@ The Selector Playground is an interactive feature that helps you:
117167

118168
### Uniqueness
119169

120-
Cypress will automatically calculate a **unique selector** to use targeted element by running through a series of selector strategies.
170+
Cypress will automatically calculate a **unique selector** to use targeted
171+
element by running through a series of selector strategies.
121172

122173
By default Cypress will favor:
123174

@@ -136,7 +187,8 @@ By default Cypress will favor:
136187

137188
Cypress allows you to control how a selector is determined.
138189

139-
Use the [Cypress.SelectorPlayground](/api/cypress-api/selector-playground-api) API to control the selectors you want returned.
190+
Use the [Cypress.SelectorPlayground](/api/cypress-api/selector-playground-api)
191+
API to control the selectors you want returned.
140192

141193
</Alert>
142194

@@ -147,17 +199,25 @@ You may find yourself struggling to write good selectors because:
147199
- Your application uses dynamic ID's and class names
148200
- Your tests break whenever there are CSS or content changes
149201

150-
To help with these common challenges, the Selector Playground automatically prefers certain `data-*` attributes when determining a unique selector.
202+
To help with these common challenges, the Selector Playground automatically
203+
prefers certain `data-*` attributes when determining a unique selector.
151204

152-
Please read our [Best Practices guide](/guides/references/best-practices#Selecting-Elements) on helping you target elements and prevent tests from breaking on CSS or JS changes.
205+
Please read our
206+
[Best Practices guide](/guides/references/best-practices#Selecting-Elements) on
207+
helping you target elements and prevent tests from breaking on CSS or JS
208+
changes.
153209

154210
### Finding Selectors
155211

156-
To open the Selector Playground, click the `<Icon name="crosshairs" color="grey"></Icon>` button next to the URL at the top of the runner. Hover over elements in your app to preview a unique selector for that element in the tooltip.
212+
To open the Selector Playground, click the <Icon name="crosshairs"></Icon>
213+
button next to the URL at the top of the runner. Hover over elements in your app
214+
to preview a unique selector for that element in the tooltip.
157215

158216
<DocsImage src="/img/guides/test-runner/open-selector-playground.gif" alt="Opening selector playground and hovering over elements" ></DocsImage>
159217

160-
Click on the element and its selector will appear at the top. From there, you can copy it to your clipboard (`<Icon name="copy" color="grey"></Icon>`) or print it to the console (`<Icon name="terminal"></Icon>`).
218+
Click on the element and its selector will appear at the top. From there, you
219+
can copy it to your clipboard ( <Icon name="copy"></Icon> ) or print it to the
220+
console ( <Icon name="terminal"></Icon> ).
161221

162222
<DocsImage src="/img/guides/test-runner/copy-selector-in-selector-playground.gif" alt="Clicking an element, copying its selector to clipboard, printing it to the console" ></DocsImage>
163223

@@ -167,27 +227,35 @@ The box at the top that displays the selector is also a text input.
167227

168228
#### Editing a Selector
169229

170-
When you edit the selector, it will show you how many elements match and highlight those elements in your app.
230+
When you edit the selector, it will show you how many elements match and
231+
highlight those elements in your app.
171232

172233
<DocsImage src="/img/guides/test-runner/typing-a-selector-to-find-in-playground.gif" alt="Type a selector to see what elements it matches" ></DocsImage>
173234

174235
#### Switching to Contains
175236

176-
You can also experiment with what [`cy.contains()`](/api/commands/contains) would yield given a string of text. Click on `cy.get` and switch to `cy.contains`.
237+
You can also experiment with what [`cy.contains()`](/api/commands/contains)
238+
would yield given a string of text. Click on `cy.get` and switch to
239+
`cy.contains`.
177240

178-
Type in text to see which element it matches. Note that [`cy.contains()`](/api/commands/contains) only yields the first element that matches the text, even if multiple elements on the page contain the text.
241+
Type in text to see which element it matches. Note that
242+
[`cy.contains()`](/api/commands/contains) only yields the first element that
243+
matches the text, even if multiple elements on the page contain the text.
179244

180245
<DocsImage src="/img/guides/test-runner/cy-contains-in-selector-playground.gif" alt="Experiment with cy.contains" ></DocsImage>
181246

182247
#### Disabling Highlights
183248

184-
If you would like to interact with your app while the Selector Playground is open, the element highlighting might get in the way. Toggling the highlighting off will allow you to interact with your app more easily.
249+
If you would like to interact with your app while the Selector Playground is
250+
open, the element highlighting might get in the way. Toggling the highlighting
251+
off will allow you to interact with your app more easily.
185252

186253
<DocsImage src="/img/guides/test-runner/turn-off-highlight-in-selector-playground.gif" alt="Turn off highlighting" ></DocsImage>
187254

188255
## Keyboard Shortcuts
189256

190-
There are keyboard shortcuts to quickly perform common actions from within the Test Runner.
257+
There are keyboard shortcuts to quickly perform common actions from within the
258+
Test Runner.
191259

192260
| Key | Action |
193261
| --- | ----------------------------- |

nuxt.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ export default {
131131
'faCode',
132132
'faCog',
133133
'faCogs',
134+
'faCopy',
135+
'faCrosshairs',
134136
'faDownload',
135137
'faExclamationTriangle',
136138
'faExternalLinkAlt',

0 commit comments

Comments
 (0)