Tuesday, November 29, 2016

View git commits that were not pushed

git log origin.master..HEAD

Fix conflicts for git pull using theirs

Command:

git pull

Output:
error: Pull is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm <file>'
hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.

Solution:
git reset --mixed -> this unstage all files that are in conflict
git add -> all the files that you have fixed fo the conflict
git commit
git reset --hard
git merge --strategy=recursive -X theirs origin/master

Tuesday, November 1, 2016

webdriver-manager not using correct chromedriver after update

PROBLEM:
Command: protractor protractor.conf.js --troubleshoot
I/hosted - Using the selenium server at http://127.0.0.1:4444/wd/hub
I/launcher - Running 1 instances of WebDriver
E/launcher - session not created exception
from unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"1294.1","isDefault":true},"id":1,"name":"","origin":"://"}
  (Session info: chrome=54.0.2840.71)
  (Driver info: chromedriver=2.22.397932 (282ed7cf89cf0053b6542e0d0f039d4123bbb6ad),platform=Linux 4.4.0-45-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 405 milliseconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'sorin-K95VB', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-45-generic', java.version: '1.8.0_91'
Driver info: org.openqa.selenium.chrome.ChromeDriver
E/launcher - SessionNotCreatedError: session not created exception
from unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"1294.1","isDefault":true},"id":1,"name":"","origin":"://"}
  (Session info: chrome=54.0.2840.71)
  (Driver info: chromedriver=2.22.397932 (282ed7cf89cf0053b6542e0d0f039d4123bbb6ad),platform=Linux 4.4.0-45-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 405 milliseconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'sorin-K95VB', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-45-generic', java.version: '1.8.0_91'
Driver info: org.openqa.selenium.chrome.ChromeDriver

SOLUTION
1. Update chromedriver manually to the latest version in our case 2.25
sudo webdriver-manager update --versions.chrome 2.25
2. Start webdriver-manager but old chromedriver is used
webdriver-manager start
 I/start - java -jar /usr/local/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-2.53.1.jar -Djava.security.egd=file:///dev/./urandom -Dwebdriver.chrome.driver=/usr/local/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.22
3. update config.json from /usr/local/lib/node_modules/protractor/node_modules/webdriver-manager/built/config.json and update "chromedriver" to be "2.25"
Sample of /usr/local/lib/node_modules/protractor/node_modules/webdriver-manager/built/config.json
{
  "webdriverVersions": {
    "selenium": "2.53.1",
    "chromedriver": "2.25",
    "iedriver": "2.53.1",
    "androidsdk": "24.4.1",
    "appium": "1.5.3"
  },
  "cdnUrls": {
    "selenium": "https://selenium-release.storage.googleapis.com/",
    "chromedriver": "https://chromedriver.storage.googleapis.com/",
    "iedriver": "https://selenium-release.storage.googleapis.com/",
    "androidsdk": "http://dl.google.com/android/"
  }
}

4. Start again "webdriver-manager start" and correct version of chromedriver is used
I/start - java -jar /usr/local/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-2.53.1.jar -Djava.security.egd=file:///dev/./urandom -Dwebdriver.chrome.driver=/usr/local/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.25