Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-13353-tests-1770051601619.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Tests
---

Fix flaky clone-linode.spec.ts ([#13353](https://github.com/linode/manager/pull/13353))
40 changes: 10 additions & 30 deletions packages/manager/cypress/e2e/core/linodes/clone-linode.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@
dcPricingMockLinodeTypes,
dcPricingRegionDifferenceNotice,
} from 'support/constants/dc-specific-pricing';
import {
LINODE_CLONE_TIMEOUT,
LINODE_CREATE_TIMEOUT,
} from 'support/constants/linodes';
import { LINODE_CREATE_TIMEOUT } from 'support/constants/linodes';
import { mockGetLinodeConfigs } from 'support/intercepts/configs';
import { interceptEvents } from 'support/intercepts/events';
import { mockAppendFeatureFlags } from 'support/intercepts/feature-flags';
Expand Down Expand Up @@ -47,7 +44,7 @@
} from 'support/util/random';
import { chooseRegion, extendRegion } from 'support/util/regions';

import type { Event, Linode } from '@linode/api-v4';
import type { Linode } from '@linode/api-v4';

/**
* Returns the Cloud Manager URL to clone a given Linode.
Expand Down Expand Up @@ -138,34 +135,17 @@
const newLinodeId = xhr.response?.body?.id;
assert.equal(xhr.response?.statusCode, 200);
cy.url().should('endWith', `linodes/${newLinodeId}/metrics`);
});

ui.toast.assertMessage(`Your Linode ${newLinodeLabel} is being created.`);

// Change the way to check the clone progress due to M3-9860
cy.wait('@cloneEvents').then((xhr) => {
const eventData: Event[] = xhr.response?.body?.data;
const cloneEvent = eventData.filter(
(event: Event) => event['action'] === 'linode_clone'
ui.toast.assertMessage(
`Your Linode ${newLinodeLabel} is being created.`
);
cy.get('[id="menu-button--notification-events-menu"]')
.should('be.visible')
.click();
cy.get(`[data-qa-event="${cloneEvent[0]['id']}"]`).should('be.visible');
cy.get('[data-testid="linear-progress"]').should('be.visible');
// The progress bar should disappear when the clone is done.
cy.get('[data-testid="linear-progress"]', {
timeout: LINODE_CLONE_TIMEOUT,
}).should('not.exist');
// breadcrumb link
cy.get('[data-testid="editable-text').within(() => {

Check warning on line 143 in packages/manager/cypress/e2e/core/linodes/clone-linode.spec.ts

View workflow job for this annotation

GitHub Actions / ESLint Review (manager)

[eslint] reported by reviewdog 🐢 Refactor this code to not nest functions more than 4 levels deep. Raw Output: {"ruleId":"sonarjs/no-nested-functions","severity":1,"message":"Refactor this code to not nest functions more than 4 levels deep.","line":143,"column":57,"nodeType":null,"endLine":143,"endColumn":59}
cy.findByText(newLinodeLabel).should('be.visible');
});
// status of new clone is offline
cy.findByText('OFFLINE').should('be.visible');
});

cy.visit('/linodes');
cy.findByText(newLinodeLabel, { timeout: LINODE_CLONE_TIMEOUT }).should(
'be.visible'
);
cy.findByText(linode.label, { timeout: LINODE_CLONE_TIMEOUT }).should(
'be.visible'
);
});
});

Expand Down