r77556 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77555‎ | r77556 | r77557 >
Date:04:21, 2 December 2010
Author:nadeesha
Status:deferred (Comments)
Tags:
Comment:
Test file deleted from Calcey
Modified paths:
  • /trunk/phase3/maintenance/tests/selenium/suites/AddContentToNewPageTestCase.php (added) (history)
  • /trunk/phase3/maintenance/tests/selenium/suites/AddNewPageTestCase.php (added) (history)
  • /trunk/phase3/maintenance/tests/selenium/suites/DeletePageAdminTestCase.php (added) (history)
  • /trunk/phase3/maintenance/tests/selenium/suites/MediaWikiCommonFunc.php (added) (history)
  • /trunk/phase3/maintenance/tests/selenium/suites/MediaWikiEditorConfig.php (added) (history)
  • /trunk/phase3/maintenance/tests/selenium/suites/MediaWikiEditorTestSuite.php (added) (history)
  • /trunk/phase3/maintenance/tests/selenium/suites/PageSearchTestCase.php (added) (history)
  • /trunk/phase3/maintenance/tests/selenium/suites/calcey.txt (deleted) (history)

Diff [purge]

Index: trunk/phase3/maintenance/tests/selenium/suites/AddContentToNewPageTestCase.php
@@ -0,0 +1,258 @@
 2+<?php
 3+/*
 4+ * This test case is part of the SimpleSeleniumTestSuite.
 5+ * Configuration for these tests are dosumented as part of SimpleSeleniumTestSuite.php
 6+ */
 7+class AddContentToNewPageTestCase extends SeleniumTestCase{
 8+
 9+ // Add bold text and verify output
 10+ public function testAddBoldText(){
 11+ $blnElementPresent = False;
 12+ $blnTextPresent = False;
 13+ $this->getExistingPage();
 14+ $this->clickEditLink();
 15+ $this->loadWikiEditor();
 16+ $this->clearWikiEditor();
 17+ $this->click( "//*[@id='mw-editbutton-bold']" );
 18+ $this->clickShowPreviewBtn();
 19+ $this->waitForPageToLoad( "600000" );
 20+
 21+ try{
 22+ $this->assertTrue($this->isElementPresent("//div[@id='wikiPreview']/p/b"));
 23+ $blnElementPresent = True;
 24+ } catch ( PHPUnit_Framework_AssertionFailedError $e ){
 25+ $blnElementPresent = False;
 26+ }
 27+
 28+ try{
 29+ $this->assertTrue($this->isTextPresent( "Bold text" ));
 30+ $blnTextPresent = True;
 31+
 32+ } catch ( PHPUnit_Framework_AssertionFailedError $e ){
 33+ $blnTextPresent = False;
 34+ }
 35+
 36+ // Verify bold text displayed on mediawiki preview
 37+ if (( $blnElementPresent = True ) && ( $blnTextPresent = True )){
 38+ echo "\n Pass : Bold text displayed in the preview \n";
 39+ }
 40+ else{
 41+ echo "\n Fail : Bold text displayed in the preview \n";
 42+ }
 43+ }
 44+
 45+ // Add italic text and verify output
 46+ public function testAddItalicText(){
 47+ $this->getExistingPage();
 48+ $this->clickEditLink();
 49+ $this->loadWikiEditor();
 50+ $this->clearWikiEditor();
 51+ $this->click( "//*[@id='mw-editbutton-italic']" );
 52+ $this->clickShowPreviewBtn();
 53+ $this->waitForPageToLoad( "600000" );
 54+
 55+ // Verify italic text displayed on mediawiki preview
 56+ try{
 57+ $this->assertTrue($this->isElementPresent("//div[@id='wikiPreview']/p/i"));
 58+ $blnElementPresent = True;
 59+ } catch ( PHPUnit_Framework_AssertionFailedError $e ){
 60+ $blnElementPresent = False;
 61+ }
 62+
 63+ try{
 64+ $this->assertTrue($this->isTextPresent( "Italic text" ));
 65+ $blnTextPresent = True;
 66+
 67+ } catch ( PHPUnit_Framework_AssertionFailedError $e ){
 68+ $blnTextPresent = False;
 69+ }
 70+
 71+ // Verify italic text displayed on mediawiki preview
 72+ if (( $blnElementPresent = True ) && ( $blnTextPresent = True )){
 73+ echo "\n Pass : Italic text displayed in the preview \n";
 74+ }
 75+ else{
 76+ echo "\n Fail : Italic text displayed in the preview \n";
 77+ }
 78+
 79+ }
 80+
 81+ // Add internal link for a new page and verify output in the preview
 82+ public function testAddInternalLinkNewPage(){
 83+ $this->getExistingPage();
 84+ $this->clickEditLink();
 85+ $this->loadWikiEditor();
 86+ $this->clearWikiEditor();
 87+ $this->click( "//*[@id='mw-editbutton-link']" );
 88+ $this->clickShowPreviewBtn();
 89+ $this->waitForPageToLoad( "600000" );
 90+
 91+ // Verify internal link displayed on mediawiki preview
 92+ $source = $this->getText( "//*[@id='wikiPreview']/p/a" );
 93+ $correct = strstr( $source, "Link title" );
 94+ try{
 95+ $this->assertEquals( $correct, true );
 96+ echo "\n Pass : Internal link displayed in the preview \n";
 97+
 98+ } catch ( PHPUnit_Framework_AssertionFailedError $e ){
 99+ echo "\n Pass : Internal link displayed in the preview \n";
 100+ }
 101+
 102+ $this->click( "link=Link title" );
 103+ $this->waitForPageToLoad( "600000" );
 104+
 105+ // Verify internal link open as a new page - editing mode
 106+ $source = $this->getText( "firstHeading" );
 107+ $correct = strstr( $source, "Editing Link title" );
 108+ try{
 109+ $this->assertEquals( $correct, true );
 110+ echo "\n Pass : Internal link opened as a new page in the editing mode \n";
 111+
 112+ } catch ( PHPUnit_Framework_AssertionFailedError $e ){
 113+ echo "\n Fail : Internal link opened as a new page in the editing mode \n";
 114+ }
 115+ }
 116+
 117+ // Add external link and verify output in the preview
 118+ public function testAddExternalLink(){
 119+ $this->getExistingPage();
 120+ $this->clickEditLink();
 121+ $this->loadWikiEditor();
 122+ $this->clearWikiEditor();
 123+ $this->click( "//*[@id='mw-editbutton-extlink']" );
 124+ $this->type( "wpTextbox1", "[http://www.google.com Google]" );
 125+ $this->clickShowPreviewBtn();
 126+ $this->waitForPageToLoad( "600000" );
 127+
 128+ // Verify external links displayed on mediawiki preview
 129+ $source = $this->getText( "//*[@id='wikiPreview']/p/a" );
 130+ $correct = strstr( $source, "Google" );
 131+
 132+ try{
 133+ $this->assertEquals( $correct, true );
 134+ echo "\n Pass : External link displayed in the preview \n";
 135+
 136+ } catch ( PHPUnit_Framework_AssertionFailedError $e ){
 137+ echo "\n Fail : External link displayed in thw preview \n";
 138+ }
 139+
 140+ $this->click( "link=Google" );
 141+ $this->waitForPageToLoad( "600000" );
 142+
 143+ // Verify external link opens
 144+ $source = $this->getTitle();
 145+ $correct = strstr( $source, "Google" );
 146+ try{
 147+ $this->assertEquals( $correct, true);
 148+ echo "\n Pass : External link opened \n";
 149+
 150+ } catch (PHPUnit_Framework_AssertionFailedError $e){
 151+ echo "\n Fail : External link opened \n";
 152+ }
 153+
 154+ }
 155+
 156+ // Add level 2 headline and verify output in the preview
 157+ public function testAddLevel2HeadLine(){
 158+ $blnElementPresent = False;
 159+ $blnTextPresent = False;
 160+ $this->getExistingPage();
 161+ $this->clickEditLink();
 162+ $this->loadWikiEditor();
 163+ $this->clearWikiEditor();
 164+ $this->click( "mw-editbutton-headline" );
 165+ $this->clickShowPreviewBtn();
 166+ $this->waitForPageToLoad( "600000" );
 167+
 168+ try {
 169+ $this->assertTrue($this->isElementPresent("//div[@id='wikiPreview']/h2"));
 170+ $blnElementPresent = True;
 171+ } catch ( PHPUnit_Framework_AssertionFailedError $e ){
 172+ $blnElementPresent = False;
 173+ }
 174+
 175+ try{
 176+ $source = $this->getText( "//*[@id='Headline_text']" );
 177+ $correct = strstr( $source, "Headline text" );
 178+ $this->assertEquals( $correct, true );
 179+ $blnTextPresent = True;
 180+ } catch ( PHPUnit_Framework_AssertionFailedError $e ){
 181+ $blnTextPresent = False;
 182+ }
 183+
 184+ if(($blnElementPresent = True) && ($blnTextPresent = True)){
 185+ echo "\n Pass : Headline text displayed in the preview \n";
 186+ }
 187+ else{
 188+ echo "\n Fail : Headline text displayed in the preview \n";
 189+ }
 190+ }
 191+
 192+ // Add text with ignore wiki format and verify output the preview
 193+ public function testAddNoWikiFormat(){
 194+ $this->getExistingPage();
 195+ $this->clickEditLink();
 196+ $this->loadWikiEditor();
 197+ $this->clearWikiEditor();
 198+ $this->click( "//*[@id='mw-editbutton-nowiki']" );
 199+ $this->clickShowPreviewBtn();
 200+ $this->waitForPageToLoad( "600000" );
 201+
 202+ // Verify ignore wiki format text displayed on mediawiki preview
 203+ $source = $this->getText( "//div[@id='wikiPreview']/p" );
 204+ $correct = strstr( $source, "Insert non-formatted text here" );
 205+ try{
 206+ $this->assertEquals( $correct, true );
 207+ echo "\n Pass : Text available without wiki formats in the preview \n ";
 208+
 209+ } catch (PHPUnit_Framework_AssertionFailedError $e){
 210+ echo "\n Fail : Text available without wiki formats in the preview\n ";
 211+ }
 212+ }
 213+
 214+ // Add signature and verify output in the preview
 215+ public function testAddUserSignature(){
 216+ $this->getExistingPage();
 217+ $this->clickEditLink();
 218+ $this->loadWikiEditor();
 219+ $this->clearWikiEditor();
 220+ $this->click( "mw-editbutton-signature" );
 221+ $this->clickShowPreviewBtn();
 222+ $this->waitForPageToLoad( "600000" );
 223+
 224+ // Verify signature displayed on mediawiki preview
 225+ $source = $this->getText( "//*[@id='wikiPreview']/p/a" );
 226+ $username = $this->getText( "//*[@id='pt-userpage']/a" );
 227+ $correct = strstr( $source, $username );
 228+
 229+ try{
 230+ $this->assertEquals( $correct, true);
 231+ echo "\n Pass : Correct name displayed in the preview \n ";
 232+
 233+ } catch (PHPUnit_Framework_AssertionFailedError $e){
 234+ echo "\n Fail : Correct name displayed in the preview \n ";
 235+ }
 236+ }
 237+
 238+ // Add horizontal line and verify output in the preview
 239+ public function testHorizontalLine(){
 240+ $this->getExistingPage();
 241+ $this->clickEditLink();
 242+ $this->loadWikiEditor();
 243+ $this->clearWikiEditor();
 244+ $this->click( "mw-editbutton-hr" );
 245+
 246+ $this->clickShowPreviewBtn();
 247+ $this->waitForPageToLoad( "600000" );
 248+
 249+ // Verify horizontal line displayed on mediawiki preview
 250+ try{
 251+ $this->assertTrue( $this->isElementPresent( "//div[@id='wikiPreview']/hr" ));
 252+ echo "\n Pass: Horizontal line displayed in the preview \n";
 253+ } catch (PHPUnit_Framework_AssertionFailedError $e){
 254+ echo "\n Fail : Horizontal line displayed in the preview \n ";
 255+ }
 256+ }
 257+
 258+
 259+ }
Index: trunk/phase3/maintenance/tests/selenium/suites/AddNewPageTestCase.php
@@ -0,0 +1,61 @@
 2+<?php
 3+/*
 4+ * This test case is part of the SimpleSeleniumTestSuite.
 5+ * Configuration for these tests are dosumented as part of SimpleSeleniumTestSuite.php
 6+ */
 7+class AddNewPageTestCase extends SeleniumTestCase{
 8+
 9+ // Verify adding a new page
 10+ public function testAddNewPage() {
 11+ $this->open( $this->getUrl() .
 12+ '/index.php?title=Main_Page&action=edit' );
 13+ $this->type("searchInput", "new");
 14+ $this->click("searchGoButton");
 15+ $this->waitForPageToLoad("600000");
 16+
 17+ // Verify 'Search results' text available
 18+ $source = $this->gettext( "firstHeading" );
 19+ $correct = strstr( $source, "Search results");
 20+ try{
 21+ $this->assertEquals( $correct, true);
 22+ echo "\n Pass : Text'Search results' displayed \n";
 23+
 24+ } catch (PHPUnit_Framework_AssertionFailedError $e){
 25+ echo "\n Fail : Text' Search results' displayed \n" ;
 26+ }
 27+
 28+ // Verify 'Create the page "<page name>" on this wiki' text available
 29+ $source = $this->gettext( "//div[@id='bodyContent']/div[4]/p/b" );
 30+ $correct = strstr ( $source, "Create the page \"New\" on this wiki!" );
 31+ try{
 32+ $this->assertEquals( $correct, true );
 33+ echo "\n Pass : Text 'Create the page \"New\" on this wiki!' displayed \n";
 34+ } catch (PHPUnit_Framework_AssertionFailedError $e){
 35+ echo "\n Fail : Text 'Create the page \"New\" on this wiki!' displayed \n";
 36+ }
 37+
 38+ $this->click("link=New");
 39+ $this->waitForPageToLoad("600000");
 40+
 41+ // Verify 'Create' tab available
 42+ try{
 43+ $this->assertTrue($this->isElementPresent("link=Create"));
 44+ echo "\n Pass : 'Create' tab displayed \n";
 45+ } catch (PHPUnit_Framework_AssertionFailedError $e) {
 46+ echo "\n Fail : 'Create' tab displayed \n";
 47+ }
 48+
 49+ $this->type("wpTextbox1", "add new test page");
 50+ $this->click("wpSave");
 51+
 52+ // Verify new page added
 53+ $source = $this->gettext( "firstHeading" );
 54+ $correct = strstr ( $source, "New" );
 55+ try{
 56+ $this->assertEquals( $correct, true);
 57+ echo "\n Pass : New page added \n";
 58+ } catch (PHPUnit_Framework_AssertionFailedError $e){
 59+ echo "\n Fail : New page added \n";
 60+ }
 61+ }
 62+}
