Skip to content

Commit bb8ee0b

Browse files
Account for region ID query param in clone test (#9890)
1 parent c5e1324 commit bb8ee0b

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

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

+7-11
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,13 @@ import { cleanUp } from 'support/util/cleanup';
2727
* Returns the Cloud Manager URL to clone a given Linode.
2828
*
2929
* @param linode - Linode for which to retrieve clone URL.
30-
* @param withRegion - Whether to append a region query to the URL.
3130
*
3231
* @returns Cloud Manager Clone URL for Linode.
3332
*/
34-
const getLinodeCloneUrl = (
35-
linode: Linode,
36-
withRegion: boolean = true
37-
): string => {
38-
const regionQuery = withRegion ? `&regionID=${linode.region}` : '';
33+
const getLinodeCloneUrl = (linode: Linode): string => {
34+
const regionQuery = `&regionID=${linode.region}`;
3935
const typeQuery = `&typeID=${linode.type}`;
40-
return `/linodes/create?linodeID=${linode.id}&type=Clone+Linode${typeQuery}${regionQuery}`;
36+
return `/linodes/create?linodeID=${linode.id}${regionQuery}&type=Clone+Linode${typeQuery}`;
4137
};
4238

4339
authenticate();
@@ -69,6 +65,9 @@ describe('clone linode', () => {
6965
mockGetFeatureFlagClientstream().as('getClientStream');
7066

7167
cy.defer(createLinode(linodePayload)).then((linode: Linode) => {
68+
const linodeRegion = getRegionById(linodePayload.region);
69+
const linodeRegionLabel = `${linodeRegion.label} (${linodeRegion.id})`;
70+
7271
interceptCloneLinode(linode.id).as('cloneLinode');
7372
cy.visitWithLogin(`/linodes/${linode.id}`);
7473

@@ -81,10 +80,7 @@ describe('clone linode', () => {
8180
.click();
8281

8382
ui.actionMenuItem.findByTitle('Clone').should('be.visible').click();
84-
85-
// Cloning from Linode Details page does not pre-select a region.
86-
// (Cloning from the Linodes landing does pre-select a region, however.)
87-
cy.url().should('endWith', getLinodeCloneUrl(linode, false));
83+
cy.url().should('endWith', getLinodeCloneUrl(linode));
8884

8985
// Select clone region and Linode type.
9086
ui.regionSelect.find().click();

0 commit comments

Comments
 (0)