Last active
January 13, 2016 12:49
-
-
Save datakurre/c26c1730b1fbff734d98 to your computer and use it in GitHub Desktop.
Failing Selenium test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with import <nixpkgs> { }; | |
let dependencies = rec { | |
selenium = pythonPackages.selenium.overrideDerivation (args: rec { | |
version = "2.48.0"; | |
name = "selenium-${version}"; | |
src = fetchurl { | |
url = "https://pypi.python.org/packages/source/s/selenium/selenium-${version}.tar.gz"; | |
sha256 = "1n0rp6g97rg4154a48yg69vm3f4qybqwz6kqxj1xq5akjm3agp6m"; | |
}; | |
patches = [ | |
(builtins.toFile "fix_profiledir_permissions.patch" '' | |
--- a/py/selenium/webdriver/firefox/firefox_profile.py 2016-01-13 11:32:42.000000000 +0200 | |
+++ b/py/selenium/webdriver/firefox/firefox_profile.py 2016-01-13 11:32:12.000000000 +0200 | |
@@ -76,6 +76,7 @@ | |
shutil.copytree(self.profile_dir, newprof, | |
ignore=shutil.ignore_patterns("parent.lock", "lock", ".parentlock")) | |
self.profile_dir = newprof | |
+ os.chmod(self.profile_dir, 0755) | |
self._read_existing_userjs(os.path.join(self.profile_dir, "user.js")) | |
self.extensionsDir = os.path.join(self.profile_dir, "extensions") | |
self.userPrefs = os.path.join(self.profile_dir, "user.js") | |
'') | |
]; | |
patchPhase = null; | |
postPatch = args.patchPhase; | |
}); | |
robotframework = pythonPackages.robotframework.overrideDerivation(args: rec { | |
version = "3.0"; | |
name = "robotframework-${version}"; | |
src = fetchurl { | |
url = "https://pypi.python.org/packages/source/r/robotframework/robotframework-${version}.tar.gz"; | |
sha256 = "11qwa1y5ph2fh0k2chmrycbnl15m23726x8ar9aagf1i63wga5nd"; | |
}; | |
}); | |
robotframework-selenium2library = pythonPackages.robotframework-selenium2library.overrideDerivation(args: rec { | |
version = "1.7.4"; | |
name = "robotframework-selenium2library-${version}"; | |
src = fetchurl { | |
url = "https://pypi.python.org/packages/source/r/robotframework-selenium2library/robotframework-selenium2library-${version}.tar.gz"; | |
sha256 = "004lmlryhbxd5avbqcgyq2gmscbhp57rrnad9yha8jvf3h1f6cj3"; | |
}; | |
propagatedNativeBuildInputs = [ | |
robotframework | |
selenium | |
pythonPackages.docutils | |
pythonPackages.decorator | |
]; | |
}); | |
test_robot = builtins.toFile "test.robot" '' | |
*** Settings *** | |
Library Selenium2Library | |
Test Teardown Close all browsers | |
*** Test Cases *** | |
Open Firefox | |
Open browser about: browser=firefox | |
Open PhantomJS | |
Open browser about: browser=phantomjs | |
''; | |
}; | |
in with dependencies; stdenv.mkDerivation { | |
name = "test"; | |
buildInputs = [ | |
firefox | |
phantomjs | |
(robotframework.overrideDerivation(args: { | |
propagatedNativeBuildInputs = [ robotframework-selenium2library ]; | |
})) | |
]; | |
builder = writeText "builder.sh" '' | |
source $stdenv/setup | |
pybot ${test_robot} | |
''; | |
shellHook = '' | |
echo pybot ${test_robot} | |
pybot ${test_robot} | |
''; | |
} |
@garbas Found the issue. Selenium injects one of the following libs into LD_LIBARYPATH:
selenium-2.48.0-py2.7.egg/selenium/webdriver/firefox/x86/x_ignore_nofocus.so
selenium-2.48.0-py2.7.egg/selenium/webdriver/firefox/amd64/x_ignore_nofocus.so
If I build Selenium with Nix instead of Buildout, how to fix those to link properly?
Fixed by reusing expressions in nixpkgs.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Not sure if it matters, but stdout from the Popen call by Selenium to open Firefox ends with: