-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* adding a failing mocked unit test * adding a fix
- Loading branch information
Showing
2 changed files
with
15 additions
and
1 deletion.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from unittest.mock import patch, MagicMock | ||
from pylenium import webdriver_factory | ||
|
||
|
||
def test_235_webdriver_factory(tmpdir): | ||
file_to_use = tmpdir / "file" | ||
file_to_use.write("test") | ||
gecko_mock = MagicMock() | ||
gecko_mock.install.return_value = file_to_use | ||
with patch("pylenium.webdriver_factory.GeckoDriverManager", return_value=gecko_mock): | ||
with patch("pylenium.webdriver_factory.webdriver.firefox.webdriver.Service"): | ||
with patch("pylenium.webdriver_factory.webdriver.firefox.webdriver.RemoteWebDriver"): | ||
webdriver_factory.build_firefox("latest", ["headless"], {}, [], [], "", {}) | ||
gecko_mock.install.assert_called_once() |
c3660fb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still can't use Firefox browser, the error is below:
` with os.scandir(src) as itr:
E NotADirectoryError: [Errno 20] Not a directory: '.../.wdm/drivers/geckodriver/macos/v0.30.0/geckodriver'
/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/shutil.py:564: NotADirectoryError`
but in about folder, I already saw driver is downloaded:
and my config is below:
{
"driver": {
"browser": "firefox",
"remote_url": "",
"wait_time": 10,
"page_load_wait_time": 0,
"options": [],
"capabilities": {},
"version": "latest",
"experimental_options": null,
"extension_paths": [],
"webdriver_kwargs": {},
"local_path": ""
},
"logging": {
"screenshots_on": false
},
"viewport": {
"maximize": true,
"width": 1440,
"height": 900,
"orientation": "portrait"
}
}
c3660fb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.