@@ -265,6 +265,49 @@ export class ExpectedConditions {
265
265
} ;
266
266
}
267
267
268
+ /**
269
+ * An expectation for checking that the URL contains a case-sensitive
270
+ * substring.
271
+ *
272
+ * @example
273
+ * var EC = protractor.ExpectedConditions;
274
+ * // Waits for the URL to contain 'foo'.
275
+ * browser.wait(EC.urlContains('foo'), 5000);
276
+ *
277
+ * @param {!string } url The fragment of URL expected
278
+ *
279
+ * @return {!function } An expected condition that returns a promise
280
+ * representing whether the URL contains the string.
281
+ */
282
+ urlContains ( url : string ) : Function {
283
+ return ( ) => {
284
+ return protractor . browser . driver . getCurrentUrl ( ) . then (
285
+ ( actualUrl : string ) : boolean => {
286
+ return actualUrl . indexOf ( url ) > - 1 ;
287
+ } ) ;
288
+ } ;
289
+ }
290
+
291
+ /**
292
+ * An expectation for checking the URL of a page.
293
+ *
294
+ * @example
295
+ * var EC = protractor.ExpectedConditions;
296
+ * // Waits for the URL to be 'foo'.
297
+ * browser.wait(EC.urlIs('foo'), 5000);
298
+ *
299
+ * @param {!string } url The expected URL, which must be an exact match.
300
+ *
301
+ * @return {!function } An expected condition that returns a promise
302
+ * representing whether the url equals the string.
303
+ */
304
+ urlIs ( url : string ) : Function {
305
+ return ( ) => {
306
+ return protractor . browser . driver . getCurrentUrl ( ) . then (
307
+ ( actualUrl : string ) : boolean => { return actualUrl === url ; } ) ;
308
+ } ;
309
+ }
310
+
268
311
/**
269
312
* An expectation for checking that an element is present on the DOM
270
313
* of a page. This does not necessarily mean that the element is visible.
0 commit comments