@@ -10,7 +10,10 @@ const acceptLocationAlertOnMobilesIfPresent = require('../lib/acceptLocationAler
10
10
// See the Mocha API for test structure: https://mochajs.org/
11
11
12
12
describe ( 'Searching a place by name' , function ( ) {
13
+
13
14
it ( 'delivers results' , async function ( ) {
15
+ await browser . setTimeout ( { 'implicit' : 100000 } ) ;
16
+
14
17
await browser . url ( '/' ) ;
15
18
16
19
await acceptLocationAlertOnMobilesIfPresent ( ) ;
@@ -27,14 +30,16 @@ describe('Searching a place by name', function() {
27
30
28
31
const $search = await $ ( '[name="search"]' ) ;
29
32
await $search . click ( ) ;
30
- await browser . waitUntil ( async ( ) => {
31
- const el = await browser . findElement ( 'css selector' , 'a[href="/search?category=food"]' ) ;
32
- return el && el [ IdPropertyName ] ;
33
- } ) ;
34
33
await saveScreenshot ( 'Category and accessibility filter is shown' ) ;
35
34
await ( await $ ( '[name="search"]' ) ) . addValue ( 'alexanderplatz' ) ;
36
35
36
+ await browser . waitUntil ( async ( ) => {
37
+ return $ ( '.search-results' ) . isExisting ( ) ;
38
+ } ) ;
39
+
40
+ browser . findElement ( 'css selector' , '.search-results' ) ;
37
41
const $results = await $ ( '.search-results' ) ;
42
+
38
43
await expect ( $results ) . toBeDisplayedInViewport ( ) ;
39
44
await saveScreenshot ( 'Search results are loading' ) ;
40
45
@@ -48,13 +53,16 @@ describe('Searching a place by name', function() {
48
53
49
54
await saveScreenshot ( 'Search results show their accessibility' ) ;
50
55
56
+ await browser . waitUntil ( async ( ) => {
57
+ return $results . $ ( 'header=Berlin Alexanderplatz' ) . isExisting ( ) ;
58
+ } ) ;
51
59
const $resultAfterSearch = await $results . $ ( 'header=Berlin Alexanderplatz' ) ;
60
+
52
61
await $resultAfterSearch . waitForClickable ( ) ;
53
62
await $resultAfterSearch . click ( ) ;
54
63
55
64
await browser . waitUntil ( async ( ) => ( await getCurrentUrl ( ) ) . match ( / \/ n o d e \/ / ) ) ;
56
- const results = await browser . findElement ( 'css selector' , '.search-results' ) ;
57
- await expect ( results [ IdPropertyName ] ) . toBeUndefined ( ) ;
65
+
58
66
const $placeInfoPanel = await $ ( '.toolbar[aria-label~="Alexanderplatz"' ) ;
59
67
const $placeName = await $placeInfoPanel . $ ( 'h1*=Alexanderplatz' ) ;
60
68
await expect ( $placeName ) . toBeDisplayedInViewport ( ) ;
0 commit comments