Index: trunk/phase3/maintenance/tests/selenium/suites/PageSearchTestCase.php
@@ -0,0 +1,123 @@
 2+<?php
 3+/*
 4+ * This test case is part of the SimpleSeleniumTestSuite.
 5+ * Configuration for these tests are dosumented as part of SimpleSeleniumTestSuite.php
 6+ */
 7+class PageSearchTestCase extends SeleniumTestCase{
 8+
 9+ // Verify the functionality of the 'Go' button
 10+ public function testPageSearchBtnGo(){
 11+
 12+ $this->open( $this->getUrl() .
 13+ '/index.php?title=Main_Page&action=edit' );
 14+ $this->type( "searchInput", "calcey qa" );
 15+ $this->click( "searchGoButton" );
 16+ $this->waitForPageToLoad( "600000" );
 17+
 18+ // Verify no page matched with the entered search text
 19+ $source = $this->gettext( "//div[@id='bodyContent']/div[4]/p/b" );
 20+ $correct = strstr ( $source, "Create the page \"Calcey qa\" on this wiki!" );
 21+
 22+ try{
 23+ $this->assertEquals( $correct, true );
 24+ echo "\n Pass : No page matched with the entered search text using the 'Go' button \n";
 25+ } catch (PHPUnit_Framework_AssertionFailedError $e){
 26+ echo "\n Pass : No page matched with the entered search text using the 'Go' button \n";
 27+ }
 28+
 29+ $this->click( "link=Calcey qa" );
 30+ $this->waitForPageToLoad( "600000" );
 31+
 32+ $this->type( "wpTextbox1", "Calcey QA team" );
 33+ $this->click( "wpSave" );
 34+ $this->waitForPageToLoad( "600000" );
 35+
 36+ }
 37+
 38+ // Verify the functionality of the 'Search' button
 39+ public function testPageSearchBtnSearch(){
 40+
 41+ $this->open( $this->getUrl() .
 42+ '/index.php?title=Main_Page&action=edit' );
 43+ $this->type( "searchInput", "Calcey web" );
 44+ $this->click( "mw-searchButton" );
 45+ $this->waitForPageToLoad( "30000" );
 46+
 47+ // Verify no page is available as the search text
 48+ $source = $this->gettext( "//div[@id='bodyContent']/div[4]/p[2]/b" );
 49+ $correct = strstr ( $source, "Create the page \"Calcey web\" on this wiki!" );
 50+
 51+ try{
 52+ $this->assertEquals( $correct, true );
 53+ echo "\n Pass : No page matched with the entered search text using the 'Search' button \n";
 54+ } catch (PHPUnit_Framework_AssertionFailedError $e){
 55+ echo "\n Pass : No page matched with the entered search text using the 'Search' button \n";
 56+ }
 57+
 58+ $this->click( "link=Calcey web" );
 59+ $this->waitForPageToLoad( "600000" );
 60+
 61+ $this->type( "wpTextbox1", "Calcey web team" );
 62+ $this->click( "wpSave" );
 63+ $this->waitForPageToLoad( "600000" );
 64+
 65+
 66+ // Verify saved page is opened when the exact page name is given
 67+ $this->type( "searchInput", "Calcey web" );
 68+ $this->click( "mw-searchButton" );
 69+ $this->waitForPageToLoad( "30000" );
 70+
 71+ $source = $this->getText( "//*[@id='bodyContent']/div[4]/p/b" );
 72+ $correct = strstr( $source, "There is a page named \"Calcey web\" on this wiki." );
 73+
 74+ try{
 75+ $this->assertEquals( $correct, true );
 76+ echo "\n Pass : Exact page matched with the entered search text using 'Search' button \n";
 77+ } catch ( PHPUnit_Framework_AssertionFailedError $e ){
 78+ echo "\n Fail : Exact page matched with the entered search text using 'Search' button \n";
 79+ }
 80+
 81+
 82+ // Verify resutls available when partial page name is entered as the search text
 83+
 84+ $this->type( "searchInput", "Calcey" );
 85+ $this->click( "mw-searchButton" );
 86+ $this->waitForPageToLoad( "30000" );
 87+
 88+ // Verify text avaialble in the search result under the page titles
 89+ if($this->isElementPresent( "Page_title_matches" )){
 90+ try{
 91+ $textPageTitle = $this->getText( "//*[@id='bodyContent']/div[4]/ul[1]/li[1]/div[1]/a" );
 92+ $this->assertContains( 'Calcey', $textPageTitle );
 93+ echo "\n Pass : Results displayed under 'Page title matches' heading for the partial title match match using the 'Search' button\n";
 94+ } catch ( PHPUnit_Framework_AssertionFailedError $e ){
 95+ echo "\n Fail : Results displayed under 'Page title matches' heading for the partial title match match using the 'Search' button \n";
 96+ }
 97+ }
 98+ else{
 99+ echo "\n Pass : No results avaialble for the 'Page title matches' heading for the partial title match using the 'Search' button \n";
 100+ }
 101+
 102+ // Verify text avaialble in the search result under the page text
 103+ if($this->isElementPresent( "Page_text_matches" )){
 104+ try{
 105+ $textPageText = $this->getText( "//*[@id='bodyContent']/div[4]/ul[2]/li[2]/div[2]/span" );
 106+ $this->assertContains( 'Calcey', $textPageText );
 107+
 108+ echo "\n Pass : Results displayed under 'Page text matches' heading for the partial text match using the 'Search' button \n";
 109+
 110+ } catch ( PHPUnit_Framework_AssertionFailedError $e ){
 111+ echo "\n Fail : Results displayed under 'Page text matches' heading for the partial text match using the 'Search' button \n";
 112+ }
 113+ }
 114+ else{
 115+ echo "\n Pass : No results avaialble for the 'Page text matches' heading for the partial title match using the 'Search' button\n";
 116+ }
 117+ $this->deletePage("Calcey QA");
 118+ $this->deletePage("Calcey web");
 119+
 120+ }
 121+
 122+
 123+
 124+}
