def test_from_string_basic(self): browsers = Browser.from_string("all") self.assertEqual(9, len(browsers)) browsers = Browser.from_string(None) self.assertEqual(None, browsers) browsers = Browser.from_string("") self.assertEqual(None, browsers)
from selenium import webdriver from selenium.webdriver import ActionChains from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.common.exceptions import WebDriverException from acceptance.browser import Browser from datetime import datetime from re import search from acceptance.chime_test_case import ChimeTestCase, rewrite_for_all_browsers # All of this test magic should move somewhere else, but I'm not sure where the somewhere else is yet. BROWSERS_TO_TRY = Browser.from_string(os.environ.get('BROWSERS_TO_TEST', "").strip().lower()) TEST_REPETITIONS = int(os.environ.get('TEST_REPETITIONS', "1")) TEST_RETRY_COUNT = int(os.environ.get('TEST_RETRY_COUNT', "1")) OUTPUT_FILE = os.environ.get('OUTPUT_FILE') class TestPreview(ChimeTestCase): _multiprocess_can_split_ = True def setUp(self): self.email = self.mutate_email(os.environ['TESTING_EMAIL']) self.password = os.environ['TESTING_PASSWORD'] self.host = self.load_hosts_file()[0] self.live_site = 'http://' + self.host if OUTPUT_FILE: self.browser = None
from selenium import webdriver from selenium.webdriver import ActionChains from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.common.exceptions import WebDriverException from acceptance.browser import Browser from datetime import datetime from re import search from acceptance.chime_test_case import ChimeTestCase, rewrite_for_all_browsers # All of this test magic should move somewhere else, but I'm not sure where the somewhere else is yet. BROWSERS_TO_TRY = Browser.from_string( os.environ.get('BROWSERS_TO_TEST', "").strip().lower()) TEST_REPETITIONS = int(os.environ.get('TEST_REPETITIONS', "1")) TEST_RETRY_COUNT = int(os.environ.get('TEST_RETRY_COUNT', "1")) OUTPUT_FILE = os.environ.get('OUTPUT_FILE') class TestPreview(ChimeTestCase): _multiprocess_can_split_ = True def setUp(self): self.email = self.mutate_email(os.environ['TESTING_EMAIL']) self.password = os.environ['TESTING_PASSWORD'] self.host = self.load_hosts_file()[0] self.live_site = 'http://' + self.host if OUTPUT_FILE:
def test_from_string_with_os_and_browser(self): browsers = Browser.from_string("win8.1/ie11") self.assertEqual([Browser('Windows', '8.1', "IE", '11.0')], browsers)
def test_from_string_with_os(self): browsers = Browser.from_string("win8.1") for browser in browsers: self.assertEqual('Windows', browser.os) self.assertEqual('8.1', browser.os_version)
def test_from_string_with_browser(self): browsers = Browser.from_string("ie8") self.assertEqual([Browser('Windows', '7', "IE", '8.0')], browsers) browsers = Browser.from_string("ie11") self.assertEqual([Browser('Windows', '8.1', "IE", '11.0'), Browser('Windows', '7', "IE", '11.0')], browsers)
def test_from_string_supported(self): browsers = Browser.from_string("supported") self.assertEqual(8, len(browsers)) self.assertFalse(Browser('Windows', '8.1', "IE", '11.0') in browsers)
def test_from_string_unknown(self): with self.assertRaises(ValueError): Browser.from_string("arglebargle")