@@ -53,13 +53,30 @@ const ensureSupportPhoneIsFilled = async ( page: Page ) => {
53
53
}
54
54
} ;
55
55
56
+ const expectSnackbarWithText = async (
57
+ page : Page ,
58
+ expectedText : string ,
59
+ timeout = 10000
60
+ ) => {
61
+ await expect (
62
+ page . locator ( '.components-snackbar__content' , {
63
+ hasText : expectedText ,
64
+ } )
65
+ ) . toBeVisible ( {
66
+ timeout : timeout ,
67
+ } ) ;
68
+ } ;
69
+
56
70
export const saveWooPaymentsSettings = async ( page : Page ) => {
57
71
await ensureSupportPhoneIsFilled ( page ) ;
58
72
59
73
await page . getByRole ( 'button' , { name : 'Save changes' } ) . click ( ) ;
60
- await expect ( page . getByLabel ( 'Dismiss this notice' ) ) . toBeVisible ( {
61
- timeout : 10000 ,
62
- } ) ;
74
+ await expectSnackbarWithText ( page , 'Settings saved.' ) ;
75
+ } ;
76
+
77
+ export const saveMultiCurrencySettings = async ( page : Page ) => {
78
+ await page . getByRole ( 'button' , { name : 'Save changes' } ) . click ( ) ;
79
+ await expectSnackbarWithText ( page , 'Currency settings updated.' ) ;
63
80
} ;
64
81
65
82
export const isMulticurrencyEnabled = async ( page : Page ) => {
@@ -122,9 +139,7 @@ export const addMulticurrencyWidget = async ( page: Page ) => {
122
139
page . getByRole ( 'button' , { name : 'Update' } )
123
140
) . toBeEnabled ( ) ;
124
141
await page . getByRole ( 'button' , { name : 'Update' } ) . click ( ) ;
125
- await expect ( page . getByLabel ( 'Dismiss this notice' ) ) . toBeVisible ( {
126
- timeout : 10000 ,
127
- } ) ;
142
+ await expectSnackbarWithText ( page , 'Widgets saved.' ) ;
128
143
}
129
144
} ;
130
145
@@ -171,7 +186,9 @@ export const disableAllEnabledCurrencies = async ( page: Page ) => {
171
186
. first ( )
172
187
. click ( ) ;
173
188
174
- const snackbar = await page . getByLabel ( 'Dismiss this notice' ) ;
189
+ const snackbar = await page . locator ( '.components-snackbar__content' , {
190
+ hasText : 'Enabled currencies updated.' ,
191
+ } ) ;
175
192
176
193
await expect ( snackbar ) . toBeVisible ( { timeout : 10000 } ) ;
177
194
await snackbar . click ( ) ;
@@ -197,9 +214,7 @@ export const addCurrency = async ( page: Page, currencyCode: string ) => {
197
214
}
198
215
199
216
await page . getByRole ( 'button' , { name : 'Update selected' } ) . click ( ) ;
200
- await expect ( page . getByLabel ( 'Dismiss this notice' ) ) . toBeVisible ( {
201
- timeout : 10000 ,
202
- } ) ;
217
+ await expectSnackbarWithText ( page , 'Enabled currencies updated.' ) ;
203
218
await expect (
204
219
page . locator ( `li.enabled-currency.${ currencyCode . toLowerCase ( ) } ` )
205
220
) . toBeVisible ( ) ;
@@ -219,9 +234,7 @@ export const removeCurrency = async ( page: Page, currencyCode: string ) => {
219
234
`li.enabled-currency.${ currencyCode . toLowerCase ( ) } .enabled-currency__action.delete`
220
235
)
221
236
. click ( ) ;
222
- await expect ( page . getByLabel ( 'Dismiss this notice' ) ) . toBeVisible ( {
223
- timeout : 10000 ,
224
- } ) ;
237
+ await expectSnackbarWithText ( page , 'Enabled currencies updated.' ) ;
225
238
await expect (
226
239
page . locator ( `li.enabled-currency.${ currencyCode . toLowerCase ( ) } ` )
227
240
) . toBeHidden ( ) ;
@@ -247,7 +260,7 @@ export const setCurrencyRate = async (
247
260
. locator ( '#single-currency-settings__manual_rate_radio' )
248
261
. click ( ) ;
249
262
await page . getByTestId ( 'manual_rate_input' ) . fill ( rate ) ;
250
- await saveWooPaymentsSettings ( page ) ;
263
+ await saveMultiCurrencySettings ( page ) ;
251
264
} ;
252
265
253
266
export const setCurrencyPriceRounding = async (
@@ -257,7 +270,7 @@ export const setCurrencyPriceRounding = async (
257
270
) => {
258
271
await editCurrency ( page , currencyCode ) ;
259
272
await page . getByTestId ( 'price_rounding' ) . selectOption ( rounding ) ;
260
- await saveWooPaymentsSettings ( page ) ;
273
+ await saveMultiCurrencySettings ( page ) ;
261
274
} ;
262
275
263
276
export const setCurrencyCharmPricing = async (
@@ -267,7 +280,7 @@ export const setCurrencyCharmPricing = async (
267
280
) => {
268
281
await editCurrency ( page , currencyCode ) ;
269
282
await page . getByTestId ( 'price_charm' ) . selectOption ( charmPricing ) ;
270
- await saveWooPaymentsSettings ( page ) ;
283
+ await saveMultiCurrencySettings ( page ) ;
271
284
} ;
272
285
273
286
export const enablePaymentMethods = async (
0 commit comments