Skip to content

Commit

Permalink
fix: Add workarounds for selenium bug (fossasia#2173)
Browse files Browse the repository at this point in the history
Tests are working correctly on local machine,
but in Travis, the click is obscured by overlapping
element because it first scrolls the element into
view and then tries to click on it.

The workaround should be reverted once it is fixed
  • Loading branch information
iamareebjamal authored Feb 29, 2020
1 parent 3d7a629 commit 099a5f6
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/selenium/basePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ const BasePage = {
return el.click();
},

jsClick(el) {
return this.driver.executeScript("arguments[0].click();", el);
},

toggleStarredButton: function() {
return this.find(By.id('starred')).then(this.click);
},
Expand All @@ -55,7 +59,8 @@ const BasePage = {
sessionIds.forEach(function(sessionId) {
const promElem = new Promise(function(resolve, reject) {
self.find(By.id(sessionId)).then(function(el) {
el.findElement(By.className('bookmark')).then(self.click).then(function() {
// TODO: Revert when fixed. Workaround for https://github.com/angular/protractor/issues/3093
self.jsClick(el.findElement(By.className('bookmark'))).then(function() {
resolve('done');
});
});
Expand Down Expand Up @@ -217,8 +222,9 @@ const BasePage = {
const pageVertScrollOffset = 'return window.scrollY';

return new Promise(function(resolve) {
self.find(By.id(sessionTitleId)).then(self.click).then(function() {
self.find(By.id(sessionDetailId)).findElement(By.css('a')).click().then(self.getPageUrl.bind(self)).then(function(url) {
// TODO: Revert when fixed. Workaround for https://github.com/angular/protractor/issues/3093
self.jsClick(self.find(By.id(sessionTitleId))).then(function() {
self.jsClick(self.find(By.id(sessionDetailId)).findElement(By.css('a'))).then(self.getPageUrl.bind(self)).then(function(url) {
self.driver.executeScript(pageVertScrollOffset).then(function(height) {
resolve(height > 0 && url.search('speakers') !== -1);
});
Expand Down

0 comments on commit 099a5f6

Please sign in to comment.