<commit_before># coding: utf8
import time

from .base import LbbSeleniumTestCase


class TestResults(LbbSeleniumTestCase):

    def test_toggle_office_details(self):
        """
        Tests the toggle mechanism of the `results` page.
        """
        url = self.url_for('search.results', city='metz', zipcode='57000', occupation='comptabilite')
        self.driver.get(url)

        # Get the HTML element that contains all company informations.
        company_container = self.driver.find_elements_by_class_name('lbb-result')[0]
        time.sleep(0.5)

        # Inspect default state.
        self.assertNotIn('active', company_container.get_attribute('class').split(' '))
        for element in company_container.find_elements_by_class_name('lbb-result__details'):
            self.assertEqual(element.value_of_css_property('display'), 'none')

        toggle_details = self.driver.find_elements_by_class_name('js-result-toggle-details')[0]
        time.sleep(0.5)

        # Hide Memo tooltip (show only the first time)
        memo_button_close_button = self.driver.find_elements_by_class_name('introjs-donebutton')
        if memo_button_close_button:
            memo_button_close_button[0].click()
            time.sleep(0.5)

        # Display company details.
        toggle_details.click()
        time.sleep(0.5)
        self.assertIn('active', company_container.get_attribute('class').split(' '))
        for element in company_container.find_elements_by_class_name('lbb-result__details'):
            self.assertEqual(element.value_of_css_property('display'), 'block')

        # Hide company details.
        toggle_details.click()
        time.sleep(0.5)
        self.assertNotIn('active', company_container.get_attribute('class').split(' '))
        for element in company_container.find_elements_by_class_name('lbb-result__details'):
            self.assertEqual(element.value_of_css_property('display'), 'none')
<commit_msg>Close RGPD banner if present during selenium test This should help with the current flakyness of selenium tests.<commit_after># coding: utf8
import time

from .base import LbbSeleniumTestCase


class TestResults(LbbSeleniumTestCase):

    def test_toggle_office_details(self):
        """
        Tests the toggle mechanism of the `results` page.
        """
        url = self.url_for('search.results', city='metz', zipcode='57000', occupation='comptabilite')
        self.driver.get(url)

        # Get the HTML element that contains all company informations.
        company_container = self.driver.find_elements_by_class_name('lbb-result')[0]
        time.sleep(0.5)

        # Inspect default state.
        self.assertNotIn('active', company_container.get_attribute('class').split(' '))
        for element in company_container.find_elements_by_class_name('lbb-result__details'):
            self.assertEqual(element.value_of_css_property('display'), 'none')

        # Hide RGPD modal if present.
        rgpd_accept_button = self.driver.find_elements_by_class_name('rgpd-accept')
        if rgpd_accept_button:
            rgpd_accept_button[0].click()
            time.sleep(0.5)

        toggle_details = self.driver.find_elements_by_class_name('js-result-toggle-details')[0]
        time.sleep(0.5)

        # Hide Memo tooltip (show only the first time)
        memo_button_close_button = self.driver.find_elements_by_class_name('introjs-donebutton')
        if memo_button_close_button:
            memo_button_close_button[0].click()
            time.sleep(0.5)

        # Display company details.
        toggle_details.click()
        time.sleep(0.5)
        self.assertIn('active', company_container.get_attribute('class').split(' '))
        for element in company_container.find_elements_by_class_name('lbb-result__details'):
            self.assertEqual(element.value_of_css_property('display'), 'block')

        # Hide company details.
        toggle_details.click()
        time.sleep(0.5)
        self.assertNotIn('active', company_container.get_attribute('class').split(' '))
        for element in company_container.find_elements_by_class_name('lbb-result__details'):
            self.assertEqual(element.value_of_css_property('display'), 'none')

{'fraction_non_alphanumeric': 0.10869050438077196, 'fraction_numerical': 0.009708737864077669, 'mean_word_length': 3.3278688524590163, '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': '3620371', 'n_tokens_mistral': 1253, 'n_tokens_neox': 1214, 'n_words': 214}