2
2
3
3
import { routeSelectors } from "../../support/routeSelectors" ;
4
4
5
- describe ( "Migrations list" , ( ) => {
5
+ describe ( "Deployments list" , ( ) => {
6
6
beforeEach ( ( ) => {
7
7
cy . setProjectIdCookie ( ) ;
8
8
@@ -20,28 +20,27 @@ describe("Migrations list", () => {
20
20
} ;
21
21
22
22
it ( "renders empty list" , ( ) => {
23
- cy . intercept ( routeSelectors . MIGRATIONS , {
24
- body : { replicas : [ ] } ,
25
- } ) . as ( "migrations " ) ;
23
+ cy . intercept ( routeSelectors . DEPLOYMENTS , {
24
+ body : { deployments : [ ] } ,
25
+ } ) . as ( "deployments " ) ;
26
26
27
- cy . visit ( "/migrations " ) ;
27
+ cy . visit ( "/deployments " ) ;
28
28
waitForAll ( ) ;
29
29
30
- cy . wait ( [ "@migrations " ] ) ;
30
+ cy . wait ( [ "@deployments " ] ) ;
31
31
32
32
cy . get ( "div[class^='MainList__EmptyListMessage']" ) . should (
33
33
"contain.text" ,
34
- "don't have any Migrations in this project"
34
+ "don't have any Deployments in this project"
35
35
) ;
36
- cy . get ( "button" ) . should ( "contain.text" , "Create a Migration" ) ;
37
36
} ) ;
38
37
39
38
it ( "filters list" , ( ) => {
40
- cy . visit ( "/migrations " ) ;
39
+ cy . visit ( "/deployments " ) ;
41
40
waitForAll ( ) ;
42
41
43
42
cy . loadFixtures ( [ "transfers/migrations" ] , ( results : any [ ] ) => {
44
- const migrations = results [ 0 ] . migrations ;
43
+ const deployments = results [ 0 ] . deployments ;
45
44
46
45
cy . get ( "div[class^='MainListFilter__FilterItem']" )
47
46
. contains ( "Running" )
@@ -53,57 +52,57 @@ describe("Migrations list", () => {
53
52
. click ( ) ;
54
53
cy . get ( "div[class^='TransferListItem__Wrapper']" ) . should (
55
54
"have.length" ,
56
- migrations . filter ( r => r . last_execution_status === "ERROR" ) . length
55
+ deployments . filter ( r => r . last_execution_status === "ERROR" ) . length
57
56
) ;
58
57
59
58
cy . get ( "div[class^='MainListFilter__FilterItem']" )
60
59
. contains ( "Completed" )
61
60
. click ( ) ;
62
61
cy . get ( "div[class^='TransferListItem__Wrapper']" ) . should (
63
62
"have.length" ,
64
- migrations . filter ( r => r . last_execution_status === "COMPLETED" ) . length
63
+ deployments . filter ( r => r . last_execution_status === "COMPLETED" ) . length
65
64
) ;
66
65
67
66
cy . get ( "div[class^='MainListFilter__FilterItem']" )
68
67
. contains ( "Canceled" )
69
68
. click ( ) ;
70
69
cy . get ( "div[class^='TransferListItem__Wrapper']" ) . should (
71
70
"have.length" ,
72
- migrations . filter ( r => r . last_execution_status === "CANCELED" ) . length
71
+ deployments . filter ( r => r . last_execution_status === "CANCELED" ) . length
73
72
) ;
74
73
75
74
cy . get ( "div[class^='MainListFilter__FilterItem']" )
76
75
. contains ( "All" )
77
76
. click ( ) ;
78
77
cy . get ( "div[class^='TransferListItem__Wrapper']" ) . should (
79
78
"have.length" ,
80
- migrations . length
79
+ deployments . length
81
80
) ;
82
81
83
82
cy . get ( "div[class^='SearchButton__Wrapper']" ) . click ( ) ;
84
83
cy . get ( "input[class*='SearchInput']" ) . type ( "ol88-uefi" ) ;
85
84
cy . get ( "div[class^='TransferListItem__Wrapper']" ) . should (
86
85
"have.length" ,
87
- migrations . filter ( r => r . instances . find ( i => i . includes ( "ol88-uefi" ) ) )
86
+ deployments . filter ( r => r . instances . find ( i => i . includes ( "ol88-uefi" ) ) )
88
87
. length
89
88
) ;
90
89
cy . get ( "div[class^='TextInput__Close']" ) . click ( ) ;
91
90
} ) ;
92
91
} ) ;
93
92
94
93
it ( "does bulk actions" , ( ) => {
95
- cy . visit ( "/migrations " ) ;
94
+ cy . visit ( "/deployments " ) ;
96
95
waitForAll ( ) ;
97
96
98
97
cy . loadFixtures ( [ "transfers/migrations" ] , ( results : any [ ] ) => {
99
- const migrations : any [ ] = results [ 0 ] . migrations ;
98
+ const deployments : any [ ] = results [ 0 ] . deployments ;
100
99
101
100
cy . get ( "div[class*='TransferListItem__Checkbox']" ) . eq ( 0 ) . click ( ) ;
102
101
cy . get ( "div[class^='SearchButton__Wrapper']" ) . click ( ) ;
103
102
cy . get ( "input[class*='SearchInput']" ) . type ( "ol88-uefi" ) ;
104
103
cy . get ( "div[class^='TransferListItem__Wrapper']" ) . should (
105
104
"have.length" ,
106
- migrations . filter ( r => r . instances . find ( i => i . includes ( "ol88-uefi" ) ) )
105
+ deployments . filter ( r => r . instances . find ( i => i . includes ( "ol88-uefi" ) ) )
107
106
. length
108
107
) ;
109
108
cy . get ( "div[class*='TransferListItem__Checkbox']" ) . eq ( 0 ) . click ( ) ;
@@ -114,29 +113,20 @@ describe("Migrations list", () => {
114
113
115
114
cy . get ( "div[class^='ActionDropdown__Wrapper']" ) . click ( ) ;
116
115
cy . get ( "div[class^='ActionDropdown__ListItem']" )
117
- . contains ( "Recreate Migrations " )
116
+ . contains ( "Recreate Deployments " )
118
117
. click ( ) ;
119
118
cy . get ( "div[class^='AlertModal__Message']" ) . should (
120
119
"contain.text" ,
121
120
"Are you sure you want to recreate"
122
121
) ;
123
122
124
- let postCount = 0 ;
125
- cy . intercept ( "POST" , routeSelectors . MIGRATIONS , req => {
126
- postCount += 1 ;
127
- if ( postCount === 1 ) {
128
- expect ( req . body . migration . instances ) . to . deep . eq ( [
129
- "Datacenter/ol88-bios" ,
130
- ] ) ;
131
- } else if ( postCount === 2 ) {
132
- expect ( req . body . migration . instances ) . to . deep . eq ( [
133
- "Datacenter/ol88-uefi" ,
134
- ] ) ;
135
- }
136
- } ) . as ( "migrations-recreate" ) ;
123
+ cy . intercept ( "POST" , routeSelectors . DEPLOYMENTS , req => {
124
+ expect ( req . body . deployment . transfer_id ,
125
+ "Transfer ID should be present in the request body" ) . to . exist ;
126
+ } ) . as ( "deployments-recreate" ) ;
137
127
138
128
cy . get ( "button" ) . contains ( "Yes" ) . click ( ) ;
139
- cy . wait ( [ "@migrations -recreate" ] ) ;
129
+ cy . wait ( [ "@deployments -recreate" ] ) ;
140
130
} ) ;
141
131
} ) ;
142
132
} ) ;
0 commit comments