From 1cbacd25bbaec8f987d74534180755f7f6b78540 Mon Sep 17 00:00:00 2001 From: Mikayel Mikirtumov Date: Thu, 9 Mar 2017 11:08:52 +0400 Subject: [PATCH 1/4] feat: Add reload function wich will send Referer feat(lib\browser.ts): Add reload function wich will send Referer Ticket number for mentioned feature is: Browser.refresh function does not keep Referer and other header parameters. #4140 https://github.com/angular/protractor/issues/4140 --- lib/browser.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/browser.ts b/lib/browser.ts index a43f82e6a..babb98991 100644 --- a/lib/browser.ts +++ b/lib/browser.ts @@ -1014,6 +1014,23 @@ export class ProtractorBrowser extends AbstractExtendedWebDriver { }); } + /** + * @see webdriver.WebDriver.refresh + * + * Makes a reload of the current page. + * + * Method calls location.reload function of browsers + */ + reload() { + if (this.ignoreSynchronization) { + return this.driver.navigate().refresh(); + } + + return this + .executeScriptWithDescription( + 'return location.reload()', 'Protractor reload page'); + } + /** * Mixin navigation methods back into the navigation object so that * they are invoked as before, i.e. driver.navigate().refresh() From a46bcc7a466a9aec5b77b6e88781ee367d373c39 Mon Sep 17 00:00:00 2001 From: Mikayel Mikirtumov Date: Tue, 5 Sep 2017 18:23:23 +0300 Subject: [PATCH 2/4] docs(element): fix minor typo in element.ts --- lib/element.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/element.ts b/lib/element.ts index af4283e10..c2daca593 100644 --- a/lib/element.ts +++ b/lib/element.ts @@ -251,8 +251,8 @@ export class ElementArrayFinder extends WebdriverWebElement { } /** - * Get an element within the ElementArrayFinder by index. The index starts at - * 0\. Negative indices are wrapped (i.e. -i means ith element from last) + * Get an element within the ElementArrayFinder by index. The index starts at 0. + * Negative indices are wrapped (i.e. -i means ith element from last) * This does not actually retrieve the underlying element. * * @alias element.all(locator).get(index) From b908f3ace6bb7aa32eb32157cff8640d839db7ed Mon Sep 17 00:00:00 2001 From: mmikirtumov Date: Sun, 30 Jun 2019 09:49:58 +0200 Subject: [PATCH 3/4] Fix reload formating issue --- lib/browser.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/browser.ts b/lib/browser.ts index 1fc2e84a8..1041572bb 100644 --- a/lib/browser.ts +++ b/lib/browser.ts @@ -850,14 +850,12 @@ export class ProtractorBrowser { * * Method calls location.reload function of browsers */ - reload() { - if (this.ignoreSynchronization) { + async reload() { + if (!await this.waitForAngularEnabled()) { return this.driver.navigate().refresh(); } - return this - .executeScriptWithDescription( - 'return location.reload()', 'Protractor reload page'); + return this.executeScriptWithDescription('return location.reload()', 'Protractor reload page'); } /** From a7cd1b25f6140ed8a70a4de3a45973f4bf4ac1f1 Mon Sep 17 00:00:00 2001 From: mmikirtumov Date: Sun, 30 Jun 2019 09:54:31 +0200 Subject: [PATCH 4/4] Fix the linter --- lib/browser.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/browser.ts b/lib/browser.ts index 1041572bb..f40db4a79 100644 --- a/lib/browser.ts +++ b/lib/browser.ts @@ -854,7 +854,7 @@ export class ProtractorBrowser { if (!await this.waitForAngularEnabled()) { return this.driver.navigate().refresh(); } - + return this.executeScriptWithDescription('return location.reload()', 'Protractor reload page'); }