Index: trunk/phase3/maintenance/tests/selenium/suites/MediaWikiEditorConfig.php
@@ -0,0 +1,16 @@
 2+<?php
 3+class MediaWikiEditorConfig {
 4+
 5+ public static function getSettings(&$includeFiles, &$globalConfigs) {
 6+ $includes = array(
 7+ //files that needed to be included would go here
 8+ 'maintenance/tests/selenium/suites/MediaWikiCommonFunc.php'
 9+ );
 10+ $configs = array(
 11+ 'wgDefaultSkin' => 'chick'
 12+ );
 13+ $includeFiles = array_merge( $includeFiles, $includes );
 14+ $globalConfigs = array_merge( $globalConfigs, $configs);
 15+ return true;
 16+ }
 17+}
\ No newline at end of file
Index: trunk/phase3/maintenance/tests/selenium/suites/DeletePageAdminTestCase.php
@@ -0,0 +1,68 @@
 2+<?php
 3+/*
 4+ * This test case is part of the SimpleSeleniumTestSuite.
 5+ * Configuration for these tests are dosumented as part of SimpleSeleniumTestSuite.php
 6+ */
 7+class DeletePageAdminTestCase extends SeleniumTestCase{
 8+
 9+ // Verify adding a new page
 10+ public function testDeletePage() {
 11+ $this->open( $this->getUrl() .
 12+ '/index.php?title=Main_Page&action=edit' );
 13+ $this->click("link=Log out");
 14+ $this->waitForPageToLoad( "30000" );
 15+ $this->click( "link=Log in / create account" );
 16+ $this->waitForPageToLoad( "30000" );
 17+ $this->type( "wpName1", "nadeesha" );
 18+ $this->type( "wpPassword1", "12345" );
 19+ $this->click( "wpLoginAttempt" );
 20+ $this->waitForPageToLoad( "30000" );
 21+ $this->type( "searchInput", "new" );
 22+ $this->click( "searchGoButton");
 23+ $this->waitForPageToLoad( "30000" );
 24+
 25+ // Verify 'Delete' link displayed
 26+ $source = $this->gettext( "link=Delete" );
 27+ $correct = strstr ( $source, "Delete" );
 28+ try{
 29+ $this->assertEquals( $correct, true);
 30+ echo "\n Pass : 'Delete' link displayed \n";
 31+ } catch (PHPUnit_Framework_AssertionFailedError $e){
 32+ echo "\n Fail : 'Delete' link displayed \n";
 33+ }
 34+ $this->click( "link=Delete" );
 35+ $this->waitForPageToLoad( "30000" );
 36+
 37+ // Verify 'Delete' button available
 38+ $this->assertTrue($this->isElementPresent( "wpConfirmB" ));
 39+
 40+ try{
 41+ $this->assertTrue($this->isElementPresent( "wpConfirmB" ));
 42+ echo "\n Pass : 'Delete' button available \n";
 43+ } catch ( PHPUnit_Framework_AssertionFailedError $e ){
 44+ echo "\n Fail : 'Delete' button available \n";
 45+ }
 46+ $this->click( "wpConfirmB" );
 47+ $this->waitForPageToLoad( "30000" );
 48+
 49+ // Verify 'Action complete' text displayed
 50+ $source = $this->gettext( "firstHeading" );
 51+ $correct = strstr ( $source, "Action complete" );
 52+ try{
 53+ $this->assertEquals( $correct, true );
 54+ echo "\n Pass : 'Action complete' text displayed \n";
 55+ }catch ( PHPUnit_Framework_AssertionFailedError $e ){
 56+ echo "\n Fail : 'Action complete' text displayed \n";
 57+ }
 58+
 59+ // Verify '<Page Name> has been deleted. See deletion log for a record of recent deletions.' text displayed
 60+ $source = $this->gettext( "//div[@id='bodyContent']/p[1]" );
 61+ $correct = strstr ( $source, "\"New\" has been deleted. See deletion log for a record of recent deletions." );
 62+ try{
 63+ $this->assertEquals( $correct, true );
 64+ echo "\n Pass : Page deleted successfully \n";
 65+ } catch ( PHPUnit_Framework_AssertionFailedError $e ){
 66+ echo "\n Fail : Page deleted successfully \n";
 67+ }
 68+ }
 69+}
