<commit_before>/*
 * Copyright 2006-2012 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 edu.samplu.krad.validationmessagesview;

import edu.samplu.common.UpgradedSeleniumITBase;
import junit.framework.Assert;
import org.junit.Test;

/**
 * @author Kuali Rice Team (<EMAIL>)
 */
public class ServerWarningsIT extends UpgradedSeleniumITBase {
    @Override
    public String getTestUrl() {
        return "/kr-krad/uicomponents?viewId=Demo-ValidationLayout&methodToCall=start";
    }

	@Test
	public void testServerWarningsIT() throws Exception {
		selenium.click("//button[contains(.,'Get Warning Messages')]");
		selenium.waitForPageToLoad("30000");
		Assert.assertTrue(selenium.isVisible("css=div[data-messagesfor=\"Demo-ValidationLayout-SectionsPage\"]"));
		Assert.assertTrue(selenium.isElementPresent("css=div[data-messagesfor=\"Demo-ValidationLayout-SectionsPage\"] .uif-warningMessageItem"));
		Assert.assertTrue(selenium.isVisible("css=div[data-messagesfor=\"Demo-ValidationLayout-Section1\"]"));
		Assert.assertTrue(selenium.isElementPresent("css=div[data-messagesfor=\"Demo-ValidationLayout-Section1\"] .uif-warningMessageItem"));
		Assert.assertTrue(selenium.isElementPresent("css=div[data-role=\"InputField\"] img[alt=\"Warning\"]"));
		selenium.mouseOver("//a[contains(.,'Field 1')]");
		Assert.assertTrue(selenium.isElementPresent("css=.uif-warningHighlight"));
		selenium.click("//a[contains(.,'Field 1')]");
		for (int second = 0;; second++) {
			if (second >= 60) Assert.fail("timeout");
			try { if (selenium.isVisible("css=.jquerybubblepopup-innerHtml")) break; } catch (Exception e) {}
			Thread.sleep(1000);
		}

		Assert.assertTrue(selenium.isVisible("css=.jquerybubblepopup-innerHtml > .uif-serverMessageItems"));
		Assert.assertTrue(selenium.isVisible("css=.jquerybubblepopup-innerHtml > .uif-serverMessageItems .uif-warningMessageItem-field"));
		selenium.type("name=field1", "");
		selenium.fireEvent("name=field1", "blur");
		selenium.fireEvent("name=field1", "focus");
		for (int second = 0;; second++) {
			if (second >= 60) Assert.fail("timeout");
			try { if (selenium.isVisible("css=.jquerybubblepopup-innerHtml")) break; } catch (Exception e) {}
			Thread.sleep(1000);
		}

		Assert.assertTrue(selenium.isVisible("css=.jquerybubblepopup-innerHtml > .uif-serverMessageItems .uif-warningMessageItem-field"));
		for (int second = 0;; second++) {
			if (second >= 60) Assert.fail("timeout");
			try { if (selenium.isVisible("css=.jquerybubblepopup-innerHtml > .uif-clientMessageItems")) break; } catch (Exception e) {}
			Thread.sleep(1000);
		}

		Assert.assertTrue(selenium.isVisible("css=.jquerybubblepopup-innerHtml > .uif-clientMessageItems  .uif-errorMessageItem-field"));
		selenium.type("name=field1", "b");
		selenium.keyDown("name=field1", "b");
		selenium.keyUp("name=field1", "b");
        selenium.typeKeys("name=field1", "\b\b\b");
		for (int second = 0;; second++) {
			if (second >= 60) Assert.fail("timeout");
			try { if (!selenium.isElementPresent("css=.jquerybubblepopup-innerHtml > .uif-clientMessageItems")) break; } catch (Exception e) {}
			Thread.sleep(1000);
		}

		Assert.assertTrue(selenium.isVisible("css=.jquerybubblepopup-innerHtml > .uif-serverMessageItems .uif-warningMessageItem-field"));
		Assert.assertFalse(selenium.isElementPresent("css=.jquerybubblepopup-innerHtml > .uif-clientMessageItems"));
		selenium.type("name=field1", "");
		selenium.fireEvent("name=field1", "focus");
		selenium.fireEvent("name=field1", "blur");
		Assert.assertTrue(selenium.isElementPresent("css=.uif-hasError"));
		Assert.assertTrue(selenium.isElementPresent("css=img[src*=\"error.png\"]"));
	}
}<commit_msg>KULRICE-7932 ServerWarningsIT-Fixed<commit_after>/*
 * Copyright 2006-2012 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 edu.samplu.krad.validationmessagesview;

import edu.samplu.common.UpgradedSeleniumITBase;
import junit.framework.Assert;
import org.junit.Test;

/**
 * @author Kuali Rice Team (<EMAIL>)
 */
