Skip to content

Commit 524af8b

Browse files
authored
Add tests for the Org Setup page (#1570)
Summary: This takes coverage for `pages/setup.tsx` from 0% to 100% (though there are some uncovered branches). Also adds marginal coverage to the sidebar, footer, topbar as a sideeffect from the snapshot test. Type of change: /kind test Test Plan: Ran the test with yarn. --------- Signed-off-by: Vihang Mehta <vihang@pixielabs.ai>
1 parent 37fea48 commit 524af8b

File tree

10 files changed

+715
-9
lines changed

10 files changed

+715
-9
lines changed

src/ui/jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ module.exports = {
3636
],
3737
moduleNameMapper: {
3838
'^.+.(jpg|jpeg|png|gif|svg)$': '<rootDir>/src/testing/file-mock.js',
39+
'typeface-walter-turncoat': '<rootDir>/src/testing/style-mock.js',
3940
'monaco-editor': require.resolve('react-monaco-editor'),
4041
'^configurable/(.*)': '<rootDir>/src/configurables/base/$1',
4142
'^app/(.*)': '<rootDir>/src/$1',
Lines changed: 382 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,382 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`setup page renders 1`] = `
4+
<div>
5+
<div
6+
class="SetupView-root-1"
7+
>
8+
<header
9+
class="MuiPaper-root MuiPaper-elevation MuiPaper-elevation4 MuiAppBar-root MuiAppBar-colorPrimary MuiAppBar-positionStatic TopBar-container-12 css-slaqq1-MuiPaper-root-MuiAppBar-root"
10+
>
11+
<div
12+
class="MuiToolbar-root MuiToolbar-gutters MuiToolbar-regular css-1t29gy6-MuiToolbar-root"
13+
>
14+
<button
15+
aria-label="menu"
16+
class="MuiButtonBase-root MuiIconButton-root MuiIconButton-colorInherit MuiIconButton-sizeLarge css-170a28i-MuiButtonBase-root-MuiIconButton-root"
17+
tabindex="0"
18+
type="button"
19+
>
20+
<svg
21+
aria-hidden="true"
22+
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium TopBar-menu-14 css-i4bv87-MuiSvgIcon-root"
23+
data-testid="ChevronRightIcon"
24+
focusable="false"
25+
viewBox="0 0 24 24"
26+
>
27+
<path
28+
d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"
29+
/>
30+
</svg>
31+
<span
32+
class="MuiTouchRipple-root css-8je8zh-MuiTouchRipple-root"
33+
/>
34+
</button>
35+
<div
36+
class="TopBar-logoContainer-17"
37+
>
38+
<a
39+
href="/"
40+
>
41+
<div
42+
class="Logo-logoContainer-28"
43+
>
44+
<img
45+
class="Logo-logo-27"
46+
src="[object Object]"
47+
/>
48+
</div>
49+
</a>
50+
</div>
51+
<div
52+
class="TopBar-contents-13"
53+
>
54+
<div
55+
class="SetupView-title-2"
56+
>
57+
<div
58+
class="SetupView-titleText-3"
59+
>
60+
Setup
61+
</div>
62+
</div>
63+
</div>
64+
<div
65+
class="TopBar-profileIcon-26"
66+
>
67+
<div
68+
class="MuiAvatar-root MuiAvatar-circular MuiAvatar-colorDefault TopBar-avatarSm-23 TopBar-clickable-16 css-1fhxy4v-MuiAvatar-root"
69+
>
70+
<svg
71+
aria-hidden="true"
72+
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiAvatar-fallback css-10mi8st-MuiSvgIcon-root-MuiAvatar-fallback"
73+
data-testid="PersonIcon"
74+
focusable="false"
75+
viewBox="0 0 24 24"
76+
>
77+
<path
78+
d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"
79+
/>
80+
</svg>
81+
</div>
82+
</div>
83+
</div>
84+
</header>
85+
<div
86+
class="MuiDrawer-root MuiDrawer-docked SideBar-drawerClose-44 css-7ik032-MuiDrawer-docked"
87+
>
88+
<div
89+
class="MuiPaper-root MuiPaper-elevation MuiPaper-elevation0 SideBar-drawerClose-44 MuiDrawer-paper MuiDrawer-paperAnchorLeft MuiDrawer-paperAnchorDockedLeft css-1yu5t60-MuiPaper-root-MuiDrawer-paper"
90+
>
91+
<ul
92+
class="MuiList-root MuiList-padding css-h4y409-MuiList-root"
93+
>
94+
<div
95+
class="MuiButtonBase-root MuiListItem-root MuiListItem-gutters MuiListItem-padding MuiListItem-button SideBar-clippedItem-50 css-1eeu83b-MuiButtonBase-root-MuiListItem-root"
96+
role="button"
97+
tabindex="0"
98+
>
99+
<span
100+
class="MuiTouchRipple-root css-8je8zh-MuiTouchRipple-root"
101+
/>
102+
</div>
103+
</ul>
104+
<ul
105+
class="MuiList-root MuiList-padding css-h4y409-MuiList-root"
106+
>
107+
<a
108+
aria-label="Data Retention"
109+
class="MuiButtonBase-root MuiListItem-root MuiListItem-gutters MuiListItem-padding MuiListItem-button SideBar-listIcon-48 css-1eeu83b-MuiButtonBase-root-MuiListItem-root"
110+
data-mui-internal-clone-element="true"
111+
href="/configure-data-export"
112+
tabindex="0"
113+
>
114+
<div
115+
class="MuiListItemIcon-root css-1k4i193-MuiListItemIcon-root"
116+
>
117+
<svg
118+
aria-hidden="true"
119+
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-i4bv87-MuiSvgIcon-root"
120+
focusable="false"
121+
viewBox="0 0 15 18"
122+
>
123+
<path
124+
d="
125+
M7.49919 6.59251C11.6409 6.59251 14.9984 5.11673 14.9984 3.29625C14.9984 1.47578 11.6409 0 7.49919 0C3.3575 0 0
126+
1.47578 0 3.29625C0 5.11673 3.3575 6.59251 7.49919 6.59251Z
127+
"
128+
/>
129+
<path
130+
d="
131+
M7.49935 7.62846C4.25179 7.62846 1.38825 6.78389 0.000161662 5.41089V7.15756C0.000161662 8.97803 3.35766 10.4538
132+
7.49935 10.4538C11.641 10.4538 14.9985 8.97803 14.9985 7.15756V5.41089C13.6105
133+
6.78389 10.7469 7.62846 7.49935 7.62846Z
134+
"
135+
/>
136+
<path
137+
d="
138+
M7.50041 15.1746C4.25285 15.1746 1.38931 14.3301 0.00122562 12.9571L0.00123276 14.7037C0.00123276 16.5242
139+
3.35873 18 7.50041 18C11.6421 18 14.9996 16.5242 14.9996 14.7037L14.9996 12.9571C13.6115 14.3301 10.748
140+
15.1746 7.50041 15.1746Z
141+
"
142+
/>
143+
<path
144+
d="
145+
M7.49935 7.62846C4.25179 7.62846 1.38825 6.78389 0.000161662 5.41089V7.15756C0.000161662 8.97803 3.35766 10.4538
146+
7.49935 10.4538C11.641 10.4538 14.9985 8.97803 14.9985 7.15756V5.41089C13.6105 6.78389 10.7469 7.62846
147+
7.49935 7.62846Z
148+
"
149+
/>
150+
<path
151+
d="
152+
M7.49935 7.62846C4.25179 7.62846 1.38825 6.78389 0.000161662 5.41089V7.15756C0.000161662 8.97803 3.35766
153+
10.4538 7.49935 10.4538C11.641 10.4538 14.9985 8.97803 14.9985 7.15756V5.41089C13.6105 6.78389 10.7469
154+
7.62846 7.49935 7.62846Z
155+
"
156+
/>
157+
<path
158+
d="
159+
M7.49937 11.353C4.25168 11.353 1.38805 10.5083 2.16292e-05 9.13524L0.00017571 10.8821C0.00017571 12.7025
160+
3.35768 14.1783 7.49937 14.1783C11.6411 14.1783 14.9986 12.7025 14.9986 10.8821L14.9985 9.13543C13.6104
161+
10.5084 10.7469 11.353 7.49937 11.353Z
162+
"
163+
/>
164+
</svg>
165+
</div>
166+
<div
167+
class="MuiListItemText-root css-tlelie-MuiListItemText-root"
168+
>
169+
<span
170+
class="MuiTypography-root MuiTypography-body1 MuiListItemText-primary css-10hburv-MuiTypography-root"
171+
>
172+
Data Retention
173+
</span>
174+
</div>
175+
<span
176+
class="MuiTouchRipple-root css-8je8zh-MuiTouchRipple-root"
177+
/>
178+
</a>
179+
</ul>
180+
<div
181+
class="SideBar-spacer-54"
182+
/>
183+
<ul
184+
class="MuiList-root MuiList-padding css-h4y409-MuiList-root"
185+
>
186+
<a
187+
aria-label="Docs"
188+
class="MuiButtonBase-root MuiListItem-root MuiListItem-gutters MuiListItem-padding MuiListItem-button SideBar-listIcon-48 css-1eeu83b-MuiButtonBase-root-MuiListItem-root"
189+
data-mui-internal-clone-element="true"
190+
href="https://docs."
191+
tabindex="0"
192+
target="_blank"
193+
>
194+
<div
195+
class="MuiListItemIcon-root css-1k4i193-MuiListItemIcon-root"
196+
>
197+
<svg
198+
aria-hidden="true"
199+
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-i4bv87-MuiSvgIcon-root"
200+
focusable="false"
201+
viewBox="0 0 32 32"
202+
>
203+
<path
204+
clip-rule="evenodd"
205+
d="M6.8 5H24.4C25.3941 5 26.2 5.80589 26.2 6.8V26C26.2 26.9941 25.3941 27.8 24.4
206+
27.8H6.8C5.80589 27.8 5 26.9941 5 26V6.8C5 5.80589 5.80589 5 6.8 5ZM24.2 25.8V7H7V25.8H24.2Z
207+
"
208+
fill-rule="evenodd"
209+
/>
210+
<path
211+
clip-rule="evenodd"
212+
d="M16.5082 12.5797C16.2594 12.8258 15.96 12.9488 15.61 12.9488C15.26 12.9488 14.9619 12.8258
213+
14.7158 12.5797C14.4697 12.3336 14.3467 12.0355 14.3467 11.6855C14.3467 11.3355 14.4697 11.0361
214+
14.7158 10.7873C14.9619 10.5385 15.26 10.4141 15.61 10.4141C15.9654 10.4141 16.2662 10.5385
215+
16.5123 10.7873C16.7584 11.0361 16.8815 11.3355 16.8815 11.6855C16.8815 12.0355 16.757 12.3336
216+
16.5082 12.5797ZM17.6854 21.5047V21.8H13.5428V21.5047C13.8818 21.4938 14.1334 21.3953 14.2975
217+
21.2094C14.4068 21.0836 14.4615 20.75 14.4615 20.2086V15.7297C14.4615 15.1883 14.3986 14.8424
218+
14.2729 14.692C14.1471 14.5416 13.9037 14.4555 13.5428 14.4336V14.1301H16.7584V20.2086C16.7584
219+
20.75 16.8213 21.0959 16.9471 21.2463C17.0729 21.3967 17.319 21.4828 17.6854 21.5047Z
220+
"
221+
fill-rule="evenodd"
222+
/>
223+
</svg>
224+
</div>
225+
<div
226+
class="MuiListItemText-root css-tlelie-MuiListItemText-root"
227+
>
228+
<span
229+
class="MuiTypography-root MuiTypography-body1 MuiListItemText-primary css-10hburv-MuiTypography-root"
230+
>
231+
Docs
232+
</span>
233+
</div>
234+
<span
235+
class="MuiTouchRipple-root css-8je8zh-MuiTouchRipple-root"
236+
/>
237+
</a>
238+
</ul>
239+
</div>
240+
</div>
241+
<div
242+
class="SetupView-main-4"
243+
>
244+
<div
245+
class="SetupView-mainBlock-5"
246+
>
247+
<div
248+
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 SetupView-paper-7 css-zsf01h-MuiPaper-root"
249+
>
250+
<form
251+
aria-label="Create Your Organization"
252+
>
253+
<h1>
254+
Create Your Organization
255+
</h1>
256+
<figure>
257+
<img
258+
alt="Setup"
259+
src="[object Object]"
260+
/>
261+
</figure>
262+
<p>
263+
Organizations allow you to collaborate with others by sharing clusters, PxL scripts, and more.
264+
</p>
265+
<p>
266+
<strong>
267+
Give your organization a name to get started.
268+
</strong>
269+
</p>
270+
<div
271+
class="SetupView-inputContainer-8"
272+
>
273+
<div
274+
class="MuiFormControl-root MuiTextField-root css-1u3bzj6-MuiFormControl-root-MuiTextField-root"
275+
>
276+
<label
277+
class="MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-outlined MuiFormLabel-root MuiFormLabel-colorPrimary css-1noh6np-MuiFormLabel-root-MuiInputLabel-root"
278+
data-shrink="false"
279+
>
280+
Organization Name
281+
</label>
282+
<div
283+
class="MuiOutlinedInput-root MuiInputBase-root MuiInputBase-colorPrimary MuiInputBase-formControl css-42ycng-MuiInputBase-root-MuiOutlinedInput-root"
284+
>
285+
<input
286+
aria-invalid="false"
287+
class="MuiOutlinedInput-input MuiInputBase-input css-1v4it1l-MuiInputBase-input-MuiOutlinedInput-input"
288+
type="text"
289+
value=""
290+
/>
291+
<fieldset
292+
aria-hidden="true"
293+
class="MuiOutlinedInput-notchedOutline css-9425fu-MuiOutlinedInput-notchedOutline"
294+
>
295+
<legend
296+
class="css-173wfxe"
297+
>
298+
<span>
299+
Organization Name
300+
</span>
301+
</legend>
302+
</fieldset>
303+
</div>
304+
</div>
305+
</div>
306+
<p
307+
class="SetupView-muted-11"
308+
>
309+
Trying to join an organization? Please ask the organization admin for an invite, and check your email.
310+
</p>
311+
<div
312+
class="SetupView-buttons-10"
313+
>
314+
<button
315+
class="MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeMedium MuiButton-containedSizeMedium MuiButtonBase-root Mui-disabled css-3c88qm-MuiButtonBase-root-MuiButton-root"
316+
disabled=""
317+
tabindex="-1"
318+
type="button"
319+
>
320+
Create
321+
</button>
322+
</div>
323+
</form>
324+
</div>
325+
</div>
326+
<div
327+
class="SetupView-mainFooter-6"
328+
>
329+
<div
330+
class="Footer-root-55"
331+
>
332+
<div
333+
class="Footer-left-56"
334+
>
335+
<a
336+
class="Footer-text-58"
337+
href="https://www.linuxfoundation.org/terms"
338+
>
339+
Terms & Conditions
340+
</a>
341+
<a
342+
class="Footer-text-58"
343+
href="https://www.linuxfoundation.org/privacy"
344+
>
345+
Privacy Policy
346+
</a>
347+
<div
348+
class="Footer-text-58"
349+
>
350+
<span
351+
aria-label=""
352+
class=""
353+
data-mui-internal-clone-element="true"
354+
>
355+
Built
356+
time unknown
357+
</span>
358+
</div>
359+
</div>
360+
<div
361+
class="Footer-right-57"
362+
>
363+
<a
364+
class="Footer-text-58"
365+
href="/credits"
366+
>
367+
Credits
368+
</a>
369+
<h6
370+
class="MuiTypography-root MuiTypography-subtitle2 Footer-text-58 css-1m30lgi-MuiTypography-root"
371+
>
372+
<span>
373+
© 2018- The Pixie Authors
374+
</span>
375+
</h6>
376+
</div>
377+
</div>
378+
</div>
379+
</div>
380+
</div>
381+
</div>
382+
`;

0 commit comments

Comments
 (0)