Repository: fidals/shopelectro

Issue:
Fix inconsistent tag toggle indicator
<img width="266" alt="изображение" src="https://user-images.githubusercontent.com/13870342/56904860-d2c94800-6aa7-11e9-9329-3e32963bd8ee.png">
<img width="273" alt="изображение" src="https://user-images.githubusercontent.com/13870342/56904935-f68c8e00-6aa7-11e9-91b4-8ce46c9aa83d.png">
 


Discussion:

Resolving patch:
diff --git a/shopelectro/settings/base.py b/shopelectro/settings/base.py
--- a/shopelectro/settings/base.py
+++ b/shopelectro/settings/base.py
@@ -81,7 +81,7 @@
 # https://docs.djangoproject.com/en/1.11/ref/middleware/#middleware-ordering
 MIDDLEWARE = [
     'django.middleware.security.SecurityMiddleware',
-    'django.middleware.cache.UpdateCacheMiddleware',
+    # 'django.middleware.cache.UpdateCacheMiddleware',
     'django.contrib.sessions.middleware.SessionMiddleware',
     'django.middleware.locale.LocaleMiddleware',
     'django.middleware.common.CommonMiddleware',
@@ -89,7 +89,7 @@
     'django.contrib.auth.middleware.AuthenticationMiddleware',
     'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
     'django.contrib.messages.middleware.MessageMiddleware',
-    'django.middleware.cache.FetchFromCacheMiddleware',
+    # 'django.middleware.cache.FetchFromCacheMiddleware',
     'django.middleware.clickjacking.XFrameOptionsMiddleware',
     'django_user_agents.middleware.UserAgentMiddleware',
     'debug_toolbar.middleware.DebugToolbarMiddleware',


Test patch:
diff --git a/shopelectro/tests/tests_selenium_mobile.py b/shopelectro/tests/tests_selenium_mobile.py
--- a/shopelectro/tests/tests_selenium_mobile.py
+++ b/shopelectro/tests/tests_selenium_mobile.py
@@ -4,6 +4,8 @@
 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
@@ -11,7 +13,7 @@
 from selenium.webdriver.support import expected_conditions as EC
 
 from shopelectro.selenium import SiteDriver
-from shopelectro.models import Product
+from shopelectro.models import Category, Product
 
 
 class MobileSeleniumTestCase(LiveServerTestCase):
@@ -69,7 +71,7 @@ def search_input(self):
             (By.CLASS_NAME, 'js-search-input')
         ))
 
-    def toogle_menu(self):
+    def toggle_menu(self):
         self.wait.until(EC.element_to_be_clickable(
             (By.CLASS_NAME, 'js-mobile-menu-toggler')
         )).click()
@@ -89,12 +91,12 @@ def test_ui(self):
         - bottom fixed mobile cart;
         - off-canvas menu search input;
         """
-        self.toogle_menu()
+        self.toggle_menu()
         self.assertTrue(self.search_input.is_displayed())
 
     def test_search_autocomplete(self):
         """Autocomplete in mobile search should work."""
-        self.toogle_menu()
+        self.toggle_menu()
         self.search_input.send_keys('Cate')
         suggestions = self.wait.until(EC.visibility_of_any_elements_located(
             (By.CLASS_NAME, 'autocomplete-suggestion')
@@ -105,7 +107,7 @@ def test_search_autocomplete(self):
 
     def test_search_submit(self):
         """Mobile search form has submit button."""
-        self.toogle_menu()
+        self.toggle_menu()
         self.search_input.send_keys('Cate')
         self.submit_search()
         result, *_ = self.wait.until(EC.visibility_of_any_elements_located(
@@ -133,6 +135,21 @@ 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)
+        self.wait_page_loading()
+
+        tags = self.browser.wait.until(EC.presence_of_all_elements_located(
+            (By.CLASS_NAME, 'js-tags-inputs')
+        ))
+
+        self.assertFalse(any(t.is_displayed() for t in tags))
+
     # CarrotQuest outer js service produces error on this test.
     # Enabled debug makes it off.
     @override_settings(DEBUG=True, INTERNAL_IPS=tuple())