Index: trunk/phase3/maintenance/tests/selenium/suites/MediaWikiEditorTestSuite.php
@@ -0,0 +1,30 @@
 2+<?php
 3+/*
 4+ * Sample test suite.
 5+ * Two ways to configure MW for these tests
 6+ * 1) If you are running multiple test suites, add the following in LocalSettings.php
 7+ * require_once("maintenance/tests/selenium/SimpleSeleniumConfig.php");
 8+ * $wgSeleniumTestConfigs['SimpleSeleniumTestSuite'] = 'SimpleSeleniumConfig::getSettings';
 9+ * OR
 10+ * 2) Add the following to your Localsettings.php
 11+ * $wgDefaultSkin = 'chick';
 12+ */
 13+class MediaWikiEditorTestSuite extends SeleniumTestSuite
 14+{
 15+ public function setUp() {
 16+ $this->setLoginBeforeTests( True );
 17+ parent::setUp();
 18+ }
 19+ public function addTests() {
 20+ $testFiles = array(
 21+ 'maintenance/tests/selenium/suites/AddNewPageTestCase.php',
 22+ 'maintenance/tests/selenium/suites/AddContentToNewPageTestCase.php',
 23+ 'maintenance/tests/selenium/suites/DeletePageAdminTestCase.php',
 24+ 'maintenance/tests/selenium/suites/PageSearchTestCase.php'
 25+
 26+ );
 27+ parent::addTestFiles( $testFiles );
 28+ }
 29+
 30+
 31+}
