@@ -9,6 +9,7 @@ import { hasClass } from './e2e-helper';
9
9
import { protractor } from 'protractor/built/ptor' ;
10
10
11
11
const EC = protractor . ExpectedConditions ;
12
+ const WAIT_TIME = 500 ;
12
13
13
14
describe ( 'nb-search' , ( ) => {
14
15
@@ -18,47 +19,86 @@ describe('nb-search', () => {
18
19
19
20
it ( 'should be able to show search-field' , ( ) => {
20
21
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 ) ;
21
25
expect ( hasClass ( element ( by . css ( 'nb-search-field' ) ) , 'show' ) ) . toBeTruthy ( ) ;
22
26
} ) ;
23
27
24
28
it ( 'should be able to change layout style' , ( ) => {
25
29
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 ) ;
26
33
expect ( hasClass ( element ( by . css ( 'nb-layout' ) ) , 'with-search' ) ) . toBeTruthy ( ) ;
27
34
} ) ;
28
35
29
36
it ( 'should focus on opened search field' , ( ) => {
30
37
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 ) ;
31
41
expect ( hasClass ( browser . driver . switchTo ( ) . activeElement ( ) , 'search-input' ) ) . toBeTruthy ( ) ;
32
42
} ) ;
33
43
34
44
it ( 'should be able to close search-field with close button' , ( ) => {
35
45
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 ) ;
36
49
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 ) ;
37
53
expect ( hasClass ( element ( by . css ( 'nb-search-field' ) ) , 'show' ) ) . toBeFalsy ( ) ;
38
54
} ) ;
39
55
40
56
it ( 'should remove class from layout when search closed' , ( ) => {
41
57
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 ) ;
42
61
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 ) ;
43
65
expect ( hasClass ( element ( by . css ( 'nb-layout' ) ) , 'with-search' ) ) . toBeFalsy ( ) ;
44
66
} ) ;
45
67
46
68
it ( 'should remove focus from input when search closed' , ( ) => {
47
69
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 ) ;
48
73
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 ) ;
49
77
expect ( hasClass ( browser . driver . switchTo ( ) . activeElement ( ) , 'search-input' ) ) . toBeFalsy ( ) ;
50
78
} ) ;
51
79
52
80
it ( 'should clean search input when closed' , ( ) => {
53
81
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 ) ;
54
85
element ( by . css ( '.search-input' ) ) . sendKeys ( 'akveo' ) ;
55
86
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 ) ;
56
90
expect ( element ( by . css ( '.search-input' ) ) . getAttribute ( 'value' ) ) . toEqual ( '' ) ;
57
91
} ) ;
58
92
59
93
it ( 'should be able to close search-field with esc' , ( ) => {
60
94
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 ) ;
61
98
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 ) ;
62
102
expect ( hasClass ( element ( by . css ( 'nb-search-field' ) ) , 'show' ) ) . toBeFalsy ( ) ;
63
103
expect ( hasClass ( element ( by . css ( 'nb-layout' ) ) , 'with-search' ) ) . toBeFalsy ( ) ;
64
104
expect ( hasClass ( browser . driver . switchTo ( ) . activeElement ( ) , 'search-input' ) ) . toBeFalsy ( ) ;
@@ -67,8 +107,14 @@ describe('nb-search', () => {
67
107
68
108
it ( 'should be able to submit search and close search-field with enter' , ( ) => {
69
109
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 ) ;
70
113
element ( by . css ( '.search-input' ) ) . sendKeys ( 'akveo' ) ;
71
114
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 ) ;
72
118
expect ( hasClass ( element ( by . css ( 'nb-search-field' ) ) , 'show' ) ) . toBeFalsy ( ) ;
73
119
expect ( hasClass ( element ( by . css ( 'nb-layout' ) ) , 'with-search' ) ) . toBeFalsy ( ) ;
74
120
expect ( hasClass ( browser . driver . switchTo ( ) . activeElement ( ) , 'search-input' ) ) . toBeFalsy ( ) ;
@@ -77,6 +123,9 @@ describe('nb-search', () => {
77
123
78
124
it ( 'should display default hint' , ( ) => {
79
125
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 ) ;
80
129
expect ( element ( by . css ( '.show .search span' ) ) ) . toBeTruthy ( ) ;
81
130
82
131
const spanEl = element ( by . css ( '.show .search span' ) ) ;
@@ -87,6 +136,9 @@ describe('nb-search', () => {
87
136
88
137
it ( 'should display default placeholder' , ( ) => {
89
138
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 ) ;
90
142
expect ( element ( by . css ( '.search-input' ) ) . getAttribute ( 'placeholder' ) ) . toEqual ( 'Search...' ) ;
91
143
} ) ;
92
144
} ) ;
@@ -99,6 +151,9 @@ describe('nb-search-customized', () => {
99
151
100
152
it ( 'should display customised hint' , ( ) => {
101
153
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 ) ;
102
157
expect ( element ( by . css ( '.show .search span' ) ) ) . toBeTruthy ( ) ;
103
158
104
159
const spanEl = element ( by . css ( '.show .search span' ) ) ;
@@ -109,6 +164,9 @@ describe('nb-search-customized', () => {
109
164
110
165
it ( 'should display customised placeholder' , ( ) => {
111
166
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 ) ;
112
170
expect ( element ( by . css ( '.search-input' ) ) . getAttribute ( 'placeholder' ) ) . toEqual ( 'Type here.' ) ;
113
171
} ) ;
114
172
} ) ;
0 commit comments