<commit_before>/**
 * Copyright 2005-2014 The Kuali Foundation
 *
 * Licensed under the Educational Community License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.opensource.org/licenses/ecl2.php
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.kuali.rice.krad.demo.uif.library.clientresponsiveness;

import org.junit.Test;

import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

/**
 * @author <NAME> (<EMAIL>)
 */
public class DemoClientResponsivenessDisableAft extends WebDriverLegacyITBase {

    /**
     * /kr-krad/kradsampleapp?viewId=Demo-DisableView&methodToCall=start
     */
    public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-DisableView&methodToCall=start";
   
    @Override
    protected String getBookmarkUrl() {
        return BOOKMARK_URL;
    }

    @Override
    protected void navigate() throws Exception {
        waitAndClickById("Demo-LibraryLink", "");
        waitAndClickByLinkText("Client Responsiveness");
        waitAndClickByLinkText("Disable");
    }

    protected void testClientResponsivenessDisable() throws Exception {
       //Scenario-1 - enabled
       waitAndClickByXpath("//input[@type='radio' and @value='enable']");
       waitAndTypeByName("inputField2","a");
       waitAndTypeByName("inputField3","b");
       selectByName("inputField4", "Option 2");
       selectByName("multiSelectField1","Option 3");
       waitAndClickByXpath("//input[@type='radio' and @value='1']");
       waitAndClickByName("checkboxesField1");
       
       //Scenario-2 - disabled
       waitAndClickByXpath("//input[@type='radio' and @value='disable']");
       if(isEnabledByName("inputField2") && isEnabledByName("inputField3") && isEnabledByName("inputField4") && isEnabledByName("inputField6") &&
               isEnabledByName("inputField7") && isEnabledByName("multiSelectField1")) {
           fail("Field Not Disabled Properly.");
       }
    }
    
    protected void testClientResponsivenessDisableOnChange() throws Exception {
        selectByName("exampleShown","On change");
        
        //Scenario-1
        assertElementPresentByXpath("//button[@class='btn btn-primary uif-boxLayoutHorizontalItem disabled']");
        waitAndTypeByName("inputField10","a");
        waitAndTypeByName("inputField11","a");
        waitAndTypeByName("inputField10", "");
        assertElementPresentByXpath("//button[@class='btn btn-primary uif-boxLayoutHorizontalItem disabled']");
      }
    
    protected void testClientResponsivenessDisableOnKeyUp() throws Exception {
        selectByName("exampleShown","On keyup");
        waitAndTypeByName("inputField13","disable");
        assertElementPresentByXpath("//button[contains(text(),'Action Button (keyUp)') and @class='btn btn-primary uif-boxLayoutHorizontalItem disabled']");
        fireEvent("inputField13", "blur");
        waitAndClickByLinkText("<< Close Library Navigation");
        assertElementPresentByXpath("//button[contains(text(),'Action Button (change)') and @class='btn btn-primary uif-boxLayoutHorizontalItem disabled']");
     }
    
    protected void testClientResponsivenessDisableInCollections() throws Exception {
        selectByName("exampleShown","In Collections");
        WebElement element = findElement(By.name("newCollectionLines['collection1'].field3"));
        assertTrue(element.getAttribute("class").contains("ignoreValid"));
        selectByName("newCollectionLines['collection1'].field2","Disable");
        Thread.sleep(1000);
        assertElementPresentByXpath("//input[@disabled]");
     }
    
    protected void testClientResponsivenessDisableColl() throws Exception {
        selectByName("exampleShown","Coll. SpringEL Functions");
        waitAndClickByXpath("//input[@name='checkboxesField2' and @value='1']");
        WebElement element = findElement(By.name("inputField20"));
        assertTrue(element.getAttribute("class").contains("disabled"));
        waitAndClickByXpath("//input[@name='checkboxesField2' and @value='2']");
        waitAndClickByXpath("//input[@name='checkboxesField2' and @value='3']");
        element = findElement(By.name("inputField21"));
        assertTrue(element.getAttribute("class").contains("disabled"));
     }
    
