<commit_before># -*- coding: utf-8 -*-
'''
(c) Copyright 2014 Telefonica, I+D. Printed in Spain (Europe). All Rights
Reserved.

The copyright to the software program(s) is property of Telefonica I+D.
The program(s) may be used and or copied only with the express written
consent of Telefonica I+D or in accordance with the terms and conditions
stipulated in the agreement/contract under which the program(s) have
been supplied.
'''
from selenium_tid_python.selenium_test_case import SeleniumTestCase
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium_tid_python import selenium_driver


class AndroidEbookStore(SeleniumTestCase):
    def setUp(self):
        # Updating properties
        config = selenium_driver.config
        if not config.getboolean_optional('Server', 'enabled'):
            previous_browser = config.get('Browser', 'browser')
            config.set('Browser', 'browser', 'android')
            self.addCleanup(config.set, 'Browser', 'browser', previous_browser)
        config.set('AppiumCapabilities', 'automationName', 'Appium')
        config.set('AppiumCapabilities', 'platformName', 'Android')
        config.set('AppiumCapabilities', 'deviceName', 'Android Emulator')
        config.set('AppiumCapabilities', 'browserName', '')
        config.set('AppiumCapabilities', 'app', 'http://qacore02/sites/seleniumExamples/EbookStore.apk')
        super(AndroidEbookStore, self).setUp()

    def test_open_book_by_title(self):
        book_title = "El Nombre de la Rosa"
        wait = WebDriverWait(self.driver, 10)
        wait.until(EC.element_to_be_clickable((By.NAME, book_title))).click()

        # Wait until page has changed
        wait.until(EC.invisibility_of_element_located((By.ID, "user_info")))

        opened_book_title = self.driver.find_element_by_xpath("(//android.widget.TextView)[2]").text
        self.logger.debug("Book title: '" + opened_book_title + "'")
        self.assertEqual(book_title, opened_book_title, "The book title is wrong")<commit_msg>Use wait method from utils class to run tests quickly<commit_after># -*- coding: utf-8 -*-
'''
(c) Copyright 2014 Telefonica, I+D. Printed in Spain (Europe). All Rights
Reserved.

The copyright to the software program(s) is property of Telefonica I+D.
The program(s) may be used and or copied only with the express written
consent of Telefonica I+D or in accordance with the terms and conditions
stipulated in the agreement/contract under which the program(s) have
been supplied.
'''
from selenium_tid_python.selenium_test_case import SeleniumTestCase
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium_tid_python import selenium_driver


class AndroidEbookStore(SeleniumTestCase):
    def setUp(self):
        # Updating properties
        config = selenium_driver.config
        if not config.getboolean_optional('Server', 'enabled'):
            previous_browser = config.get('Browser', 'browser')
            config.set('Browser', 'browser', 'android')
            self.addCleanup(config.set, 'Browser', 'browser', previous_browser)
        config.set('AppiumCapabilities', 'automationName', 'Appium')
        config.set('AppiumCapabilities', 'platformName', 'Android')
        config.set('AppiumCapabilities', 'deviceName', 'Android Emulator')
        config.set('AppiumCapabilities', 'browserName', '')
        config.set('AppiumCapabilities', 'app', 'http://qacore02/sites/seleniumExamples/EbookStore.apk')
        super(AndroidEbookStore, self).setUp()

    def test_open_book_by_title(self):
        book_title = "El Nombre de la Rosa"
        WebDriverWait(self.driver, 10).until(EC.element_to_be_clickable((By.NAME, book_title))).click()

        # Wait until page has changed
        self.utils.wait_until_element_not_visible((By.ID, "user_info"))

        opened_book_title = self.driver.find_element_by_xpath("(//android.widget.TextView)[2]").text
        self.logger.debug("Book title: '" + opened_book_title + "'")
        self.assertEqual(book_title, opened_book_title, "The book title is wrong")
{'fraction_non_alphanumeric': 0.11038200140614014, 'fraction_numerical': 0.004687133817670494, 'mean_word_length': 4.185905224787363, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4650951', 'n_tokens_mistral': 1270, 'n_tokens_neox': 1202, 'n_words': 316}