Index: trunk/phase3/maintenance/tests/selenium/suites/MediaWikiCommonFunc.php
@@ -0,0 +1,77 @@
 2+<?php
 3+
 4+
 5+class MediaWikiCommonFunc{
 6+
 7+ // Getting existing page
 8+ public function getExistingPage(){
 9+ $this->open( $this->getUrl() .
 10+ '/index.php?title=Main_Page&action=edit' );
 11+ $this->type("searchInput", "new" );
 12+ $this->click("searchGoButton");
 13+ $this->waitForPageToLoad("30000");
 14+ }
 15+
 16+ // Creating new page
 17+ public function getNewPage($pageName){
 18+
 19+ $this->open( $this->getUrl() .
 20+ '/index.php?title=Main_Page&action=edit' );
 21+ $this->type("searchInput", $pageName );
 22+ $this->click("searchGoButton");
 23+ $this->waitForPageToLoad("30000");
 24+ $this->click("link=".$pageName);
 25+ $this->waitForPageToLoad("600000");
 26+ }
 27+
 28+ // Deleting the given page
 29+ public function deletePage($pageName){
 30+ $this->open( $this->getUrl() .
 31+ '/index.php?title=Main_Page&action=edit' );
 32+ $this->click("link=Log out");
 33+ $this->waitForPageToLoad( "30000" );
 34+ $this->click( "link=Log in / create account" );
 35+ $this->waitForPageToLoad( "30000" );
 36+ $this->type( "wpName1", "nadeesha" );
 37+ $this->type( "wpPassword1", "12345" );
 38+ $this->click( "wpLoginAttempt" );
 39+ $this->waitForPageToLoad( "30000" );
 40+ $this->type( "searchInput", $pageName );
 41+ $this->click( "searchGoButton");
 42+ $this->waitForPageToLoad( "30000" );
 43+ $this->click( "link=Delete" );
 44+ $this->waitForPageToLoad( "30000" );
 45+ $this->click( "wpConfirmB" );
 46+ $this->waitForPageToLoad( "30000" );
 47+ }
 48+
 49+ // Loading the mediawiki editor
 50+ public function loadWikiEditor(){
 51+ $this->open( $this->getUrl() .
 52+ '/index.php?title=Main_Page&action=edit' );
 53+ }
 54+
 55+ // Clear the content of the mediawiki editor
 56+ public function clearWikiEditor(){
 57+ $this->type("wpTextbox1", "");
 58+ }
 59+
 60+ // Click on the 'Show preview' button of the mediawiki editor
 61+ public function clickShowPreviewBtn(){
 62+ $this->click("wpPreview");
 63+ }
 64+
 65+ // Click on the 'Save Page' button of the mediawiki editor
 66+ public function clickSavePageBtn(){
 67+ $this->click("wpSave");
 68+ }
 69+
 70+ // Click on the 'Edit' link
 71+ public function clickEditLink(){
 72+ $this->click("link=Edit");
 73+ $this->waitForPageToLoad("30000");
 74+ }
 75+
 76+
 77+
 78+}

Follow-up revisions

RevisionCommit summaryAuthorDate
r77592Followup r77556, set svn:eol-style native...reedy17:23, 2 December 2010

Comments

#Comment by Reedy (talk | contribs)   17:24, 2 December 2010

Please setup your SVN Auto props

Status & tagging log