<commit_before>package org.opennms.smoketest;

import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverBackedSelenium;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import com.thoughtworks.selenium.SeleneseTestCase;

@SuppressWarnings("deprecation")
public class ServicePageTest extends SeleneseTestCase {
    @Before
    public void setUp() throws Exception {
        WebDriver driver = new FirefoxDriver();
        String baseUrl = "http://localhost:8980/";
        selenium = new WebDriverBackedSelenium(driver, baseUrl);
        //selenium.start();
        selenium.open("/opennms/login.jsp");
        selenium.type("name=j_username", "admin");
        selenium.type("name=j_password", "<PASSWORD>");
        selenium.click("name=Login");
        selenium.waitForPageToLoad("30000");
    }

    @Test
    public void testPrvoisioningGroupSetup() throws Exception {
        selenium.click("link=Admin");
        selenium.waitForPageToLoad("30000");
        selenium.waitForPageToLoad("30000");
        selenium.click("link=Manage Provisioning Groups");
        selenium.waitForPageToLoad("30000");
        selenium.type("css=form[name=takeAction] > input[name=groupName]", "SeleniumTestGroup");
        selenium.click("css=input[type=submit]");
        selenium.waitForPageToLoad("30000");
        selenium.click("//div[@id='content']/table/tbody/tr[2]/td[2]/a");
        selenium.waitForPageToLoad("30000");
        selenium.click("css=h4 > input[type=button]");
        selenium.waitForPageToLoad("30000");
        selenium.type("id=formData.detectors13.name", "HTTP-8980");
        selenium.select("id=formData.detectors13.pluginClass", "label=HTTP");
        selenium.click("//input[@value='Save']");
        selenium.waitForPageToLoad("30000");
        selenium.click("//form[@id='foreignSourceEditForm']/ul/li[14]/a[3]");
        selenium.waitForPageToLoad("30000");
        selenium.select("id=formData.detectors13.parameters0.key", "label=port");
        selenium.type("id=formData.detectors13.parameters0.value", "8980");
        selenium.click("css=li > input[type=button]");
        selenium.waitForPageToLoad("30000");
        selenium.click("css=input[type=button]");
        selenium.waitForPageToLoad("30000");
        selenium.click("link=Edit");
        selenium.waitForPageToLoad("30000");
        selenium.click("//input[@value='Add Node']");
        selenium.waitForPageToLoad("30000");
        selenium.type("id=formData.node0.nodeLabel", "localNode");
        selenium.click("css=li > input[type=button]");
        selenium.waitForPageToLoad("30000");
        selenium.click("link=[Add Interface]");
        selenium.waitForPageToLoad("30000");
        selenium.type("id=formData.node0.interface0.ipAddr", "::1");
        selenium.click("css=li > input[type=button]");
        selenium.waitForPageToLoad("30000");
        selenium.click("css=input[type=button]");
        selenium.waitForPageToLoad("30000");
        selenium.click("//input[@value='Synchronize']");
        selenium.waitForPageToLoad("30000");
        selenium.click("link=Log out");
        selenium.waitForPageToLoad("30000");
    }
    
    @Test
    public void testProvisioningGroupWasCreated() throws InterruptedException {
        selenium.click("link=Node List");
        selenium.waitForPageToLoad("30000");
        for (int second = 0;; second++) {
            if (second >= 60) fail("timeout");
            try { if (selenium.isElementPresent("link=localNode")) break; } catch (Exception e) {}
            Thread.sleep(1000);
        }
        selenium.click("link=localNode");
        selenium.waitForPageToLoad("30000");
        selenium.click("link=HTTP-8980");
        selenium.waitForPageToLoad("30000");
        verifyTrue(selenium.isTextPresent("Polling Status 	Managed"));
        verifyTrue(selenium.isTextPresent("Interface 	0000:0000:0000:0000:0000:0000:0000:0001"));
        verifyTrue(selenium.isTextPresent("Node 	localNode"));
        selenium.click("link=Admin");
        selenium.waitForPageToLoad("30000");
        selenium.click("link=Manage Provisioning Groups");
        selenium.waitForPageToLoad("30000");
        selenium.click("link=Edit");
        selenium.waitForPageToLoad("30000");
        selenium.click("css=li > a > img");
        selenium.waitForPageToLoad("30000");
        selenium.click("css=input[type=button]");
        selenium.waitForPageToLoad("30000");
        selenium.click("//input[@value='Synchronize']");
        selenium.waitForPageToLoad("30000");
        selenium.click("css=span > input[type=button]");
        selenium.waitForPageToLoad("30000");
        selenium.click("link=Log out");
        selenium.waitForPageToLoad("30000");
    }
    