    @Test<commit_msg>RICEQA-268 : Analyze CI Failures for 2.4.0-rc1 QA Sprint 6 - update test to get to bug<commit_after>/**
 * Copyright 2005-2014 The Kuali Foundation
 *
 * Licensed under the Educational Community License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.opensource.org/licenses/ecl2.php
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.kuali.rice.krad.demo.uif.library.clientresponsiveness;

import org.junit.Test;

import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

/**
 * @author <NAME> (<EMAIL>)
 */
public class DemoClientResponsivenessDisableAft extends WebDriverLegacyITBase {

    /**
     * /kr-krad/kradsampleapp?viewId=Demo-DisableView&methodToCall=start
     */
    public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-DisableView&methodToCall=start";
   
    @Override
    protected String getBookmarkUrl() {
        return BOOKMARK_URL;
    }

    @Override
    protected void navigate() throws Exception {
        waitAndClickById("Demo-LibraryLink", "");
        waitAndClickByLinkText("Client Responsiveness");
        waitAndClickByLinkText("Disable");
    }

    protected void testClientResponsivenessDisable() throws Exception {
       //Scenario-1 - enabled
       waitAndClickByXpath("//input[@type='radio' and @value='enable']");
       waitAndTypeByName("inputField2","a");
       waitAndTypeByName("inputField3","b");
       selectByName("inputField4", "Option 2");
       selectByName("multiSelectField1","Option 3");
       waitAndClickByXpath("//input[@type='radio' and @value='1']");
       waitAndClickByName("checkboxesField1");
       
       //Scenario-2 - disabled
       waitAndClickByXpath("//input[@type='radio' and @value='disable']");
       if(isEnabledByName("inputField2") && isEnabledByName("inputField3") && isEnabledByName("inputField4") && isEnabledByName("inputField6") &&
               isEnabledByName("inputField7") && isEnabledByName("multiSelectField1")) {
           fail("Field Not Disabled Properly.");
       }
    }
    
    protected void testClientResponsivenessDisableOnChange() throws Exception {
        selectByName("exampleShown","On change");
        
        //Scenario-1
        assertElementPresentByXpath("//button[@class='btn btn-primary uif-action uif-boxLayoutHorizontalItem disabled']");
        waitAndTypeByName("inputField10","a");
        waitAndTypeByName("inputField11","a");
        waitAndTypeByName("inputField10", "");
        assertElementPresentByXpath("//button[@class='btn btn-primary uif-action uif-boxLayoutHorizontalItem disabled']");
      }
    
    protected void testClientResponsivenessDisableOnKeyUp() throws Exception {
        selectByName("exampleShown","On keyup");
        waitAndTypeByName("inputField13","disable");
        assertElementPresentByXpath("//button[contains(text(),'Action Button (keyUp)') and @class='btn btn-primary uif-action uif-boxLayoutHorizontalItem disabled'");
        fireEvent("inputField13", "blur");
        waitAndClickByLinkText("<< Close Library Navigation");
        assertElementPresentByXpath("//button[contains(text(),'Action Button (change)') and @class='btn btn-primary uif-action uif-boxLayoutHorizontalItem disabled'");
     }
    
    protected void testClientResponsivenessDisableInCollections() throws Exception {
        selectByName("exampleShown","In Collections");
        WebElement element = findElement(By.name("newCollectionLines['collection1'].field3"));
        assertTrue(element.getAttribute("class").contains("ignoreValid"));
        selectByName("newCollectionLines['collection1'].field2","Disable");
        Thread.sleep(1000);
        assertElementPresentByXpath("//input[@disabled]");
     }
    
    protected void testClientResponsivenessDisableColl() throws Exception {
        selectByName("exampleShown","Coll. SpringEL Functions");
        waitAndClickByXpath("//input[@name='checkboxesField2' and @value='1']");
        WebElement element = findElement(By.name("inputField20"));
        assertTrue(element.getAttribute("class").contains("disabled"));
        waitAndClickByXpath("//input[@name='checkboxesField2' and @value='2']");
        waitAndClickByXpath("//input[@name='checkboxesField2' and @value='3']");
        element = findElement(By.name("inputField21"));
        assertTrue(element.getAttribute("class").contains("disabled"));
     }
    
    @Test
{'fraction_non_alphanumeric': 0.12870147535837606, 'fraction_numerical': 0.012556241498378152, 'mean_word_length': 4.122186495176849, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2568506', 'n_tokens_mistral': 2629, 'n_tokens_neox': 2605, 'n_words': 517}