<commit_before><?php
/**
 * @group slow
 * @group selenium
 * @group Kwc_FormDynamic
 *
 * http://kwf.kwf.niko.vivid/kwf/kwctest/Kwc_FormDynamic_Basic_Root/form
 * http://kwf.kwf.niko.vivid/kwf/kwctest/Kwc_FormDynamic_Basic_Root/form2
 * http://kwf.kwf.niko.vivid/kwf/kwctest/Kwc_FormDynamic_Basic_Root/form3
 */
class Kwc_FormDynamic_Basic_SeleniumTest extends Kwf_Test_SeleniumTestCase
{
    public function setUp()
    {
        parent::setUp();
        Kwf_Component_Data_Root::setComponentClass('Kwc_FormDynamic_Basic_Root');
    }

    public function testTextField()
    {
        //default value
        $this->openKwc('/form');
        $this->assertElementValueEquals('css=#form_root_form-paragraphs-4', 'Def');
        $this->click('css=button');
        $this->waitForConnections();
        $this->assertElementValueEquals('css=#form_root_form-paragraphs-4', 'Def');

        //required
        $this->openKwc('/form');
        $this->assertElementPresent('css=#form_root_form-paragraphs-2');
        $this->assertElementNotPresent('css=.kwfFieldError #form_root_form-paragraphs-2');
        $this->click('css=button');
        $this->waitForConnections();
        $this->assertTextPresent('Please fill out');
        $this->assertElementPresent('css=.kwfFieldError #form_root_form-paragraphs-2');

        //vtype email
        $this->openKwc('/form');
        $this->type('css=#form_root_form-paragraphs-3', 'foo');
        $this->click('css=button');
        $this->waitForConnections();
        $this->assertTextPresent('\'foo\' is not a valid');
        $this->assertElementPresent('css=.kwfFieldError #form_root_form-paragraphs-3');
    }

    public function testCheckbox()
    {
        //default value
        $this->openKwc('/form');
        $this->assertNotChecked('css=#form_root_form-paragraphs-5');
        $this->assertChecked('css=#form_root_form-paragraphs-6');
    }

    public function testFile()
    {
        //required
        $this->openKwc('/form2');
        $this->click('css=button');
        $this->waitForConnections();
        $this->assertTextPresent('Please choose a file');
        $this->assertElementPresent('css=.kwfFieldError #form_root_form2-paragraphs-8');<commit_msg>fix test, this one doesn't send per ajax as it's a file upload<commit_after><?php
/**
 * @group slow
 * @group selenium
 * @group Kwc_FormDynamic
 *
 * http://kwf.kwf.niko.vivid/kwf/kwctest/Kwc_FormDynamic_Basic_Root/form
 * http://kwf.kwf.niko.vivid/kwf/kwctest/Kwc_FormDynamic_Basic_Root/form2
 * http://kwf.kwf.niko.vivid/kwf/kwctest/Kwc_FormDynamic_Basic_Root/form3
 */
class Kwc_FormDynamic_Basic_SeleniumTest extends Kwf_Test_SeleniumTestCase
{
    public function setUp()
    {
        parent::setUp();
        Kwf_Component_Data_Root::setComponentClass('Kwc_FormDynamic_Basic_Root');
    }

    public function testTextField()
    {
        //default value
        $this->openKwc('/form');
        $this->assertElementValueEquals('css=#form_root_form-paragraphs-4', 'Def');
        $this->click('css=button');
        $this->waitForConnections();
        $this->assertElementValueEquals('css=#form_root_form-paragraphs-4', 'Def');

        //required
        $this->openKwc('/form');
        $this->assertElementPresent('css=#form_root_form-paragraphs-2');
        $this->assertElementNotPresent('css=.kwfFieldError #form_root_form-paragraphs-2');
        $this->click('css=button');
        $this->waitForConnections();
        $this->assertTextPresent('Please fill out');
        $this->assertElementPresent('css=.kwfFieldError #form_root_form-paragraphs-2');

        //vtype email
        $this->openKwc('/form');
        $this->type('css=#form_root_form-paragraphs-3', 'foo');
        $this->click('css=button');
        $this->waitForConnections();
        $this->assertTextPresent('\'foo\' is not a valid');
        $this->assertElementPresent('css=.kwfFieldError #form_root_form-paragraphs-3');
    }

    public function testCheckbox()
    {
        //default value
        $this->openKwc('/form');
        $this->assertNotChecked('css=#form_root_form-paragraphs-5');
        $this->assertChecked('css=#form_root_form-paragraphs-6');
    }

    public function testFile()
    {
        //required
        $this->openKwc('/form2');
        $this->clickAndWait('css=button');
        $this->assertTextPresent('Please choose a file');
        $this->assertElementPresent('css=.kwfFieldError #form_root_form2-paragraphs-8');
{'fraction_non_alphanumeric': 0.15824915824915825, 'fraction_numerical': 0.006285072951739619, 'mean_word_length': 3.3473170731707316, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 54, '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': '4545597', 'n_tokens_mistral': 1457, 'n_tokens_neox': 1417, 'n_words': 166}