    @Test
    public void testCreateUser() { 
        selenium.click("link=Admin");
        selenium.waitForPageToLoad("30000");
        selenium.click("link=Configure Users, Groups and Roles");<commit_msg>Added more timeout information to the mysterious service page smoke test failure.<commit_after>package org.opennms.smoketest;

import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverBackedSelenium;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import com.thoughtworks.selenium.SeleneseTestCase;

@SuppressWarnings("deprecation")
public class ServicePageTest extends SeleneseTestCase {
    @Before
    public void setUp() throws Exception {
        WebDriver driver = new FirefoxDriver();
        String baseUrl = "http://localhost:8980/";
        selenium = new WebDriverBackedSelenium(driver, baseUrl);
        //selenium.start();
        selenium.open("/opennms/login.jsp");
        selenium.type("name=j_username", "admin");
        selenium.type("name=j_password", "<PASSWORD>");
        selenium.click("name=Login");
        selenium.waitForPageToLoad("30000");
    }

    @Test
    public void testPrvoisioningGroupSetup() throws Exception {
        selenium.click("link=Admin");
        selenium.waitForPageToLoad("30000");
        selenium.waitForPageToLoad("30000");
        selenium.click("link=Manage Provisioning Groups");
        selenium.waitForPageToLoad("30000");
        selenium.type("css=form[name=takeAction] > input[name=groupName]", "SeleniumTestGroup");
        selenium.click("css=input[type=submit]");
        selenium.waitForPageToLoad("30000");
        selenium.click("//div[@id='content']/table/tbody/tr[2]/td[2]/a");
        selenium.waitForPageToLoad("30000");
        selenium.click("css=h4 > input[type=button]");
        selenium.waitForPageToLoad("30000");
        selenium.type("id=formData.detectors13.name", "HTTP-8980");
        selenium.select("id=formData.detectors13.pluginClass", "label=HTTP");
        selenium.click("//input[@value='Save']");
        selenium.waitForPageToLoad("30000");
        selenium.click("//form[@id='foreignSourceEditForm']/ul/li[14]/a[3]");
        selenium.waitForPageToLoad("30000");
        selenium.select("id=formData.detectors13.parameters0.key", "label=port");
        selenium.type("id=formData.detectors13.parameters0.value", "8980");
        selenium.click("css=li > input[type=button]");
        selenium.waitForPageToLoad("30000");
        selenium.click("css=input[type=button]");
        selenium.waitForPageToLoad("30000");
        selenium.click("link=Edit");
        selenium.waitForPageToLoad("30000");
        selenium.click("//input[@value='Add Node']");
        selenium.waitForPageToLoad("30000");
        selenium.type("id=formData.node0.nodeLabel", "localNode");
        selenium.click("css=li > input[type=button]");
        selenium.waitForPageToLoad("30000");
        selenium.click("link=[Add Interface]");
        selenium.waitForPageToLoad("30000");
        selenium.type("id=formData.node0.interface0.ipAddr", "::1");
        selenium.click("css=li > input[type=button]");
        selenium.waitForPageToLoad("30000");
        selenium.click("css=input[type=button]");
        selenium.waitForPageToLoad("30000");
        selenium.click("//input[@value='Synchronize']");
        selenium.waitForPageToLoad("30000");
        selenium.click("link=Log out");
        selenium.waitForPageToLoad("30000");
    }
    
    @Test
    public void testProvisioningGroupWasCreated() throws InterruptedException {
        selenium.click("link=Node List");
        selenium.waitForPageToLoad("30000");
        for (int second = 0 ;;  second++) {
            if (second >= 60){
                fail("Timeout in testProvsioningGroupWasCreated(). Failed after: "+ second + " seconds" + "\nhtml source: " + 
                     selenium.getHtmlSource() + "\n" +
                     		"Title: " + selenium.getTitle() + "\nurl: " + selenium.getLocation());
            }
            if (selenium.isElementPresent("link=localNode")) {
                break;
            }
            Thread.sleep(1000);
            selenium.refresh();
        }
        selenium.click("link=localNode");
        selenium.waitForPageToLoad("30000");
        selenium.click("link=HTTP-8980");
        selenium.waitForPageToLoad("30000");
        verifyTrue(selenium.isTextPresent("Polling Status 	Managed"));
        verifyTrue(selenium.isTextPresent("Interface 	0000:0000:0000:0000:0000:0000:0000:0001"));
        verifyTrue(selenium.isTextPresent("Node 	localNode"));
        selenium.click("link=Admin");
        selenium.waitForPageToLoad("30000");
        selenium.click("link=Manage Provisioning Groups");
        selenium.waitForPageToLoad("30000");
        selenium.click("link=Edit");
        selenium.waitForPageToLoad("30000");
        selenium.click("css=li > a > img");
        selenium.waitForPageToLoad("30000");
        selenium.click("css=input[type=button]");
        selenium.waitForPageToLoad("30000");
        selenium.click("//input[@value='Synchronize']");
        selenium.waitForPageToLoad("30000");
        selenium.click("css=span > input[type=button]");
        selenium.waitForPageToLoad("30000");
        selenium.click("link=Log out");
        selenium.waitForPageToLoad("30000");
    }
    
    @Test
    public void testCreateUser() { 
        selenium.click("link=Admin");
        selenium.waitForPageToLoad("30000");
        selenium.click("link=Configure Users, Groups and Roles");
{'fraction_non_alphanumeric': 0.1535421686746988, 'fraction_numerical': 0.04433734939759036, 'mean_word_length': 3.4078164825828376, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 23, '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': '258524', 'n_tokens_mistral': 3631, 'n_tokens_neox': 3165, 'n_words': 385}