Skip to content

Commit 8bb6186

Browse files
fix: Fix Cypress failures by cleaning up test Linodes prior to running tests (#9614)
1 parent a189c17 commit 8bb6186

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

packages/manager/cypress/e2e/core/images/smoke-create-image.spec.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
import type { Image, Linode, Disk } from '@linode/api-v4/types';
1+
import type { Linode, Disk } from '@linode/api-v4/types';
22
import { imageFactory } from 'src/factories/images';
3+
import { authenticate } from 'support/api/authentication';
34
import { createLinode, deleteLinodeById } from 'support/api/linodes';
45
import {
56
mockCreateImage,
67
mockGetCustomImages,
78
} from 'support/intercepts/images';
89
import { mockGetLinodeDisks } from 'support/intercepts/linodes';
10+
import { cleanUp } from 'support/util/cleanup';
911
import { randomLabel, randomNumber, randomPhrase } from 'support/util/random';
1012

1113
const diskLabel = 'Debian 10 Disk';
@@ -31,7 +33,12 @@ const mockDisks: Disk[] = [
3133
},
3234
];
3335

36+
authenticate();
3437
describe('create image', () => {
38+
before(() => {
39+
cleanUp('linodes');
40+
});
41+
3542
it('captures image from Linode and mocks create image', () => {
3643
const imageLabel = randomLabel();
3744
const imageDescription = randomPhrase();

packages/manager/cypress/e2e/core/linodes/backup-linode.spec.ts

+7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* eslint-disable sonarjs/no-duplicate-string */
2+
import { authenticate } from 'support/api/authentication';
23
import { createLinode, deleteLinodeById } from 'support/api/linodes';
34
import {
45
containsClick,
@@ -8,9 +9,15 @@ import {
89
getClick,
910
} from 'support/helpers';
1011
import { ui } from 'support/ui';
12+
import { cleanUp } from 'support/util/cleanup';
1113
import { apiMatcher } from 'support/util/intercepts';
1214

15+
authenticate();
1316
describe('linode backups', () => {
17+
before(() => {
18+
cleanUp('linodes');
19+
});
20+
1421
it('enable backups', () => {
1522
createLinode().then((linode) => {
1623
// intercept request

packages/manager/cypress/e2e/core/longview/longview.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { authenticate } from 'support/api/authentication';
1111
authenticate();
1212
describe('longview', () => {
1313
before(() => {
14-
cleanUp('longview-clients');
14+
cleanUp(['linodes', 'longview-clients']);
1515
});
1616

1717
it('tests longview', () => {

0 commit comments

Comments
 (0)