@@ -9,6 +9,7 @@ import { hasClass } from './e2e-helper';
99import { protractor } from 'protractor/built/ptor' ;
1010
1111const EC = protractor . ExpectedConditions ;
12+ const WAIT_TIME = 500 ;
1213
1314describe ( 'nb-search' , ( ) => {
1415
@@ -18,47 +19,86 @@ describe('nb-search', () => {
1819
1920 it ( 'should be able to show search-field' , ( ) => {
2021 element ( by . css ( '.start-search' ) ) . click ( ) ;
22+ // TODO: Remove after implementing search animations with angular.
23+ // For now need to wait animation to complete before performing checks.
24+ browser . wait ( EC . visibilityOf ( element ( by . css ( '.search-input' ) ) ) , WAIT_TIME ) ;
2125 expect ( hasClass ( element ( by . css ( 'nb-search-field' ) ) , 'show' ) ) . toBeTruthy ( ) ;
2226 } ) ;
2327
2428 it ( 'should be able to change layout style' , ( ) => {
2529 element ( by . css ( '.start-search' ) ) . click ( ) ;
30+ // TODO: Remove after implementing search animations with angular.
31+ // For now need to wait animation to complete before performing checks.
32+ browser . wait ( EC . visibilityOf ( element ( by . css ( '.search-input' ) ) ) , WAIT_TIME ) ;
2633 expect ( hasClass ( element ( by . css ( 'nb-layout' ) ) , 'with-search' ) ) . toBeTruthy ( ) ;
2734 } ) ;
2835
2936 it ( 'should focus on opened search field' , ( ) => {
3037 element ( by . css ( '.start-search' ) ) . click ( ) ;
38+ // TODO: Remove after implementing search animations with angular.
39+ // For now need to wait animation to complete before performing checks.
40+ browser . wait ( EC . visibilityOf ( element ( by . css ( '.search-input' ) ) ) , WAIT_TIME ) ;
3141 expect ( hasClass ( browser . driver . switchTo ( ) . activeElement ( ) , 'search-input' ) ) . toBeTruthy ( ) ;
3242 } ) ;
3343
3444 it ( 'should be able to close search-field with close button' , ( ) => {
3545 element ( by . css ( '.start-search' ) ) . click ( ) ;
46+ // TODO: Remove after implementing search animations with angular.
47+ // For now need to wait animation to complete before performing checks.
48+ browser . wait ( EC . visibilityOf ( element ( by . css ( '.search-input' ) ) ) , WAIT_TIME ) ;
3649 element ( by . css ( '.search button' ) ) . click ( ) ;
50+ // TODO: Remove after implementing search animations with angular.
51+ // For now need to wait animation to complete before performing checks.
52+ browser . wait ( EC . visibilityOf ( element ( by . css ( '.start-search' ) ) ) , WAIT_TIME ) ;
3753 expect ( hasClass ( element ( by . css ( 'nb-search-field' ) ) , 'show' ) ) . toBeFalsy ( ) ;
3854 } ) ;
3955
4056 it ( 'should remove class from layout when search closed' , ( ) => {
4157 element ( by . css ( '.start-search' ) ) . click ( ) ;
58+ // TODO: Remove after implementing search animations with angular.
59+ // For now need to wait animation to complete before performing checks.
60+ browser . wait ( EC . visibilityOf ( element ( by . css ( '.search-input' ) ) ) , WAIT_TIME ) ;
4261 element ( by . css ( '.search button' ) ) . click ( ) ;
62+ // TODO: Remove after implementing search animations with angular.
63+ // For now need to wait animation to complete before performing checks.
64+ browser . wait ( EC . visibilityOf ( element ( by . css ( '.start-search' ) ) ) , WAIT_TIME ) ;
4365 expect ( hasClass ( element ( by . css ( 'nb-layout' ) ) , 'with-search' ) ) . toBeFalsy ( ) ;
4466 } ) ;
4567
4668 it ( 'should remove focus from input when search closed' , ( ) => {
4769 element ( by . css ( '.start-search' ) ) . click ( ) ;
70+ // TODO: Remove after implementing search animations with angular.
71+ // For now need to wait animation to complete before performing checks.
72+ browser . wait ( EC . visibilityOf ( element ( by . css ( '.search-input' ) ) ) , WAIT_TIME ) ;
4873 element ( by . css ( '.search button' ) ) . click ( ) ;
74+ // TODO: Remove after implementing search animations with angular.
75+ // For now need to wait animation to complete before performing checks.
76+ browser . wait ( EC . visibilityOf ( element ( by . css ( '.start-search' ) ) ) , WAIT_TIME ) ;
4977 expect ( hasClass ( browser . driver . switchTo ( ) . activeElement ( ) , 'search-input' ) ) . toBeFalsy ( ) ;
5078 } ) ;
5179
5280 it ( 'should clean search input when closed' , ( ) => {
5381 element ( by . css ( '.start-search' ) ) . click ( ) ;
82+ // TODO: Remove after implementing search animations with angular.
83+ // For now need to wait animation to complete before performing checks.
84+ browser . wait ( EC . visibilityOf ( element ( by . css ( '.search-input' ) ) ) , WAIT_TIME ) ;
5485 element ( by . css ( '.search-input' ) ) . sendKeys ( 'akveo' ) ;
5586 element ( by . css ( '.search button' ) ) . click ( ) ;
87+ // TODO: Remove after implementing search animations with angular.
88+ // For now need to wait animation to complete before performing checks.
89+ browser . wait ( EC . visibilityOf ( element ( by . css ( '.start-search' ) ) ) , WAIT_TIME ) ;
5690 expect ( element ( by . css ( '.search-input' ) ) . getAttribute ( 'value' ) ) . toEqual ( '' ) ;
5791 } ) ;
5892
5993 it ( 'should be able to close search-field with esc' , ( ) => {
6094 element ( by . css ( '.start-search' ) ) . click ( ) ;
95+ // TODO: Remove after implementing search animations with angular.
96+ // For now need to wait animation to complete before performing checks.
97+ browser . wait ( EC . visibilityOf ( element ( by . css ( '.search-input' ) ) ) , WAIT_TIME ) ;
6198 element ( by . css ( '.search-input' ) ) . sendKeys ( protractor . Key . ESCAPE ) ;
99+ // TODO: Remove after implementing search animations with angular.
100+ // For now need to wait animation to complete before performing checks.
101+ browser . wait ( EC . visibilityOf ( element ( by . css ( '.start-search' ) ) ) , WAIT_TIME ) ;
62102 expect ( hasClass ( element ( by . css ( 'nb-search-field' ) ) , 'show' ) ) . toBeFalsy ( ) ;
63103 expect ( hasClass ( element ( by . css ( 'nb-layout' ) ) , 'with-search' ) ) . toBeFalsy ( ) ;
64104 expect ( hasClass ( browser . driver . switchTo ( ) . activeElement ( ) , 'search-input' ) ) . toBeFalsy ( ) ;
@@ -67,8 +107,14 @@ describe('nb-search', () => {
67107
68108 it ( 'should be able to submit search and close search-field with enter' , ( ) => {
69109 element ( by . css ( '.start-search' ) ) . click ( ) ;
110+ // TODO: Remove after implementing search animations with angular.
111+ // For now need to wait animation to complete before performing checks.
112+ browser . wait ( EC . visibilityOf ( element ( by . css ( '.search-input' ) ) ) , WAIT_TIME ) ;
70113 element ( by . css ( '.search-input' ) ) . sendKeys ( 'akveo' ) ;
71114 element ( by . css ( '.search-input' ) ) . sendKeys ( protractor . Key . ENTER ) ;
115+ // TODO: Remove after implementing search animations with angular.
116+ // For now need to wait animation to complete before performing checks.
117+ browser . wait ( EC . visibilityOf ( element ( by . css ( '.start-search' ) ) ) , WAIT_TIME ) ;
72118 expect ( hasClass ( element ( by . css ( 'nb-search-field' ) ) , 'show' ) ) . toBeFalsy ( ) ;
73119 expect ( hasClass ( element ( by . css ( 'nb-layout' ) ) , 'with-search' ) ) . toBeFalsy ( ) ;
74120 expect ( hasClass ( browser . driver . switchTo ( ) . activeElement ( ) , 'search-input' ) ) . toBeFalsy ( ) ;
@@ -77,6 +123,9 @@ describe('nb-search', () => {
77123
78124 it ( 'should display default hint' , ( ) => {
79125 element ( by . css ( '.start-search' ) ) . click ( ) ;
126+ // TODO: Remove after implementing search animations with angular.
127+ // For now need to wait animation to complete before performing checks.
128+ browser . wait ( EC . visibilityOf ( element ( by . css ( '.search-input' ) ) ) , WAIT_TIME ) ;
80129 expect ( element ( by . css ( '.show .search span' ) ) ) . toBeTruthy ( ) ;
81130
82131 const spanEl = element ( by . css ( '.show .search span' ) ) ;
@@ -87,6 +136,9 @@ describe('nb-search', () => {
87136
88137 it ( 'should display default placeholder' , ( ) => {
89138 element ( by . css ( '.start-search' ) ) . click ( ) ;
139+ // TODO: Remove after implementing search animations with angular.
140+ // For now need to wait animation to complete before performing checks.
141+ browser . wait ( EC . visibilityOf ( element ( by . css ( '.search-input' ) ) ) , WAIT_TIME ) ;
90142 expect ( element ( by . css ( '.search-input' ) ) . getAttribute ( 'placeholder' ) ) . toEqual ( 'Search...' ) ;
91143 } ) ;
92144} ) ;
@@ -99,6 +151,9 @@ describe('nb-search-customized', () => {
99151
100152 it ( 'should display customised hint' , ( ) => {
101153 element ( by . css ( '.start-search' ) ) . click ( ) ;
154+ // TODO: Remove after implementing search animations with angular.
155+ // For now need to wait animation to complete before performing checks.
156+ browser . wait ( EC . visibilityOf ( element ( by . css ( '.search-input' ) ) ) , WAIT_TIME ) ;
102157 expect ( element ( by . css ( '.show .search span' ) ) ) . toBeTruthy ( ) ;
103158
104159 const spanEl = element ( by . css ( '.show .search span' ) ) ;
@@ -109,6 +164,9 @@ describe('nb-search-customized', () => {
109164
110165 it ( 'should display customised placeholder' , ( ) => {
111166 element ( by . css ( '.start-search' ) ) . click ( ) ;
167+ // TODO: Remove after implementing search animations with angular.
168+ // For now need to wait animation to complete before performing checks.
169+ browser . wait ( EC . visibilityOf ( element ( by . css ( '.search-input' ) ) ) , WAIT_TIME ) ;
112170 expect ( element ( by . css ( '.search-input' ) ) . getAttribute ( 'placeholder' ) ) . toEqual ( 'Type here.' ) ;
113171 } ) ;
114172} ) ;
0 commit comments