public class ServerWarningsIT extends UpgradedSeleniumITBase {
    @Override
    public String getTestUrl() {
        return "/kr-krad/uicomponents?viewId=Demo-ValidationLayout&methodToCall=start";
    }

	@Test
	public void testServerWarningsIT() throws Exception {
		selenium.click("//button[contains(.,'Get Warning Messages')]");
		selenium.waitForPageToLoad("30000");
		Assert.assertTrue(selenium.isVisible("css=div[data-messagesfor=\"Demo-ValidationLayout-SectionsPage\"]"));
		Assert.assertTrue(selenium.isElementPresent("css=div[data-messagesfor=\"Demo-ValidationLayout-SectionsPage\"] .uif-warningMessageItem"));
		Assert.assertTrue(selenium.isVisible("css=div[data-messagesfor=\"Demo-ValidationLayout-Section1\"]"));
		Assert.assertTrue(selenium.isElementPresent("css=div[data-messagesfor=\"Demo-ValidationLayout-Section1\"] .uif-warningMessageItem"));
		Assert.assertTrue(selenium.isElementPresent("css=div[data-role=\"InputField\"] img[alt=\"Warning\"]"));
		selenium.mouseOver("//a[contains(.,'Field 1')]");
		Assert.assertTrue(selenium.isElementPresent("css=.uif-warningHighlight"));
		selenium.click("//a[contains(.,'Field 1')]");
		for (int second = 0;; second++) {
			if (second >= 60) Assert.fail("timeout");
			try { if (selenium.isVisible("css=.jquerybubblepopup-innerHtml")) break; } catch (Exception e) {}
			Thread.sleep(1000);
		}

		Assert.assertTrue(selenium.isVisible("css=.jquerybubblepopup-innerHtml > .uif-serverMessageItems"));
		Assert.assertTrue(selenium.isVisible("css=.jquerybubblepopup-innerHtml > .uif-serverMessageItems .uif-warningMessageItem-field"));
		selenium.type("name=field1", "");
		selenium.fireEvent("name=field1", "blur");
		selenium.fireEvent("name=field1", "focus");
		for (int second = 0;; second++) {
			if (second >= 60) Assert.fail("timeout");
			try { if (selenium.isVisible("css=.jquerybubblepopup-innerHtml")) break; } catch (Exception e) {}
			Thread.sleep(1000);
		}

		Assert.assertTrue(selenium.isVisible("css=.jquerybubblepopup-innerHtml > .uif-serverMessageItems .uif-warningMessageItem-field"));
		for (int second = 0;; second++) {
			if (second >= 60) Assert.fail("timeout");
			try { if (selenium.isVisible("css=.jquerybubblepopup-innerHtml > .uif-clientMessageItems")) break; } catch (Exception e) {}
			Thread.sleep(1000);
		}

		Assert.assertTrue(selenium.isVisible("css=.jquerybubblepopup-innerHtml > .uif-clientMessageItems  .uif-errorMessageItem-field"));
		selenium.type("name=field1", "b");		 
        selenium.fireEvent("name=field1", "blur");
        selenium.fireEvent("name=field1", "focus");
		for (int second = 0;; second++) {
			if (second >= 60) Assert.fail("timeout");
			try { if (!selenium.isElementPresent("css=.jquerybubblepopup-innerHtml > .uif-clientMessageItems")) break; } catch (Exception e) {}
			Thread.sleep(1000);
		}

		Assert.assertTrue(!selenium.isVisible("css=.jquerybubblepopup-innerHtml > .uif-serverMessageItems .uif-warningMessageItem-field"));
		Assert.assertFalse(selenium.isElementPresent("css=.jquerybubblepopup-innerHtml > .uif-clientMessageItems"));
		selenium.type("name=field1", "");
		selenium.fireEvent("name=field1", "focus");
		selenium.fireEvent("name=field1", "blur");
		Assert.assertTrue(selenium.isElementPresent("css=.uif-hasError"));
		Assert.assertTrue(selenium.isElementPresent("css=img[src*=\"error.png\"]"));
	}
}
{'fraction_non_alphanumeric': 0.15797600665162134, 'fraction_numerical': 0.014134695331987171, 'mean_word_length': 5.552529182879377, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, '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': '2019325', 'n_tokens_mistral': 2883, 'n_tokens_neox': 2600, 'n_words': 475}