Skip to content

Commit bdabcc0

Browse files
committed
[js] Minor style fixes and updating changelog
1 parent 1eb3d09 commit bdabcc0

File tree

3 files changed

+20
-15
lines changed

3 files changed

+20
-15
lines changed

javascript/node/selenium-webdriver/CHANGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
* Allow users to set the agent used for HTTP connections through
44
`builder.Builder#usingHttpAgent()`
5+
* Added new wait conditions: `until.urlIs()`, `until.urlContains()`,
6+
`until.urlMatches()`
57

68
## v2.53.2
79

javascript/node/selenium-webdriver/lib/until.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -183,34 +183,36 @@ exports.titleMatches = function titleMatches(regex) {
183183
* @param {string} url The expected page url.
184184
* @return {!Condition<boolean>} The new condition.
185185
*/
186-
exports.urlIs = function urlIs(url){
186+
exports.urlIs = function urlIs(url) {
187187
return new Condition(
188-
'for url to be ' + JSON.stringify(url),
189-
function(driver) {
190-
return driver.getCurrentUrl().then(function(u) {
191-
return u === url;
188+
'for URL to be ' + JSON.stringify(url),
189+
function(driver) {
190+
return driver.getCurrentUrl().then(function(u) {
191+
return u === url;
192+
});
192193
});
193-
});
194194
};
195195

196+
196197
/**
197198
* Creates a condition that will wait for the current page's url to contain
198199
* the given substring.
199200
*
200-
* @param {string} substrUrl The substring that should be present in the page
201-
* title.
201+
* @param {string} substrUrl The substring that should be present in the current
202+
* URL.
202203
* @return {!Condition<boolean>} The new condition.
203204
*/
204205
exports.urlContains = function urlContains(substrUrl) {
205206
return new Condition(
206-
'for url to contain ' + JSON.stringify(substrUrl),
207+
'for URL to contain ' + JSON.stringify(substrUrl),
207208
function(driver) {
208209
return driver.getCurrentUrl().then(function(url) {
209210
return url.indexOf(substrUrl) !== -1;
210211
});
211-
});
212+
});
212213
};
213214

215+
214216
/**
215217
* Creates a condition that will wait for the current page's url to match the
216218
* given regular expression.
@@ -219,7 +221,7 @@ exports.urlContains = function urlContains(substrUrl) {
219221
* @return {!Condition<boolean>} The new condition.
220222
*/
221223
exports.urlMatches = function urlMatches(regex) {
222-
return new Condition('for url to match ' + regex, function(driver) {
224+
return new Condition('for URL to match ' + regex, function(driver) {
223225
return driver.getCurrentUrl().then(function(url) {
224226
return regex.test(url);
225227
});

javascript/node/selenium-webdriver/test/lib/until_test.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ describe('until', function() {
174174
assert.deepStrictEqual(titles, ['google']);
175175
});
176176
});
177-
177+
178178
it('testUntilUrlIs', function() {
179179
var urls = ['http://www.foo.com', 'https://boo.com', 'http://docs.yes.com'];
180180
executor.on(CommandName.GET_CURRENT_URL, () => urls.shift());
@@ -183,16 +183,17 @@ describe('until', function() {
183183
assert.deepStrictEqual(urls, ['http://docs.yes.com']);
184184
});
185185
});
186-
186+
187187
it('testUntilUrlContains', function() {
188-
var urls = ['http://foo.com', 'https://groups.froogle.com', 'http://google.com'];
188+
var urls =
189+
['http://foo.com', 'https://groups.froogle.com', 'http://google.com'];
189190
executor.on(CommandName.GET_CURRENT_URL, () => urls.shift());
190191

191192
return driver.wait(until.urlContains('oogle.com'), 3000).then(function() {
192193
assert.deepStrictEqual(urls, ['http://google.com']);
193194
});
194195
});
195-
196+
196197
it('testUntilUrlMatches', function() {
197198
var urls = ['foo', 'froogle', 'aaaabc', 'aabbbc', 'google'];
198199
executor.on(CommandName.GET_CURRENT_URL, () => urls.shift());

0 commit comments

Comments
 (0)