@@ -10,10 +10,10 @@ import {
1010 SiteCustomizationSettings , 
1111}  from  '@gitbook/api' ; 
1212import  {  test ,  expect ,  Page  }  from  '@playwright/test' ; 
13+ import  deepMerge  from  'deepmerge' ; 
1314import  jwt  from  'jsonwebtoken' ; 
1415import  rison  from  'rison' ; 
1516import  {  DeepPartial  }  from  'ts-essentials' ; 
16- import  deepMerge  from  'deepmerge' ; 
1717
1818import  {  getContentTestURL  }  from  '../tests/utils' ; 
1919
@@ -930,6 +930,94 @@ const testCases: TestsCase[] = [
930930 } , 
931931 ] , 
932932 } , 
933+  { 
934+  name : 'Adaptive Content - VA' , 
935+  baseUrl : `https://gitbook-open-e2e-sites.gitbook.io/adaptive-content-va/` , 
936+  tests : [ 
937+  { 
938+  name : 'isAlphaUser' , 
939+  url : ( ( )  =>  { 
940+  const  privateKey  =  'afe09cdf-0f43-480a-b54c-8b1f62f174f9' ; 
941+  const  token  =  jwt . sign ( 
942+  { 
943+  name : 'gitbook-open-tests' , 
944+  isAlphaUser : true , 
945+  } , 
946+  privateKey , 
947+  { 
948+  expiresIn : '24h' , 
949+  } , 
950+  ) ; 
951+  return  `?jwt_token=${ token }  ; 
952+  } ) ( ) , 
953+  run : async  ( page )  =>  { 
954+  const  alphaUserPage  =  page 
955+  . locator ( 'a[class*="group\\/toclink"]' ) 
956+  . filter ( {  hasText : 'Alpha users'  } ) ; 
957+  const  betaUserPage  =  page 
958+  . locator ( 'a[class*="group\\/toclink"]' ) 
959+  . filter ( {  hasText : 'Beta users'  } ) ; 
960+  await  expect ( alphaUserPage ) . toBeVisible ( ) ; 
961+  await  expect ( betaUserPage ) . toHaveCount ( 0 ) ; 
962+  } , 
963+  } , 
964+  { 
965+  name : 'isBetaUser' , 
966+  url : ( ( )  =>  { 
967+  const  privateKey  =  'afe09cdf-0f43-480a-b54c-8b1f62f174f9' ; 
968+  const  token  =  jwt . sign ( 
969+  { 
970+  name : 'gitbook-open-tests' , 
971+  isBetaUser : true , 
972+  } , 
973+  privateKey , 
974+  { 
975+  expiresIn : '24h' , 
976+  } , 
977+  ) ; 
978+  return  `?jwt_token=${ token }  ; 
979+  } ) ( ) , 
980+  run : async  ( page )  =>  { 
981+  const  alphaUserPage  =  page 
982+  . locator ( 'a[class*="group\\/toclink"]' ) 
983+  . filter ( {  hasText : 'Alpha users'  } ) ; 
984+  const  betaUserPage  =  page 
985+  . locator ( 'a[class*="group\\/toclink"]' ) 
986+  . filter ( {  hasText : 'Beta users'  } ) ; 
987+  await  expect ( betaUserPage ) . toBeVisible ( ) ; 
988+  await  expect ( alphaUserPage ) . toHaveCount ( 0 ) ; 
989+  } , 
990+  } , 
991+  { 
992+  name : 'isAlphaUser & isBetaUser' , 
993+  url : ( ( )  =>  { 
994+  const  privateKey  =  'afe09cdf-0f43-480a-b54c-8b1f62f174f9' ; 
995+  const  token  =  jwt . sign ( 
996+  { 
997+  name : 'gitbook-open-tests' , 
998+  isAlphaUser : true , 
999+  isBetaUser : true , 
1000+  } , 
1001+  privateKey , 
1002+  { 
1003+  expiresIn : '24h' , 
1004+  } , 
1005+  ) ; 
1006+  return  `?jwt_token=${ token }  ; 
1007+  } ) ( ) , 
1008+  run : async  ( page )  =>  { 
1009+  const  alphaUserPage  =  page 
1010+  . locator ( 'a[class*="group\\/toclink"]' ) 
1011+  . filter ( {  hasText : 'Alpha users'  } ) ; 
1012+  const  betaUserPage  =  page 
1013+  . locator ( 'a[class*="group\\/toclink"]' ) 
1014+  . filter ( {  hasText : 'Beta users'  } ) ; 
1015+  await  expect ( alphaUserPage ) . toBeVisible ( ) ; 
1016+  await  expect ( betaUserPage ) . toBeVisible ( ) ; 
1017+  } , 
1018+  } , 
1019+  ] , 
1020+  } , 
9331021] ; 
9341022
9351023for  ( const  testCase  of  testCases )  { 
0 commit comments