summaryrefslogtreecommitdiff
path: root/maintenance/tests/selenium/suites/AddContentToNewPageTestCase.php
diff options
context:
space:
mode:
Diffstat (limited to 'maintenance/tests/selenium/suites/AddContentToNewPageTestCase.php')
-rw-r--r--maintenance/tests/selenium/suites/AddContentToNewPageTestCase.php182
1 files changed, 182 insertions, 0 deletions
diff --git a/maintenance/tests/selenium/suites/AddContentToNewPageTestCase.php b/maintenance/tests/selenium/suites/AddContentToNewPageTestCase.php
new file mode 100644
index 00000000..dd4bc005
--- /dev/null
+++ b/maintenance/tests/selenium/suites/AddContentToNewPageTestCase.php
@@ -0,0 +1,182 @@
+<?php
+
+/**
+ * Selenium server manager
+ *
+ * @file
+ * @ingroup Maintenance
+ * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com>
+ * http://citizendium.org/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @addtogroup Maintenance
+ *
+ */
+
+
+class AddContentToNewPageTestCase extends SeleniumTestCase {
+
+
+ // Add bold text and verify output
+ public function testAddBoldText() {
+
+ $this->getExistingPage();
+ $this->clickEditLink();
+ $this->loadWikiEditor();
+ $this->clearWikiEditor();
+ $this->click( "//*[@id='mw-editbutton-bold']" );
+ $this->clickShowPreviewBtn();
+ $this->waitForPageToLoad( "600000" );
+
+ // Verify bold text displayed on mediawiki preview
+ $this->assertTrue($this->isElementPresent( "//div[@id='wikiPreview']/p/b" ));
+ $this->assertTrue($this->isTextPresent( "Bold text" ));
+ }
+
+ // Add italic text and verify output
+ public function testAddItalicText() {
+
+ $this->getExistingPage();
+ $this->clickEditLink();
+ $this->loadWikiEditor();
+ $this->clearWikiEditor();
+ $this->click( "//*[@id='mw-editbutton-italic']" );
+ $this->clickShowPreviewBtn();
+ $this->waitForPageToLoad( "600000" );
+
+ // Verify italic text displayed on mediawiki preview
+ $this->assertTrue($this->isElementPresent("//div[@id='wikiPreview']/p/i"));
+ $this->assertTrue($this->isTextPresent( "Italic text" ));
+ }
+
+ // Add internal link for a new page and verify output in the preview
+ public function testAddInternalLinkNewPage() {
+ $this->getExistingPage();
+ $this->clickEditLink();
+ $this->loadWikiEditor();
+ $this->clearWikiEditor();
+ $this->click( "//*[@id='mw-editbutton-link']" );
+ $this->clickShowPreviewBtn();
+ $this->waitForPageToLoad( "600000" );
+
+ // Verify internal link displayed on mediawiki preview
+ $source = $this->getText( "//*[@id='wikiPreview']/p/a" );
+ $correct = strstr( $source, "Link title" );
+ $this->assertEquals( $correct, true );
+
+ $this->click( "link=Link title" );
+ $this->waitForPageToLoad( "600000" );
+
+ // Verify internal link open as a new page - editing mode
+ $source = $this->getText( "firstHeading" );
+ $correct = strstr( $source, "Editing Link title" );
+ $this->assertEquals( $correct, true );
+ }
+
+ // Add external link and verify output in the preview
+ public function testAddExternalLink() {
+ $this->getExistingPage();
+ $this->clickEditLink();
+ $this->loadWikiEditor();
+ $this->clearWikiEditor();
+ $this->click( "//*[@id='mw-editbutton-extlink']" );
+ $this->type( "wpTextbox1", "[http://www.google.com Google]" );
+ $this->clickShowPreviewBtn();
+ $this->waitForPageToLoad( "600000" );
+
+ // Verify external links displayed on mediawiki preview
+ $source = $this->getText( "//*[@id='wikiPreview']/p/a" );
+ $correct = strstr( $source, "Google" );
+ $this->assertEquals( $correct, true );
+
+ $this->click( "link=Google" );
+ $this->waitForPageToLoad( "600000" );
+
+ // Verify external link opens
+ $source = $this->getTitle();
+ $correct = strstr( $source, "Google" );
+ $this->assertEquals( $correct, true);
+ }
+
+ // Add level 2 headline and verify output in the preview
+ public function testAddLevel2HeadLine() {
+ $blnElementPresent = False;
+ $blnTextPresent = False;
+ $this->getExistingPage();
+ $this->clickEditLink();
+ $this->loadWikiEditor();
+ $this->clearWikiEditor();
+ $this->click( "mw-editbutton-headline" );
+ $this->clickShowPreviewBtn();
+ $this->waitForPageToLoad( "600000" );
+ $this->assertTrue($this->isElementPresent( "//div[@id='wikiPreview']/h2" ));
+
+ // Verify level 2 headline displayed on mediawiki preview
+ $source = $this->getText( "//*[@id='Headline_text']" );
+ $correct = strstr( $source, "Headline text" );
+ $this->assertEquals( $correct, true );
+ }
+
+ // Add text with ignore wiki format and verify output the preview
+ public function testAddNoWikiFormat() {
+ $this->getExistingPage();
+ $this->clickEditLink();
+ $this->loadWikiEditor();
+ $this->clearWikiEditor();
+ $this->click( "//*[@id='mw-editbutton-nowiki']" );
+ $this->clickShowPreviewBtn();
+ $this->waitForPageToLoad( "600000" );
+
+ // Verify ignore wiki format text displayed on mediawiki preview
+ $source = $this->getText( "//div[@id='wikiPreview']/p" );
+ $correct = strstr( $source, "Insert non-formatted text here" );
+ $this->assertEquals( $correct, true );
+ }
+
+ // Add signature and verify output in the preview
+ public function testAddUserSignature() {
+ $this->getExistingPage();
+ $this->clickEditLink();
+ $this->loadWikiEditor();
+ $this->clearWikiEditor();
+ $this->click( "mw-editbutton-signature" );
+ $this->clickShowPreviewBtn();
+ $this->waitForPageToLoad( "600000" );
+
+ // Verify signature displayed on mediawiki preview
+ $source = $this->getText( "//*[@id='wikiPreview']/p/a" );
+ $username = $this->getText( "//*[@id='pt-userpage']/a" );
+ $correct = strstr( $source, $username );
+ $this->assertEquals( $correct, true );
+ }
+
+ // Add horizontal line and verify output in the preview
+ public function testHorizontalLine() {
+ $this->getExistingPage();
+ $this->clickEditLink();
+ $this->loadWikiEditor();
+ $this->clearWikiEditor();
+ $this->click( "mw-editbutton-hr" );
+
+ $this->clickShowPreviewBtn();
+ $this->waitForPageToLoad( "600000" );
+
+ // Verify horizontal line displayed on mediawiki preview
+ $this->assertTrue( $this->isElementPresent( "//div[@id='wikiPreview']/hr" ));
+ $this->deletePage( "new" );
+ }
+}