<commit_before># Copyright (c) 2009 gocept gmbh & co. kg
# See also LICENSE.txt

import zeit.cms.selenium


class AddTest(zeit.cms.selenium.Test):

    def test_adding(self):
        s = self.selenium
        self.open('/')
        s.select('sidebar.form.type_', 'Image Group')
        s.select('sidebar.form.ressort', 'International')
        s.waitForElementPresent('xpath=//option[text() = "Meinung"]')
        s.select('sidebar.form.sub_ressort', 'Meinung')
        s.clickAndWait('sidebar.form.actions.add')
        s.verifyLocation('*/international/meinung/*-*/@@zeit.content.image.imagegroup.Add*')

        s.verifySelectedLabel('sidebar.form.ressort', 'International')<commit_msg>Re #5937: wrote selenium tests for session and validation behaviour<commit_after># Copyright (c) 2009 gocept gmbh & co. kg
# See also LICENSE.txt

import zeit.cms.selenium


class AddTest(zeit.cms.selenium.Test):

    def test_adding(self):
        s = self.selenium
        self.open('/')

        s.comment('provoke validation error')
        s.select('sidebar.form.type_', 'Image Group')
        s.click('sidebar.form.actions.add')
        s.waitForElementPresent('xpath=//ul[@class="errors"]')

        s.comment('successful submit')
        s.select('sidebar.form.ressort', 'International')
        s.waitForElementPresent('xpath=//option[text() = "Meinung"]')
        s.select('sidebar.form.sub_ressort', 'Meinung')
        s.clickAndWait('sidebar.form.actions.add')
        s.verifyLocation('*/international/meinung/*-*/@@zeit.content.image.imagegroup.Add*')

        s.comment('values should be remembered in the session')
        s.verifySelectedLabel('sidebar.form.ressort', 'International')

        s.comment('but selecting something else should take preference')
        s.select('sidebar.form.type_', 'Folder')
        s.clickAndWait('sidebar.form.actions.add')
        s.verifyLocation('*/international/meinung/*-*/@@zeit.cms.repository.folder.Add*')
{'fraction_non_alphanumeric': 0.15660184237461616, 'fraction_numerical': 0.006141248720573183, 'mean_word_length': 3.3444444444444446, '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': '395019', 'n_tokens_mistral': 632, 'n_tokens_neox': 593, 'n_words': 99}