Skip to content

Commit

Permalink
fix: Fix Cypress failures by cleaning up test Linodes prior to runnin…
Browse files Browse the repository at this point in the history
…g tests (linode#9614)
  • Loading branch information
jdamore-linode authored and TylerWJ committed Sep 5, 2023
1 parent 2840a3f commit 2966d27
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import type { Image, Linode, Disk } from '@linode/api-v4/types';
import type { Linode, Disk } from '@linode/api-v4/types';
import { imageFactory } from 'src/factories/images';
import { authenticate } from 'support/api/authentication';
import { createLinode, deleteLinodeById } from 'support/api/linodes';
import {
mockCreateImage,
mockGetCustomImages,
} from 'support/intercepts/images';
import { mockGetLinodeDisks } from 'support/intercepts/linodes';
import { cleanUp } from 'support/util/cleanup';
import { randomLabel, randomNumber, randomPhrase } from 'support/util/random';

const diskLabel = 'Debian 10 Disk';
Expand All @@ -31,7 +33,12 @@ const mockDisks: Disk[] = [
},
];

authenticate();
describe('create image', () => {
before(() => {
cleanUp('linodes');
});

it('captures image from Linode and mocks create image', () => {
const imageLabel = randomLabel();
const imageDescription = randomPhrase();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable sonarjs/no-duplicate-string */
import { authenticate } from 'support/api/authentication';
import { createLinode, deleteLinodeById } from 'support/api/linodes';
import {
containsClick,
Expand All @@ -8,9 +9,15 @@ import {
getClick,
} from 'support/helpers';
import { ui } from 'support/ui';
import { cleanUp } from 'support/util/cleanup';
import { apiMatcher } from 'support/util/intercepts';

authenticate();
describe('linode backups', () => {
before(() => {
cleanUp('linodes');
});

it('enable backups', () => {
createLinode().then((linode) => {
// intercept request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { authenticate } from 'support/api/authentication';
authenticate();
describe('longview', () => {
before(() => {
cleanUp('longview-clients');
cleanUp(['linodes', 'longview-clients']);
});

it('tests longview', () => {
Expand Down

0 comments on commit 2966d27

Please sign in to comment.