@@ -21,6 +21,7 @@ import {
2121 LINODE_CREATE_TIMEOUT ,
2222} from 'support/constants/linodes' ;
2323import { mockGetLinodeConfigs } from 'support/intercepts/configs' ;
24+ import { interceptEvents } from 'support/intercepts/events' ;
2425import { mockAppendFeatureFlags } from 'support/intercepts/feature-flags' ;
2526import {
2627 interceptCloneLinode ,
@@ -46,7 +47,7 @@ import {
4647} from 'support/util/random' ;
4748import { chooseRegion , extendRegion } from 'support/util/regions' ;
4849
49- import type { Linode } from '@linode/api-v4' ;
50+ import type { Event , Linode } from '@linode/api-v4' ;
5051
5152/**
5253 * Returns the Cloud Manager URL to clone a given Linode.
@@ -78,7 +79,7 @@ describe('clone linode', () => {
7879 */
7980 it ( 'can clone a Linode from Linode details page' , ( ) => {
8081 cy . tag ( 'method:e2e' , 'purpose:dcTesting' ) ;
81- const linodeRegion = chooseRegion ( { capabilities : [ 'Vlans' ] } ) ;
82+ const linodeRegion = chooseRegion ( { capabilities : [ 'Linodes' , ' Vlans'] } ) ;
8283 const linodePayload = createLinodeRequestFactory . build ( {
8384 booted : false ,
8485 label : randomLabel ( ) ,
@@ -96,6 +97,7 @@ describe('clone linode', () => {
9697 createTestLinode ( linodePayload , { securityMethod : 'vlan_no_internet' } )
9798 ) . then ( ( linode : Linode ) => {
9899 interceptCloneLinode ( linode . id ) . as ( 'cloneLinode' ) ;
100+ interceptEvents ( ) . as ( 'cloneEvents' ) ;
99101 cy . visitWithLogin ( `/linodes/${ linode . id } ` ) ;
100102
101103 // Wait for Linode to boot, then initiate clone flow.
@@ -138,9 +140,30 @@ describe('clone linode', () => {
138140 } ) ;
139141
140142 ui . toast . assertMessage ( `Your Linode ${ newLinodeLabel } is being created.` ) ;
141- ui . toast . assertMessage (
142- `Linode ${ linode . label } has been cloned to ${ newLinodeLabel } .` ,
143- { timeout : LINODE_CLONE_TIMEOUT }
143+
144+ // Change the way to check the clone progress due to M3-9860
145+ cy . wait ( '@cloneEvents' ) . then ( ( xhr ) => {
146+ const eventData : Event [ ] = xhr . response ?. body ?. data ;
147+ const cloneEvent = eventData . filter (
148+ ( event : Event ) => event [ 'action' ] === 'linode_clone'
149+ ) ;
150+ cy . get ( '[id="menu-button--notification-events-menu"]' )
151+ . should ( 'be.visible' )
152+ . click ( ) ;
153+ cy . get ( `[data-qa-event="${ cloneEvent [ 0 ] [ 'id' ] } "]` ) . should ( 'be.visible' ) ;
154+ cy . get ( '[data-testid="linear-progress"]' ) . should ( 'be.visible' ) ;
155+ // The progress bar should disappear when the clone is done.
156+ cy . get ( '[data-testid="linear-progress"]' , {
157+ timeout : LINODE_CLONE_TIMEOUT ,
158+ } ) . should ( 'not.exist' ) ;
159+ } ) ;
160+
161+ cy . visit ( '/linodes' ) ;
162+ cy . findByText ( newLinodeLabel , { timeout : LINODE_CLONE_TIMEOUT } ) . should (
163+ 'be.visible'
164+ ) ;
165+ cy . findByText ( linode . label , { timeout : LINODE_CLONE_TIMEOUT } ) . should (
166+ 'be.visible'
144167 ) ;
145168 } ) ;
146169 } ) ;
0 commit comments