<commit_before>/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package com.xpn.xwiki.it.selenium;

import junit.framework.Test;

import com.xpn.xwiki.it.selenium.framework.AbstractXWikiTestCase;
import com.xpn.xwiki.it.selenium.framework.AlbatrossSkinExecutor;
import com.xpn.xwiki.it.selenium.framework.XWikiTestSuite;

/**
 * Test the Panel feature. Note that some panels tests are also done by the
 * {@link com.xpn.xwiki.it.selenium.PanelWizardTest} test case class.
 * 
 * @version $Id: $
 * @since 1.6M1
 */
public class PanelsTest extends AbstractXWikiTestCase
{
    public static Test suite()
    {
        XWikiTestSuite suite = new XWikiTestSuite("Verify the XWiki Panel feature");
        suite.addTestSuite(PanelsTest.class, AlbatrossSkinExecutor.class);
        return suite;
    }

    @Override
    public void setUp() throws Exception
    {
        super.setUp();
        loginAsAdmin();
    }

    /**
     * This method makes the following tests:
     * <ul>
     * <li>Opens the Panels page for XWiki instance.</li>
     * <li>Creates a panel - setting the title.</li>
     * <li>Completes the form with details for the newly created panel.</li>
     * <li>Goes to preview and pushes the button save and continue.</li>
     * <li>Completes the form and pushes the save&view button.</li>
     * <li>Goes back to panels list and check for the presence of the newly created panel.</li>
     * </ul>
     */
    public void testCreatePanel()
    {
        try {
            open("Panels", "WebHome");
            setFieldValue("panelTitle", "Thesecondpaneltobecreated");
            clickLinkWithXPath("//input[@value='Create']");
            setFieldValue("Panels.PanelClass_0_description", "Tester panel");
            setFieldValue("Panels.PanelClass_0_content", "#panelheader(\"Test panel\")\nTest Panel\n#panelfooter()");
            clickLinkWithLocator("formactionsave");
            open("Panels", "WebHome");
            assertElementPresent("//a[text()='Thesecondpaneltobecreated']");
        } finally {
            deletePage("Panels", "Thesecondpaneltobecreated");
        }
    }

    /**
     * This method makes the following tests:
     * <ul>
     * <li>Opens the Panels page for XWiki instance.</li>
     * <li>Creates a panel - setting a title with special characters ('$&/\?#).</li>
     * <li>...Checking that no error occurred</li>
     * <li>Goes back to panels list and check for the presence of the newly created panel.</li>
     * </ul>
     */
    public void testCreatePanelWithSpecialSymbols()
    {
        String title = "Is # & \u0163 'triky\"? c:\\windows /root $util";
        try {
            open("Panels", "WebHome");
            getSelenium().setSpeed("4000");
            setFieldValue("panelTitle", title);
            clickLinkWithXPath("//input[@value='Create']");
            clickLinkWithLocator("formactionsave");
            assertTextPresent(title);
        } finally {
            deletePage("Panels", title);
        }
    }
}<commit_msg>[misc] Remove line committed by mistake<commit_after>/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package com.xpn.xwiki.it.selenium;

import junit.framework.Test;

import com.xpn.xwiki.it.selenium.framework.AbstractXWikiTestCase;
import com.xpn.xwiki.it.selenium.framework.AlbatrossSkinExecutor;
import com.xpn.xwiki.it.selenium.framework.XWikiTestSuite;

/**
 * Test the Panel feature. Note that some panels tests are also done by the
 * {@link com.xpn.xwiki.it.selenium.PanelWizardTest} test case class.
 * 
 * @version $Id: $
 * @since 1.6M1
 */
public class PanelsTest extends AbstractXWikiTestCase
{
    public static Test suite()
    {
        XWikiTestSuite suite = new XWikiTestSuite("Verify the XWiki Panel feature");
        suite.addTestSuite(PanelsTest.class, AlbatrossSkinExecutor.class);
        return suite;
    }

    @Override
    public void setUp() throws Exception
    {
        super.setUp();
        loginAsAdmin();
    }

    /**
     * This method makes the following tests:
     * <ul>
     * <li>Opens the Panels page for XWiki instance.</li>
     * <li>Creates a panel - setting the title.</li>
     * <li>Completes the form with details for the newly created panel.</li>
     * <li>Goes to preview and pushes the button save and continue.</li>
     * <li>Completes the form and pushes the save&view button.</li>
     * <li>Goes back to panels list and check for the presence of the newly created panel.</li>
     * </ul>
     */
    public void testCreatePanel()
    {
        try {
            open("Panels", "WebHome");
            setFieldValue("panelTitle", "Thesecondpaneltobecreated");
            clickLinkWithXPath("//input[@value='Create']");
            setFieldValue("Panels.PanelClass_0_description", "Tester panel");
            setFieldValue("Panels.PanelClass_0_content", "#panelheader(\"Test panel\")\nTest Panel\n#panelfooter()");
            clickLinkWithLocator("formactionsave");
            open("Panels", "WebHome");
            assertElementPresent("//a[text()='Thesecondpaneltobecreated']");
        } finally {
            deletePage("Panels", "Thesecondpaneltobecreated");
        }
    }

    /**
     * This method makes the following tests:
     * <ul>
     * <li>Opens the Panels page for XWiki instance.</li>
     * <li>Creates a panel - setting a title with special characters ('$&/\?#).</li>
     * <li>...Checking that no error occurred</li>
     * <li>Goes back to panels list and check for the presence of the newly created panel.</li>
     * </ul>
     */
    public void testCreatePanelWithSpecialSymbols()
    {
        String title = "Is # & \u0163 'triky\"? c:\\windows /root $util";
        try {
            open("Panels", "WebHome");
            setFieldValue("panelTitle", title);
            clickLinkWithXPath("//input[@value='Create']");
            clickLinkWithLocator("formactionsave");
            assertTextPresent(title);
        } finally {
            deletePage("Panels", title);
        }
    }
}
{'fraction_non_alphanumeric': 0.11064826868003125, 'fraction_numerical': 0.006248372819578235, 'mean_word_length': 2.8803030303030304, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 51, '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': '4744517', 'n_tokens_mistral': 2218, 'n_tokens_neox': 2161, 'n_words': 710}