Skip to content

Commit

Permalink
#832 Fix mobile driver capabilities (#833)
Browse files Browse the repository at this point in the history
* Fix mobile driver capabilities. Drop related todo. Add link to mobile emulation chrome guide

* Comment setting of window size for mobile test cases

* Apply linter rules
  • Loading branch information
ArtemijRodionov authored May 2, 2019
1 parent c89b807 commit 53fa1d5
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions shopelectro/tests/tests_selenium_mobile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
If you need to create new test-suite, subclass it from SeleniumTestCase class.
Every Selenium-based test suite uses fixture called dump.json.
"""
import unittest

from django.conf import settings
from django.test import LiveServerTestCase, override_settings, tag
from django.urls import reverse
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC

Expand All @@ -26,17 +25,17 @@ class MobileSeleniumTestCase(LiveServerTestCase):
def setUpClass(cls):
"""Instantiate browser instance."""
super().setUpClass()
capabilities = {
'browserName': 'chrome',
'mobileEmulation': {
'deviceName': 'Apple iPhone 5',
},
}
# http://chromedriver.chromium.org/mobile-emulation
chrome_options = webdriver.ChromeOptions()
chrome_options.add_experimental_option(
'mobileEmulation',
{'deviceName': 'iPhone 6'},
)

cls.browser = SiteDriver(
site_url=cls.live_server_url,
desired_capabilities=capabilities,
desired_capabilities=chrome_options.to_capabilities(),
)
cls.browser.set_window_size(400, 800)
cls.browser.implicitly_wait(10)

@property
Expand Down Expand Up @@ -135,10 +134,6 @@ def test_catalog(self):
)
self.assertTrue(catalog_subitem.is_displayed())

# @todo #826:60m Fix mobile selenium driver. STB2
# The test shows, that the driver is broken.
# Probably we should properly setup desired capabilities of the driver.
@unittest.expectedFailure
def test_tags_collapse_state(self):
"""Tags are collapsed by default."""
self.browser.get(Category.objects.first().url)
Expand Down

1 comment on commit 53fa1d5

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on 53fa1d5 May 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 826-e15bd036 disappeared from shopelectro/tests/tests_selenium_mobile.py, that's why I closed #832. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.

Please sign in to comment.