1- import { element , by } from 'protractor' ;
1+ import { browser , by , element } from 'protractor' ;
22import { SitePage } from './app.po' ;
33
44describe ( 'site App' , function ( ) {
@@ -11,7 +11,7 @@ describe('site App', function() {
1111 } ) ;
1212
1313 it ( 'should show features text after clicking "Features"' , ( ) => {
14- page . getLink ( 'features' ) . click ( ) ;
14+ page . getTopMenuLink ( 'features' ) . click ( ) ;
1515 expect ( page . getDocViewerText ( ) ) . toMatch ( / P r o g r e s s i v e w e b a p p s / i) ;
1616 } ) ;
1717
@@ -21,7 +21,7 @@ describe('site App', function() {
2121 expect ( page . getDocViewerText ( ) ) . toMatch ( / T u t o r i a l : T o u r o f H e r o e s / i) ;
2222
2323 // navigate to a different page
24- page . getLink ( 'features' ) . click ( ) ;
24+ page . getTopMenuLink ( 'features' ) . click ( ) ;
2525 expect ( page . getDocViewerText ( ) ) . toMatch ( / P r o g r e s s i v e w e b a p p s / i) ;
2626
2727 // Show the menu
@@ -42,6 +42,8 @@ describe('site App', function() {
4242 describe ( 'scrolling to the top' , ( ) => {
4343 it ( 'should scroll to the top when navigating to another page' , ( ) => {
4444 page . navigateTo ( 'guide/security' ) ;
45+ browser . sleep ( 1000 ) ; // Wait for initial async scroll-to-top after `onDocRendered`.
46+
4547 page . scrollToBottom ( ) ;
4648 page . getScrollTop ( ) . then ( scrollTop => expect ( scrollTop ) . toBeGreaterThan ( 0 ) ) ;
4749
@@ -51,6 +53,8 @@ describe('site App', function() {
5153
5254 it ( 'should scroll to the top when navigating to the same page' , ( ) => {
5355 page . navigateTo ( 'guide/security' ) ;
56+ browser . sleep ( 1000 ) ; // Wait for initial async scroll-to-top after `onDocRendered`.
57+
5458 page . scrollToBottom ( ) ;
5559 page . getScrollTop ( ) . then ( scrollTop => expect ( scrollTop ) . toBeGreaterThan ( 0 ) ) ;
5660
@@ -85,7 +89,7 @@ describe('site App', function() {
8589
8690 it ( 'should call ga with new URL on navigation' , done => {
8791 let path : string ;
88- page . getLink ( 'features' ) . click ( ) ;
92+ page . getTopMenuLink ( 'features' ) . click ( ) ;
8993 page . locationPath ( )
9094 . then ( p => path = p )
9195 . then ( ( ) => page . ga ( ) . then ( calls => {
0 commit comments