| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
import pytest |
| 19 |
|
| 20 |
from selenium.webdriver.common.options import PageLoadStrategy |
| 21 |
from selenium.webdriver.safari.options import Options |
| 22 |
|
| 23 |
|
| 24 |
@pytest.fixture |
| 25 |
def options(): |
| 26 |
return Options() |
| 27 |
|
| 28 |
|
| 29 |
def test_starts_with_default_capabilities(options): |
| 30 |
from selenium.webdriver import DesiredCapabilities |
| 31 |
|
| 32 |
caps = DesiredCapabilities.SAFARI.copy() |
| 33 |
caps.update({"pageLoadStrategy": PageLoadStrategy.normal}) |
| 34 |
assert options._caps == caps |
| 35 |
|
| 36 |
|
| 37 |
def test_is_a_baseoptions(options): |
| 38 |
from selenium.webdriver.common.options import BaseOptions |
| 39 |
|
| 40 |
assert isinstance(options, BaseOptions) |
| 41 |
|
| 42 |
|
| 43 |
def test_can_set_automatic_inspection(options): |
| 44 |
options.automatic_inspection = True |
| 45 |
assert options.automatic_inspection is True |
| 46 |
assert options._caps.get(Options.AUTOMATIC_INSPECTION) is True |
| 47 |
|
| 48 |
|
| 49 |
def test_can_set_automatic_profiling(options): |
| 50 |
options.automatic_profiling = True |
| 51 |
assert options.automatic_profiling is True |
| 52 |
assert options._caps.get(Options.AUTOMATIC_PROFILING) is True |
| 53 |
|
| 54 |
|
| 55 |
def test_setting_technology_preview_changes_browser_name(options): |
| 56 |
from selenium.webdriver import DesiredCapabilities |
| 57 |
|
| 58 |
BROWSER_NAME = "browserName" |
| 59 |
assert options._caps.get(BROWSER_NAME) == DesiredCapabilities.SAFARI[BROWSER_NAME] |
| 60 |
|
| 61 |
options.use_technology_preview = True |
| 62 |
assert options._caps.get(BROWSER_NAME) == options.SAFARI_TECH_PREVIEW |
| 63 |
|
| 64 |
options.use_technology_preview = False |
| 65 |
assert options._caps.get(BROWSER_NAME) == DesiredCapabilities.SAFARI[BROWSER_NAME] |