1
+ import { colorVariants } from '@trezor/theme' ;
2
+ import { hexToRgba } from '@trezor/utils' ;
3
+
1
4
import { expect , test } from '../../support/fixtures' ;
2
5
3
- const veryDarkGreyColor = 'rgb(23, 23, 23)' ;
4
- const darkGreyColor = 'rgb(31, 31, 31)' ;
5
- const veryLightGreyColor = 'rgb(246, 246, 246)' ;
6
- const lightGreyColor = 'rgb(234, 235, 237)' ;
7
6
enum ColorScheme {
8
7
Light = 'light' ,
9
8
Dark = 'dark' ,
@@ -14,22 +13,22 @@ const testCases = [
14
13
testName : 'Light English' ,
15
14
userPreferences : { colorScheme : ColorScheme . Light } ,
16
15
text : 'Anonymous data collection' ,
17
- textColor : darkGreyColor ,
18
- bodyBackgroundColor : veryLightGreyColor ,
16
+ textColor : colorVariants . standard . textDefault ,
17
+ bodyBackgroundColor : colorVariants . standard . backgroundSurfaceElevation0 ,
19
18
} ,
20
19
{
21
20
testName : 'Dark English' ,
22
21
userPreferences : { colorScheme : ColorScheme . Dark } ,
23
22
text : 'Anonymous data collection' ,
24
- textColor : lightGreyColor ,
25
- bodyBackgroundColor : veryDarkGreyColor ,
23
+ textColor : colorVariants . dark . textDefault ,
24
+ bodyBackgroundColor : colorVariants . dark . backgroundSurfaceElevation0 ,
26
25
} ,
27
26
{
28
27
testName : 'Dark Spanish' ,
29
28
userPreferences : { locale : 'es-ES' , colorScheme : ColorScheme . Dark } ,
30
29
text : 'Recogida de datos anónimos' ,
31
- textColor : lightGreyColor ,
32
- bodyBackgroundColor : veryDarkGreyColor ,
30
+ textColor : colorVariants . dark . textDefault ,
31
+ bodyBackgroundColor : colorVariants . dark . backgroundSurfaceElevation0 ,
33
32
} ,
34
33
] ;
35
34
@@ -40,10 +39,10 @@ testCases.forEach(({ testName, userPreferences, text, textColor, bodyBackgroundC
40
39
test ( testName , async ( { onboardingPage, analyticsSection } ) => {
41
40
await onboardingPage . optionallyDismissFwHashCheckError ( ) ;
42
41
await expect ( analyticsSection . heading ) . toHaveText ( text ) ;
43
- await expect ( analyticsSection . heading ) . toHaveCSS ( 'color' , textColor ) ;
42
+ await expect ( analyticsSection . heading ) . toHaveCSS ( 'color' , hexToRgba ( textColor ) ) ;
44
43
await expect ( onboardingPage . page . locator ( 'body' ) ) . toHaveCSS (
45
44
'background-color' ,
46
- bodyBackgroundColor ,
45
+ hexToRgba ( bodyBackgroundColor ) ,
47
46
) ;
48
47
} ) ;
49
48
} ) ;
0 commit comments