@@ -18,53 +18,55 @@ const credentials = {
18
18
// apiKey: `${process.env.ALGOLIA_SEARCH_KEY_1}`
19
19
} ;
20
20
21
- describe ( "answers features - algoliasearch.com" , ( ) => {
22
- beforeEach ( async ( ) => browser . url ( "algoliasearch.com" ) ) ;
21
+ [ "algoliasearch-lite.com" , "algoliasearch.com" ] . forEach ( preset => {
22
+ describe ( `answers features - ${ preset } ` , ( ) => {
23
+ beforeEach ( async ( ) => browser . url ( preset ) ) ;
23
24
24
- it ( "searchIndex::findAnswers" , async ( ) => {
25
- const results : any = await browser . executeAsync ( function (
26
- credentials ,
27
- done
28
- ) {
29
- const client = algoliasearch ( credentials . appId , credentials . apiKey ) ;
25
+ it ( "searchIndex::findAnswers" , async ( ) => {
26
+ const results : any = await browser . executeAsync ( function (
27
+ credentials ,
28
+ done
29
+ ) {
30
+ const client = algoliasearch ( credentials . appId , credentials . apiKey ) ;
30
31
31
- // TODO: remove this customization once the engine accepts url encoded query params
32
- client . transporter . userAgent . value = "answers-test" ;
32
+ // TODO: remove this customization once the engine accepts url encoded query params
33
+ client . transporter . userAgent . value = "answers-test" ;
33
34
34
- const index = client . initIndex ( "ted" ) ;
35
+ const index = client . initIndex ( "ted" ) ;
35
36
36
- Promise . all ( [
37
- index . findAnswers ( "sir ken robinson" , [ "en" ] ) ,
38
- index . findAnswers ( "what" , [ "en" ] ) ,
39
- index . findAnswers ( "sarah jones" , [ "en" ] , {
40
- nbHits : 2 ,
41
- attributesForPrediction : [ "main_speaker" ] ,
42
- params : {
43
- highlightPreTag : "_pre_" ,
44
- highlightPostTag : "_post_"
45
- }
46
- } )
47
- ] ) . then ( function ( responses ) {
48
- done ( {
49
- kenRobinson : responses [ 0 ] ,
50
- what : responses [ 1 ] ,
51
- sarah : responses [ 2 ]
37
+ Promise . all ( [
38
+ index . findAnswers ( "sir ken robinson" , [ "en" ] ) ,
39
+ index . findAnswers ( "what" , [ "en" ] ) ,
40
+ index . findAnswers ( "sarah jones" , [ "en" ] , {
41
+ nbHits : 2 ,
42
+ attributesForPrediction : [ "main_speaker" ] ,
43
+ params : {
44
+ highlightPreTag : "_pre_" ,
45
+ highlightPostTag : "_post_"
46
+ }
47
+ } )
48
+ ] ) . then ( function ( responses ) {
49
+ done ( {
50
+ kenRobinson : responses [ 0 ] ,
51
+ what : responses [ 1 ] ,
52
+ sarah : responses [ 2 ]
53
+ } ) ;
52
54
} ) ;
53
- } ) ;
54
- } ,
55
- credentials ) ;
55
+ } ,
56
+ credentials ) ;
56
57
57
- expect ( results . kenRobinson . nbHits ) . toBe ( 10 ) ;
58
+ expect ( results . kenRobinson . nbHits ) . toBe ( 10 ) ;
58
59
59
- expect ( results . what . nbHits ) . toBe ( 0 ) ;
60
+ expect ( results . what . nbHits ) . toBe ( 0 ) ;
60
61
61
- expect ( results . sarah . nbHits ) . toBe ( 1 ) ;
62
- expect ( results . sarah . hits [ 0 ] . _highlightResult . main_speaker . value ) . toBe (
63
- "_pre_Sarah_post_ _pre_Jones_post_"
64
- ) ;
62
+ expect ( results . sarah . nbHits ) . toBe ( 1 ) ;
63
+ expect ( results . sarah . hits [ 0 ] . _highlightResult . main_speaker . value ) . toBe (
64
+ "_pre_Sarah_post_ _pre_Jones_post_"
65
+ ) ;
65
66
66
- expect ( results . sarah . hits [ 0 ] . _answer . extract ) . toBe (
67
- "_pre_Sarah_post_ _pre_Jones_post_"
68
- ) ;
67
+ expect ( results . sarah . hits [ 0 ] . _answer . extract ) . toBe (
68
+ "_pre_Sarah_post_ _pre_Jones_post_"
69
+ ) ;
70
+ } ) ;
69
71
} ) ;
70
72
} ) ;
0 commit comments