Skip to content

Commit 254b7bc

Browse files
test [M3 8070]: apply linting 7 (linode#11766)
* M3-8070 linting errors in placementGroups -> vpc dirs * Added changeset: Fixes of linting errors in e2e/core
1 parent 28be63c commit 254b7bc

19 files changed

+179
-241
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@linode/manager": Tests
3+
---
4+
5+
Fixes of linting errors in e2e/core ([#11766](https://github.com/linode/manager/pull/11766))

packages/manager/.eslintrc.cjs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ module.exports = {
2323
'build',
2424
'storybook-static',
2525
'.storybook',
26-
'e2e/core/placementGroups',
27-
'e2e/core/stackscripts',
28-
'e2e/core/volumes',
29-
'e2e/core/vpc',
3026
'public',
3127
'!.eslintrc.js',
3228
],

packages/manager/cypress/e2e/core/placementGroups/create-linode-with-placement-groups.spec.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,14 @@ describe('Linode create flow with Placement Group', () => {
181181

182182
// Confirm the Placement group assignment is accounted for in the summary.
183183
cy.findByText('Assigned to Placement Group')
184-
.scrollIntoView()
185-
.should('be.visible');
184+
.as('qaAssigned')
185+
.scrollIntoView();
186+
cy.get('@qaAssigned').should('be.visible');
186187

187188
// Type in a label, password and submit the form.
188189
mockCreateLinode(mockLinode).as('createLinode');
189-
cy.get('#linode-label').clear().type('linode-with-placement-group');
190+
cy.get('#linode-label').clear();
191+
cy.focused().type('linode-with-placement-group');
190192
cy.get('#root-password').type(randomString(32));
191193

192194
cy.findByText('Create Linode').should('be.enabled').click();
@@ -242,18 +244,18 @@ describe('Linode create flow with Placement Group', () => {
242244
// Confirm that mocked Placement Group is shown in the Autocomplete, and then select it.
243245
cy.findByText(
244246
`Placement Groups in ${mockNewarkRegion.label} (${mockNewarkRegion.id})`
245-
)
246-
.click()
247-
.type(`${mockPlacementGroup.label}`);
247+
).click();
248+
cy.focused().type(`${mockPlacementGroup.label}`);
248249
ui.autocompletePopper
249250
.findByTitle(mockPlacementGroup.label)
250251
.should('be.visible')
251252
.click();
252253

253254
// Confirm the Placement group assignment is accounted for in the summary.
254255
cy.findByText('Assigned to Placement Group')
255-
.scrollIntoView()
256-
.should('be.visible');
256+
.as('qaAssigned')
257+
.scrollIntoView();
258+
cy.get('@qaAssigned').should('be.visible');
257259

258260
// Create Linode and confirm contents of outgoing API request payload.
259261
ui.button

packages/manager/cypress/e2e/core/placementGroups/create-placement-groups.spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,8 @@ describe('Placement Group create flow', () => {
8383
// Enter label, select region, and submit form.
8484
cy.findByLabelText('Label').type(mockPlacementGroup.label);
8585

86-
cy.findByLabelText('Region')
87-
.click()
88-
.type(`${mockPlacementGroupRegion.label}{enter}`);
86+
cy.findByLabelText('Region').click();
87+
cy.focused().type(`${mockPlacementGroupRegion.label}{enter}`);
8988

9089
cy.findByText(placementGroupLimitMessage).should('be.visible');
9190
cy.findByText(CANNOT_CHANGE_PLACEMENT_GROUP_POLICY_MESSAGE).should(

packages/manager/cypress/e2e/core/placementGroups/update-placement-group-label.spec.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,10 @@ describe('Placement Group update label flow', () => {
7575
cy.findByText('Edit').should('be.visible');
7676
cy.findByDisplayValue(mockPlacementGroup.label)
7777
.should('be.visible')
78-
.click()
79-
.type(`{selectall}{backspace}${mockPlacementGroupUpdated.label}`);
78+
.click();
79+
cy.focused().type(
80+
`{selectall}{backspace}${mockPlacementGroupUpdated.label}`
81+
);
8082

8183
cy.findByText('Edit').should('be.visible').click();
8284

@@ -140,8 +142,10 @@ describe('Placement Group update label flow', () => {
140142
cy.findByText('Edit').should('be.visible');
141143
cy.findByDisplayValue(mockPlacementGroup.label)
142144
.should('be.visible')
143-
.click()
144-
.type(`{selectall}{backspace}${mockPlacementGroupUpdated.label}`);
145+
.click();
146+
cy.focused().type(
147+
`{selectall}{backspace}${mockPlacementGroupUpdated.label}`
148+
);
145149

146150
cy.findByText('Edit').should('be.visible').click();
147151

packages/manager/cypress/e2e/core/stackscripts/create-stackscripts.spec.ts

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,12 @@ const fillOutStackscriptForm = (
7070
// Fill out "StackScript Label", "Description", "Target Images", and "Script" fields.
7171
cy.findByLabelText(/^StackScript Label.*/)
7272
.should('be.visible')
73-
.click()
74-
.type(label);
73+
.click();
74+
cy.focused().type(label);
7575

7676
if (description) {
77-
cy.findByLabelText('Description')
78-
.should('be.visible')
79-
.click()
80-
.type(description);
77+
cy.findByLabelText('Description').should('be.visible').click();
78+
cy.focused().type(description);
8179
}
8280

8381
ui.autocomplete.findByLabel('Target Images').should('be.visible').click();
@@ -108,11 +106,9 @@ const fillOutLinodeForm = (label: string, regionName: string) => {
108106
.click();
109107
ui.regionSelect.find().should('have.value', `${region.label} (${region.id})`);
110108

111-
cy.findByText('Linode Label')
112-
.should('be.visible')
113-
.click()
114-
.type('{selectall}{backspace}')
115-
.type(label);
109+
cy.findByText('Linode Label').should('be.visible').click();
110+
cy.focused().type('{selectall}{backspace}');
111+
cy.focused().type(label);
116112

117113
cy.findByText('Dedicated CPU').should('be.visible').click();
118114
cy.get('[id="g6-dedicated-2"]').click();
@@ -267,16 +263,12 @@ describe('Create stackscripts', () => {
267263
// Fill out Linode creation form, confirm UDF fields behave as expected.
268264
fillOutLinodeForm(linodeLabel, linodeRegion.label);
269265

270-
cy.findByLabelText('Example Password')
271-
.should('be.visible')
272-
.click()
273-
.type(randomString(32));
266+
cy.findByLabelText('Example Password').should('be.visible').click();
267+
cy.focused().type(randomString(32));
274268

275-
cy.findByLabelText('Example Title')
276-
.should('be.visible')
277-
.click()
278-
.type('{selectall}{backspace}')
279-
.type(randomString(12));
269+
cy.findByLabelText('Example Title').should('be.visible').click();
270+
cy.focused().type('{selectall}{backspace}');
271+
cy.focused().type(randomString(12));
280272

281273
ui.button
282274
.findByTitle('Create Linode')
@@ -367,18 +359,16 @@ describe('Create stackscripts', () => {
367359
filteredImageData?.forEach((imageSample: Image) => {
368360
const imageLabel = imageSample.label;
369361
cy.findAllByText(imageLabel, { exact: false })
362+
.as('qaImageLabel')
370363
.last()
371-
.scrollIntoView()
372-
.should('exist')
373-
.should('be.visible');
364+
.scrollIntoView();
365+
cy.get('@qaImageLabel').should('exist').should('be.visible');
374366
});
375367
});
376368

377369
// Select private image.
378-
cy.findByText(privateImage.label)
379-
.scrollIntoView()
380-
.should('be.visible')
381-
.click();
370+
cy.findByText(privateImage.label).as('qaPrivateImage').scrollIntoView();
371+
cy.get('@qaPrivateImage').should('be.visible').click();
382372

383373
interceptCreateLinode().as('createLinode');
384374
fillOutLinodeForm(

packages/manager/cypress/e2e/core/stackscripts/smoke-community-stackscripts.spec.ts

Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,10 @@ describe('Community Stackscripts integration tests', () => {
137137

138138
// Search the corresponding community stack script
139139
mockGetStackScripts([stackScript]).as('getFilteredStackScripts');
140-
cy.findByPlaceholderText('Search by Label, Username, or Description')
141-
.click()
142-
.type(`${stackScript.label}{enter}`);
140+
cy.findByPlaceholderText(
141+
'Search by Label, Username, or Description'
142+
).click();
143+
cy.focused().type(`${stackScript.label}{enter}`);
143144
cy.wait('@getFilteredStackScripts');
144145

145146
// Check filtered results
@@ -251,9 +252,10 @@ describe('Community Stackscripts integration tests', () => {
251252
cy.get('tr').then((value) => {
252253
const rowCount = Cypress.$(value).length - 1; // Remove the table title row
253254

254-
cy.findByPlaceholderText('Search by Label, Username, or Description')
255-
.click()
256-
.type(`${stackScript.label}{enter}`);
255+
cy.findByPlaceholderText(
256+
'Search by Label, Username, or Description'
257+
).click();
258+
cy.focused().type(`${stackScript.label}{enter}`);
257259
cy.get(`[data-qa-table-row="${stackScript.label}"]`).should('be.visible');
258260

259261
cy.get('tr').its('length').should('be.lt', rowCount);
@@ -285,9 +287,10 @@ describe('Community Stackscripts integration tests', () => {
285287
cy.visitWithLogin('/stackscripts/community');
286288
cy.wait(['@getStackScripts', '@getPreferences']);
287289

288-
cy.findByPlaceholderText('Search by Label, Username, or Description')
289-
.click()
290-
.type(`${stackScriptName}{enter}`);
290+
cy.findByPlaceholderText(
291+
'Search by Label, Username, or Description'
292+
).click();
293+
cy.focused().type(`${stackScriptName}{enter}`);
291294
cy.get(`[data-qa-table-row="${stackScriptName}"]`)
292295
.should('be.visible')
293296
.within(() => {
@@ -325,29 +328,21 @@ describe('Community Stackscripts integration tests', () => {
325328
);
326329

327330
// Input VPN information
328-
cy.get('[id="ipsec-pre-shared-key"]')
329-
.should('be.visible')
330-
.click()
331-
.type(`${sharedKey}{enter}`);
332-
cy.get('[id="vpn-username"]')
333-
.should('be.visible')
334-
.click()
335-
.type(`${vpnUser}{enter}`);
336-
cy.get('[id="vpn-password"]')
337-
.should('be.visible')
338-
.click()
339-
.type(`${vpnPassword}{enter}`);
331+
cy.get('[id="ipsec-pre-shared-key"]').should('be.visible').click();
332+
cy.focused().type(`${sharedKey}{enter}`);
333+
cy.get('[id="vpn-username"]').should('be.visible').click();
334+
cy.focused().type(`${vpnUser}{enter}`);
335+
cy.get('[id="vpn-password"]').should('be.visible').click();
336+
cy.focused().type(`${vpnPassword}{enter}`);
340337

341338
// Check each field should persist when moving onto another field
342339
cy.get('[id="ipsec-pre-shared-key"]').should('have.value', sharedKey);
343340
cy.get('[id="vpn-username"]').should('have.value', vpnUser);
344341
cy.get('[id="vpn-password"]').should('have.value', vpnPassword);
345342

346343
// Choose an image
347-
cy.findByPlaceholderText('Choose an image')
348-
.should('be.visible')
349-
.click()
350-
.type(image);
344+
cy.findByPlaceholderText('Choose an image').should('be.visible').click();
345+
cy.focused().type(image);
351346
ui.autocompletePopper.findByTitle(image).should('be.visible').click();
352347

353348
cy.findByText(image).should('be.visible').click();
@@ -360,7 +355,8 @@ describe('Community Stackscripts integration tests', () => {
360355
.click();
361356
// An error message shows up when no region is selected
362357
cy.contains('Region is required.').should('be.visible');
363-
ui.regionSelect.find().click().type(`${region.id}{enter}`);
358+
ui.regionSelect.find().click();
359+
cy.focused().type(`${region.id}{enter}`);
364360

365361
// Choose a plan
366362
ui.button
@@ -370,11 +366,9 @@ describe('Community Stackscripts integration tests', () => {
370366
.click();
371367

372368
// Enter a label.
373-
cy.findByText('Linode Label')
374-
.should('be.visible')
375-
.click()
376-
.type('{selectAll}{backspace}')
377-
.type(linodeLabel);
369+
cy.findByText('Linode Label').should('be.visible').click();
370+
cy.focused().type('{selectAll}{backspace}');
371+
cy.focused().type(linodeLabel);
378372

379373
// An error message shows up when no region is selected
380374
cy.contains('Plan is required.').should('be.visible');
@@ -386,7 +380,8 @@ describe('Community Stackscripts integration tests', () => {
386380

387381
// Input root password
388382
// Weak or fair root password cannot rebuild the linode
389-
cy.get('[id="root-password"]').clear().type(weakPassword);
383+
cy.get('[id="root-password"]').clear();
384+
cy.focused().type(weakPassword);
390385
ui.button
391386
.findByTitle('Create Linode')
392387
.should('be.visible')
@@ -397,7 +392,8 @@ describe('Community Stackscripts integration tests', () => {
397392
'be.visible'
398393
);
399394

400-
cy.get('[id="root-password"]').clear().type(fairPassword);
395+
cy.get('[id="root-password"]').clear();
396+
cy.focused().type(fairPassword);
401397
ui.button
402398
.findByTitle('Create Linode')
403399
.should('be.visible')

packages/manager/cypress/e2e/core/stackscripts/update-stackscripts.spec.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,14 @@ const fillOutStackscriptForm = (
6060
// Fill out "StackScript Label", "Description", "Target Images", and "Script" fields.
6161
cy.findByLabelText(/^StackScript Label.*/)
6262
.should('be.visible')
63-
.click()
64-
.clear()
65-
.type(label);
63+
.click();
64+
cy.focused().clear();
65+
cy.focused().type(label);
6666

6767
if (description) {
68-
cy.findByLabelText('Description')
69-
.should('be.visible')
70-
.click()
71-
.clear()
72-
.type(description);
68+
cy.findByLabelText('Description').should('be.visible').click();
69+
cy.focused().clear();
70+
cy.focused().type(description);
7371
}
7472

7573
ui.autocomplete.findByLabel('Target Images').should('be.visible').click();

packages/manager/cypress/e2e/core/volumes/attach-volume.spec.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,8 @@ describe('volume attach and detach flows', () => {
100100
.click();
101101

102102
ui.drawer.findByTitle(`Attach Volume ${volume.label}`).within(() => {
103-
cy.findByLabelText('Linode')
104-
.should('be.visible')
105-
.click()
106-
.type(linode.label);
103+
cy.findByLabelText('Linode').should('be.visible').click();
104+
cy.focused().type(linode.label);
107105

108106
ui.autocompletePopper
109107
.findByTitle(linode.label)

packages/manager/cypress/e2e/core/volumes/clone-volume.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ describe('volume clone flow', () => {
6262
.closest('[data-qa-drawer="true"]')
6363
.should('be.visible')
6464
.within(() => {
65-
cy.findByText('Label').click().type(cloneVolumeLabel);
65+
cy.findByText('Label').click();
66+
cy.focused().type(cloneVolumeLabel);
6667
cy.get('[data-qa-buttons="true"]').within(() => {
6768
cy.findByText('Clone Volume').should('be.visible').click();
6869
});

0 commit comments

Comments
 (0)