r77654 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77653‎ | r77654 | r77655 >
Date:14:10, 3 December 2010
Author:nadeesha
Status:deferred (Comments)
Tags:
Comment:
Added test scripts for wiki editor additional features and updated scripts on wiki basic editor. MediaWikiCommonFunction.php is deleted, since it is no longer used by the scripts.
Modified paths:
  • /trunk/phase3/maintenance/tests/selenium/suites/AddContentToNewPageTestCase.php (modified) (history)
  • /trunk/phase3/maintenance/tests/selenium/suites/AddNewPageTestCase.php (modified) (history)
  • /trunk/phase3/maintenance/tests/selenium/suites/CreateAccountTestCase.php (added) (history)
  • /trunk/phase3/maintenance/tests/selenium/suites/DeletePageAdminTestCase.php (modified) (history)
  • /trunk/phase3/maintenance/tests/selenium/suites/EmailPasswordTestCase.php (added) (history)
  • /trunk/phase3/maintenance/tests/selenium/suites/MediaWikExtraTestSuite.php (added) (history)
  • /trunk/phase3/maintenance/tests/selenium/suites/MediaWikiCommonFunc.php (deleted) (history)
  • /trunk/phase3/maintenance/tests/selenium/suites/MediaWikiEditorConfig.php (modified) (history)
  • /trunk/phase3/maintenance/tests/selenium/suites/MediaWikiEditorTestSuite.php (modified) (history)
  • /trunk/phase3/maintenance/tests/selenium/suites/MovePageTestCase.php (added) (history)
  • /trunk/phase3/maintenance/tests/selenium/suites/MyContributionsTestCase.php (added) (history)
  • /trunk/phase3/maintenance/tests/selenium/suites/MyWatchListTestCase.php (added) (history)
  • /trunk/phase3/maintenance/tests/selenium/suites/PageDeleteTestSuite.php (added) (history)
  • /trunk/phase3/maintenance/tests/selenium/suites/PageSearchTestCase.php (modified) (history)
  • /trunk/phase3/maintenance/tests/selenium/suites/PreviewPageTestCase.php (added) (history)
  • /trunk/phase3/maintenance/tests/selenium/suites/SavePageTestCase.php (added) (history)
  • /trunk/phase3/maintenance/tests/selenium/suites/UserPreferencesTestCase.php (added) (history)

Diff [purge]

Index: trunk/phase3/maintenance/tests/selenium/suites/MediaWikiCommonFunc.php
@@ -1,77 +0,0 @@
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 -}
Index: trunk/phase3/maintenance/tests/selenium/suites/AddContentToNewPageTestCase.php
@@ -1,258 +1,182 @@
22 <?php
3 -/*
4 - * This test case is part of the SimpleSeleniumTestSuite.
5 - * Configuration for these tests are dosumented as part of SimpleSeleniumTestSuite.php
 3+
 4+/**
 5+ * Selenium server manager
 6+ *
 7+ * @file
 8+ * @ingroup Maintenance
 9+ * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com>
 10+ * http://citizendium.org/
 11+ *
 12+ * This program is free software; you can redistribute it and/or modify
 13+ * it under the terms of the GNU General Public License as published by
 14+ * the Free Software Foundation; either version 2 of the License, or
 15+ * (at your option) any later version.
 16+ *
 17+ * This program is distributed in the hope that it will be useful,
 18+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 19+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 20+ * GNU General Public License for more details.
 21+ *
 22+ * You should have received a copy of the GNU General Public License along
 23+ * with this program; if not, write to the Free Software Foundation, Inc.,
 24+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 25+ * http://www.gnu.org/copyleft/gpl.html
 26+ *
 27+ * @addtogroup Maintenance
 28+ *
629 */
7 -class AddContentToNewPageTestCase extends SeleniumTestCase{
830
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 - }
2731
28 - try{
29 - $this->assertTrue($this->isTextPresent( "Bold text" ));
30 - $blnTextPresent = True;
 32+class AddContentToNewPageTestCase extends SeleniumTestCase {
3133
32 - } catch ( PHPUnit_Framework_AssertionFailedError $e ){
33 - $blnTextPresent = False;
34 - }
 34+
 35+ // Add bold text and verify output
 36+ public function testAddBoldText() {
3537
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" );
 38+ $this->getExistingPage();
 39+ $this->clickEditLink();
 40+ $this->loadWikiEditor();
 41+ $this->clearWikiEditor();
 42+ $this->click( "//*[@id='mw-editbutton-bold']" );
 43+ $this->clickShowPreviewBtn();
 44+ $this->waitForPageToLoad( "600000" );
5445
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 - }
 46+ // Verify bold text displayed on mediawiki preview
 47+ $this->assertTrue($this->isElementPresent( "//div[@id='wikiPreview']/p/b" ));
 48+ $this->assertTrue($this->isTextPresent( "Bold text" ));
 49+ }
6250
63 - try{
64 - $this->assertTrue($this->isTextPresent( "Italic text" ));
65 - $blnTextPresent = True;
 51+ // Add italic text and verify output
 52+ public function testAddItalicText() {
6653
67 - } catch ( PHPUnit_Framework_AssertionFailedError $e ){
68 - $blnTextPresent = False;
69 - }
 54+ $this->getExistingPage();
 55+ $this->clickEditLink();
 56+ $this->loadWikiEditor();
 57+ $this->clearWikiEditor();
 58+ $this->click( "//*[@id='mw-editbutton-italic']" );
 59+ $this->clickShowPreviewBtn();
 60+ $this->waitForPageToLoad( "600000" );
7061
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 - }
 62+ // Verify italic text displayed on mediawiki preview
 63+ $this->assertTrue($this->isElementPresent("//div[@id='wikiPreview']/p/i"));
 64+ $this->assertTrue($this->isTextPresent( "Italic text" ));
 65+ }
7866
79 - }
 67+ // Add internal link for a new page and verify output in the preview
 68+ public function testAddInternalLinkNewPage() {
 69+ $this->getExistingPage();
 70+ $this->clickEditLink();
 71+ $this->loadWikiEditor();
 72+ $this->clearWikiEditor();
 73+ $this->click( "//*[@id='mw-editbutton-link']" );
 74+ $this->clickShowPreviewBtn();
 75+ $this->waitForPageToLoad( "600000" );
8076
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" );
 77+ // Verify internal link displayed on mediawiki preview
 78+ $source = $this->getText( "//*[@id='wikiPreview']/p/a" );
 79+ $correct = strstr( $source, "Link title" );
 80+ $this->assertEquals( $correct, true );
9081
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";
 82+ $this->click( "link=Link title" );
 83+ $this->waitForPageToLoad( "600000" );
9784
98 - } catch ( PHPUnit_Framework_AssertionFailedError $e ){
99 - echo "\n Pass : Internal link displayed in the preview \n";
100 - }
 85+ // Verify internal link open as a new page - editing mode
 86+ $source = $this->getText( "firstHeading" );
 87+ $correct = strstr( $source, "Editing Link title" );
 88+ $this->assertEquals( $correct, true );
 89+ }
10190
102 - $this->click( "link=Link title" );
103 - $this->waitForPageToLoad( "600000" );
 91+ // Add external link and verify output in the preview
 92+ public function testAddExternalLink() {
 93+ $this->getExistingPage();
 94+ $this->clickEditLink();
 95+ $this->loadWikiEditor();
 96+ $this->clearWikiEditor();
 97+ $this->click( "//*[@id='mw-editbutton-extlink']" );
 98+ $this->type( "wpTextbox1", "[http://www.google.com Google]" );
 99+ $this->clickShowPreviewBtn();
 100+ $this->waitForPageToLoad( "600000" );
104101
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";
 102+ // Verify external links displayed on mediawiki preview
 103+ $source = $this->getText( "//*[@id='wikiPreview']/p/a" );
 104+ $correct = strstr( $source, "Google" );
 105+ $this->assertEquals( $correct, true );
111106
112 - } catch ( PHPUnit_Framework_AssertionFailedError $e ){
113 - echo "\n Fail : Internal link opened as a new page in the editing mode \n";
114 - }
115 - }
 107+ $this->click( "link=Google" );
 108+ $this->waitForPageToLoad( "600000" );
116109
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" );
 110+ // Verify external link opens
 111+ $source = $this->getTitle();
 112+ $correct = strstr( $source, "Google" );
 113+ $this->assertEquals( $correct, true);
 114+ }
127115
128 - // Verify external links displayed on mediawiki preview
129 - $source = $this->getText( "//*[@id='wikiPreview']/p/a" );
130 - $correct = strstr( $source, "Google" );
 116+ // Add level 2 headline and verify output in the preview
 117+ public function testAddLevel2HeadLine() {
 118+ $blnElementPresent = False;
 119+ $blnTextPresent = False;
 120+ $this->getExistingPage();
 121+ $this->clickEditLink();
 122+ $this->loadWikiEditor();
 123+ $this->clearWikiEditor();
 124+ $this->click( "mw-editbutton-headline" );
 125+ $this->clickShowPreviewBtn();
 126+ $this->waitForPageToLoad( "600000" );
 127+ $this->assertTrue($this->isElementPresent( "//div[@id='wikiPreview']/h2" ));
131128
132 - try{
133 - $this->assertEquals( $correct, true );
134 - echo "\n Pass : External link displayed in the preview \n";
 129+ // Verify level 2 headline displayed on mediawiki preview
 130+ $source = $this->getText( "//*[@id='Headline_text']" );
 131+ $correct = strstr( $source, "Headline text" );
 132+ $this->assertEquals( $correct, true );
 133+ }
135134
136 - } catch ( PHPUnit_Framework_AssertionFailedError $e ){
137 - echo "\n Fail : External link displayed in thw preview \n";
138 - }
 135+ // Add text with ignore wiki format and verify output the preview
 136+ public function testAddNoWikiFormat() {
 137+ $this->getExistingPage();
 138+ $this->clickEditLink();
 139+ $this->loadWikiEditor();
 140+ $this->clearWikiEditor();
 141+ $this->click( "//*[@id='mw-editbutton-nowiki']" );
 142+ $this->clickShowPreviewBtn();
 143+ $this->waitForPageToLoad( "600000" );
139144
140 - $this->click( "link=Google" );
141 - $this->waitForPageToLoad( "600000" );
 145+ // Verify ignore wiki format text displayed on mediawiki preview
 146+ $source = $this->getText( "//div[@id='wikiPreview']/p" );
 147+ $correct = strstr( $source, "Insert non-formatted text here" );
 148+ $this->assertEquals( $correct, true );
 149+ }
142150
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";
 151+ // Add signature and verify output in the preview
 152+ public function testAddUserSignature() {
 153+ $this->getExistingPage();
 154+ $this->clickEditLink();
 155+ $this->loadWikiEditor();
 156+ $this->clearWikiEditor();
 157+ $this->click( "mw-editbutton-signature" );
 158+ $this->clickShowPreviewBtn();
 159+ $this->waitForPageToLoad( "600000" );
149160
150 - } catch (PHPUnit_Framework_AssertionFailedError $e){
151 - echo "\n Fail : External link opened \n";
152 - }
 161+ // Verify signature displayed on mediawiki preview
 162+ $source = $this->getText( "//*[@id='wikiPreview']/p/a" );
 163+ $username = $this->getText( "//*[@id='pt-userpage']/a" );
 164+ $correct = strstr( $source, $username );
 165+ $this->assertEquals( $correct, true );
 166+ }
153167
154 - }
 168+ // Add horizontal line and verify output in the preview
 169+ public function testHorizontalLine() {
 170+ $this->getExistingPage();
 171+ $this->clickEditLink();
 172+ $this->loadWikiEditor();
 173+ $this->clearWikiEditor();
 174+ $this->click( "mw-editbutton-hr" );
155175
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" );
 176+ $this->clickShowPreviewBtn();
 177+ $this->waitForPageToLoad( "600000" );
167178
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 - }
 179+ // Verify horizontal line displayed on mediawiki preview
 180+ $this->assertTrue( $this->isElementPresent( "//div[@id='wikiPreview']/hr" ));
 181+ $this->deletePage( "new" );
 182+ }
 183+}
Index: trunk/phase3/maintenance/tests/selenium/suites/AddNewPageTestCase.php
@@ -1,61 +1,65 @@
22 <?php
3 -/*
4 - * This test case is part of the SimpleSeleniumTestSuite.
5 - * Configuration for these tests are dosumented as part of SimpleSeleniumTestSuite.php
 3+
 4+/**
 5+ * Selenium server manager
 6+ *
 7+ * @file
 8+ * @ingroup Maintenance
 9+ * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com>
 10+ * http://citizendium.org/
 11+ *
 12+ * This program is free software; you can redistribute it and/or modify
 13+ * it under the terms of the GNU General Public License as published by
 14+ * the Free Software Foundation; either version 2 of the License, or
 15+ * (at your option) any later version.
 16+ *
 17+ * This program is distributed in the hope that it will be useful,
 18+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 19+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 20+ * GNU General Public License for more details.
 21+ *
 22+ * You should have received a copy of the GNU General Public License along
 23+ * with this program; if not, write to the Free Software Foundation, Inc.,
 24+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 25+ * http://www.gnu.org/copyleft/gpl.html
 26+ *
 27+ * @addtogroup Maintenance
 28+ *
629 */
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");
1630
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 - }
2731
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");
 32+class AddNewPageTestCase extends SeleniumTestCase {
4033
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 - }
 34+ // Verify adding a new page
 35+ public function testAddNewPage() {
 36+ $newPage = "new";
 37+ $displayName = "New";
 38+ $this->open( $this->getUrl() .
 39+ '/index.php?title=Main_Page&action=edit' );
 40+ $this->type( "searchInput", $newPage );
 41+ $this->click( "searchGoButton" );
 42+ $this->waitForPageToLoad( "600000" );
4843
49 - $this->type("wpTextbox1", "add new test page");
50 - $this->click("wpSave");
 44+ // Verify 'Search results' text available
 45+ $source = $this->gettext( "firstHeading" );
 46+ $correct = strstr( $source, "Search results" );
 47+ $this->assertEquals( $correct, true);
5148
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 - }
 49+ // Verify 'Create the page "<page name>" on this wiki' text available
 50+ $source = $this->gettext( "//div[@id='bodyContent']/div[4]/p/b" );
 51+ $correct = strstr ( $source, "Create the page \"New\" on this wiki!" );
 52+ $this->assertEquals( $correct, true );
 53+
 54+ $this->click( "link=".$displayName );
 55+ $this->waitForPageToLoad( "600000" );
 56+
 57+ $this->assertTrue($this->isElementPresent( "link=Create" ));
 58+ $this->type( "wpTextbox1", "add new test page" );
 59+ $this->click( "wpSave" );
 60+
 61+ // Verify new page added
 62+ $source = $this->gettext( "firstHeading" );
 63+ $correct = strstr ( $source, $displayName );
 64+ $this->assertEquals( $correct, true );
 65+ }
6266 }
Index: trunk/phase3/maintenance/tests/selenium/suites/UserPreferencesTestCase.php
@@ -0,0 +1,179 @@
 2+<?php
 3+
 4+/**
 5+ * Selenium server manager
 6+ *
 7+ * @file
 8+ * @ingroup Maintenance
 9+ * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com>
 10+ * http://citizendium.org/
 11+ *
 12+ * This program is free software; you can redistribute it and/or modify
 13+ * it under the terms of the GNU General Public License as published by
 14+ * the Free Software Foundation; either version 2 of the License, or
 15+ * (at your option) any later version.
 16+ *
 17+ * This program is distributed in the hope that it will be useful,
 18+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 19+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 20+ * GNU General Public License for more details.
 21+ *
 22+ * You should have received a copy of the GNU General Public License along
 23+ * with this program; if not, write to the Free Software Foundation, Inc.,
 24+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 25+ * http://www.gnu.org/copyleft/gpl.html
 26+ *
 27+ * @addtogroup Maintenance
 28+ *
 29+ */
 30+
 31+class UserPreferencesTestCase extends SeleniumTestCase {
 32+
 33+ // Verify user information
 34+ public function testUserInfoDisplay() {
 35+
 36+ $this->open( $this->getUrl() .
 37+ '/index.php?title=Main_Page&action=edit' );
 38+ $this->click( "link=My preferences" );
 39+ $this->waitForPageToLoad( "30000" );
 40+
 41+ // Verify correct username displayed in User Preferences
 42+ $this->assertEquals( $this->getText( "//li[@id='pt-userpage']/a" ),
 43+ $this->getText( "//table[@id='mw-htmlform-info']/tbody/tr[1]/td[2]" ));
 44+
 45+ // Verify existing Signature Displayed correctly
 46+ $this->assertEquals( $this->selenium->getUser(),
 47+ $this->getTable( "mw-htmlform-signature.0.1" ) );
 48+ }
 49+
 50+ // Verify change password
 51+ public function testChangePassword() {
 52+
 53+ $this->open( $this->getUrl() .
 54+ '/index.php?title=Main_Page&action=edit' );
 55+ $this->click( "link=My preferences" );
 56+ $this->waitForPageToLoad( "30000" );
 57+
 58+ $this->click( "link=Change password" );
 59+ $this->waitForPageToLoad( "30000" );
 60+
 61+ $this->type( "wpPassword", "12345" );
 62+ $this->type( "wpNewPassword", "54321" );
 63+ $this->type( "wpRetype", "54321" );
 64+ $this->click( "//input[@value='Change password']" );
 65+ $this->waitForPageToLoad( "30000" );
 66+
 67+ $this->assertEquals( "Preferences", $this->getText( "firstHeading" ));
 68+
 69+ $this->click( "link=Change password" );
 70+ $this->waitForPageToLoad( "30000" );
 71+
 72+ $this->type( "wpPassword", "54321" );
 73+ $this->type( "wpNewPassword", "12345" );
 74+ $this->type( "wpRetype", "12345" );
 75+ $this->click( "//input[@value='Change password']" );
 76+ $this->waitForPageToLoad( "30000" );
 77+ $this->assertEquals( "Preferences", $this->getText( "firstHeading" ));
 78+
 79+ $this->click( "link=Change password" );
 80+ $this->waitForPageToLoad( "30000" );
 81+
 82+ $this->type( "wpPassword", "54321" );
 83+ $this->type( "wpNewPassword", "12345" );
 84+ $this->type( "wpRetype", "12345" );
 85+ $this->click( "//input[@value='Change password']" );
 86+ $this->waitForPageToLoad( "30000" );
 87+ }
 88+
 89+ // Verify successful preferences save
 90+ public function testSuccessfullSave() {
 91+
 92+ $this->open( $this->getUrl() .
 93+ '/index.php?title=Main_Page&action=edit' );
 94+ $this->click( "link=My preferences" );
 95+ $this->waitForPageToLoad( "30000" );
 96+
 97+ $this->type( "mw-input-realname", "Test User" );
 98+ $this->click( "prefcontrol" );
 99+ $this->waitForPageToLoad( "30000" );
 100+
 101+ // Verify "Your preferences have been saved." message
 102+ $this->assertEquals( "Your preferences have been saved.",
 103+ $this->getText( "//div[@id='bodyContent']/div[4]/strong/p" ));
 104+ $this->type( "mw-input-realname", "" );
 105+ $this->click( "prefcontrol" );
 106+ $this->waitForPageToLoad( "30000" );
 107+
 108+ }
 109+
 110+ // Verify change signature
 111+ public function testChangeSignature() {
 112+
 113+ $this->open( $this->getUrl() .
 114+ '/index.php?title=Main_Page&action=edit' );
 115+ $this->click( "link=My preferences" );
 116+ $this->waitForPageToLoad( "30000" );
 117+
 118+ $this->type( "mw-input-nickname", "TestSignature" );
 119+ $this->click( "prefcontrol" );
 120+ $this->waitForPageToLoad( "30000" );
 121+
 122+ // Verify change user signature
 123+ $this->assertEquals( "TestSignature", $this->getText( "link=TestSignature" ));
 124+ $this->type( "mw-input-nickname", "Test" );
 125+ $this->click( "prefcontrol" );
 126+ $this->waitForPageToLoad("30000");
 127+ }
 128+
 129+ // Verify change date format
 130+ public function testChangeDateFormatTimeZone() {
 131+
 132+ $this->open( $this->getUrl() .
 133+ '/index.php?title=Main_Page&action=edit' );
 134+
 135+ $this->click( "link=My preferences" );
 136+ $this->waitForPageToLoad( "30000" );
 137+ $this->click( "link=Date and time" );
 138+ $this->waitForPageToLoad( "30000" );
 139+
 140+ $this->click( "mw-input-date-dmy" );
 141+ $this->select( "mw-input-timecorrection", "label=Asia/Colombo" );
 142+ $this->click( "prefcontrol" );
 143+ $this->waitForPageToLoad( "30000" );
 144+
 145+ // Verify Date format and time zome saved
 146+ $this->assertEquals( "Your preferences have been saved.",
 147+ $this->getText( "//div[@id='bodyContent']/div[4]/strong/p" ));
 148+ }
 149+
 150+ // Verify restoring all default settings
 151+ public function testSetAllDefault() {
 152+
 153+ $this->open( $this->getUrl() .
 154+ '/index.php?title=Main_Page&action=edit' );
 155+ $this->click( "link=My preferences" );
 156+ $this->waitForPageToLoad( "30000" );
 157+
 158+ // Verify restoring all default settings
 159+ $this->assertEquals( "Restore all default settings",
 160+ $this->getText( "link=Restore all default settings" ));
 161+
 162+ $this->click("//*[@id='preferences']/div/a");
 163+ $this->waitForPageToLoad("30000");
 164+
 165+ // Verify 'This can not be undone' warning message displayed
 166+ $this->assertTrue($this->isElementPresent("//input[@value='Restore all default settings']"));
 167+
 168+ // Verify 'Restore all default settings' button available
 169+ $this->assertEquals("You can use this page to reset your preferences to the site defaults. This cannot be undone.",
 170+ $this->getText("//div[@id='bodyContent']/p"));
 171+
 172+ $this->click("//input[@value='Restore all default settings']");
 173+ $this->waitForPageToLoad("30000");
 174+
 175+ // Verify preferences saved successfully
 176+ $this->assertEquals("Your preferences have been saved.",
 177+ $this->getText("//div[@id='bodyContent']/div[4]/strong/p"));
 178+ }
 179+}
 180+?>
Index: trunk/phase3/maintenance/tests/selenium/suites/PageSearchTestCase.php
@@ -1,123 +1,105 @@
22 <?php
3 -/*
4 - * This test case is part of the SimpleSeleniumTestSuite.
5 - * Configuration for these tests are dosumented as part of SimpleSeleniumTestSuite.php
 3+
 4+/**
 5+ * Selenium server manager
 6+ *
 7+ * @file
 8+ * @ingroup Maintenance
 9+ * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com>
 10+ * http://citizendium.org/
 11+ *
 12+ * This program is free software; you can redistribute it and/or modify
 13+ * it under the terms of the GNU General Public License as published by
 14+ * the Free Software Foundation; either version 2 of the License, or
 15+ * (at your option) any later version.
 16+ *
 17+ * This program is distributed in the hope that it will be useful,
 18+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 19+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 20+ * GNU General Public License for more details.
 21+ *
 22+ * You should have received a copy of the GNU General Public License along
 23+ * with this program; if not, write to the Free Software Foundation, Inc.,
 24+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 25+ * http://www.gnu.org/copyleft/gpl.html
 26+ *
 27+ * @addtogroup Maintenance
 28+ *
629 */
7 -class PageSearchTestCase extends SeleniumTestCase{
830
9 - // Verify the functionality of the 'Go' button
10 - public function testPageSearchBtnGo(){
 31+class PageSearchTestCase extends SeleniumTestCase {
1132
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" );
 33+ // Verify the functionality of the 'Go' button
 34+ public function testPageSearchBtnGo() {
1735
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!" );
 36+ $this->open( $this->getUrl() .
 37+ '/index.php?title=Main_Page&action=edit' );
 38+ $this->type( "searchInput", "calcey qa" );
 39+ $this->click( "searchGoButton" );
 40+ $this->waitForPageToLoad( "600000" );
2141
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 - }
 42+ // Verify no page matched with the entered search text
 43+ $source = $this->gettext( "//div[@id='bodyContent']/div[4]/p/b" );
 44+ $correct = strstr ( $source, "Create the page \"Calcey qa\" on this wiki!" );
 45+ $this->assertEquals( $correct, true );
2846
29 - $this->click( "link=Calcey qa" );
30 - $this->waitForPageToLoad( "600000" );
 47+ $this->click( "link=Calcey qa" );
 48+ $this->waitForPageToLoad( "600000" );
3149
32 - $this->type( "wpTextbox1", "Calcey QA team" );
33 - $this->click( "wpSave" );
34 - $this->waitForPageToLoad( "600000" );
 50+ $this->type( "wpTextbox1", "Calcey QA team" );
 51+ $this->click( "wpSave" );
 52+ $this->waitForPageToLoad( "600000" );
3553
36 - }
 54+ }
3755
38 - // Verify the functionality of the 'Search' button
39 - public function testPageSearchBtnSearch(){
 56+ // Verify the functionality of the 'Search' button
 57+ public function testPageSearchBtnSearch() {
4058
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" );
 59+ $this->open( $this->getUrl() .
 60+ '/index.php?title=Main_Page&action=edit' );
 61+ $this->type( "searchInput", "Calcey web" );
 62+ $this->click( "mw-searchButton" );
 63+ $this->waitForPageToLoad( "30000" );
4664
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!" );
 65+ // Verify no page is available as the search text
 66+ $source = $this->gettext( "//div[@id='bodyContent']/div[4]/p[2]/b" );
 67+ $correct = strstr ( $source, "Create the page \"Calcey web\" on this wiki!" );
 68+ $this->assertEquals( $correct, true );
5069
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 - }
 70+ $this->click( "link=Calcey web" );
 71+ $this->waitForPageToLoad( "600000" );
5772
58 - $this->click( "link=Calcey web" );
59 - $this->waitForPageToLoad( "600000" );
 73+ $this->type( "wpTextbox1", "Calcey web team" );
 74+ $this->click( "wpSave" );
 75+ $this->waitForPageToLoad( "600000" );
6076
61 - $this->type( "wpTextbox1", "Calcey web team" );
62 - $this->click( "wpSave" );
63 - $this->waitForPageToLoad( "600000" );
 77+ // Verify saved page is opened when the exact page name is given
 78+ $this->type( "searchInput", "Calcey web" );
 79+ $this->click( "mw-searchButton" );
 80+ $this->waitForPageToLoad( "30000" );
6481
 82+ // Verify exact page matched with the entered search text using 'Search' button
 83+ $source = $this->getText( "//*[@id='bodyContent']/div[4]/p/b" );
 84+ $correct = strstr( $source, "There is a page named \"Calcey web\" on this wiki." );
 85+ $this->assertEquals( $correct, true );
6586
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" );
 87+ // Verify resutls available when partial page name is entered as the search text
 88+ $this->type( "searchInput", "Calcey" );
 89+ $this->click( "mw-searchButton" );
 90+ $this->waitForPageToLoad( "30000" );
7091
71 - $source = $this->getText( "//*[@id='bodyContent']/div[4]/p/b" );
72 - $correct = strstr( $source, "There is a page named \"Calcey web\" on this wiki." );
 92+ // Verify text avaialble in the search result under the page titles
 93+ if($this->isElementPresent( "Page_title_matches" )) {
 94+ $textPageTitle = $this->getText( "//*[@id='bodyContent']/div[4]/ul[1]/li[1]/div[1]/a" );
 95+ $this->assertContains( 'Calcey', $textPageTitle );
 96+ }
7397
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 -
 98+ // Verify text avaialble in the search result under the page text
 99+ if($this->isElementPresent( "Page_text_matches" )) {
 100+ $textPageText = $this->getText( "//*[@id='bodyContent']/div[4]/ul[2]/li[2]/div[2]/span" );
 101+ $this->assertContains( 'Calcey', $textPageText );
 102+ }
 103+ $this->deletePage("Calcey QA");
 104+ $this->deletePage("Calcey web");
 105+ }
124106 }
Index: trunk/phase3/maintenance/tests/selenium/suites/MovePageTestCase.php
@@ -0,0 +1,117 @@
 2+<?php
 3+
 4+/**
 5+ * Selenium server manager
 6+ *
 7+ * @file
 8+ * @ingroup Maintenance
 9+ * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com>
 10+ * http://citizendium.org/
 11+ *
 12+ * This program is free software; you can redistribute it and/or modify
 13+ * it under the terms of the GNU General Public License as published by
 14+ * the Free Software Foundation; either version 2 of the License, or
 15+ * (at your option) any later version.
 16+ *
 17+ * This program is distributed in the hope that it will be useful,
 18+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 19+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 20+ * GNU General Public License for more details.
 21+ *
 22+ * You should have received a copy of the GNU General Public License along
 23+ * with this program; if not, write to the Free Software Foundation, Inc.,
 24+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 25+ * http://www.gnu.org/copyleft/gpl.html
 26+ *
 27+ * @addtogroup Maintenance
 28+ *
 29+ */
 30+
 31+class MovePageTestCase extends SeleniumTestCase {
 32+
 33+ // Verify move(rename) wiki page
 34+ public function testMovePage() {
 35+
 36+ $newPage = "mypage99";
 37+ $displayName = "Mypage99";
 38+
 39+ $this->open( $this->getUrl() .
 40+ '/index.php?title=Main_Page&action=edit' );
 41+ $this->type( "searchInput", $newPage );
 42+ $this->click( "searchGoButton" );
 43+ $this->waitForPageToLoad( "30000" );
 44+ $this->click( "link=".$displayName );
 45+ $this->waitForPageToLoad( "60000" );
 46+ $this->type( "wpTextbox1", $newPage." text" );
 47+ $this->click( "wpSave" );
 48+ $this->waitForPageToLoad( "60000" );
 49+
 50+ // Verify link 'Move' available
 51+ $this->assertTrue($this->isElementPresent( "link=Move" ));
 52+
 53+ $this->click( "link=Move" );
 54+ $this->waitForPageToLoad( "30000" );
 55+
 56+ // Verify correct page name displayed under 'Move Page' field
 57+ $this->assertEquals($displayName,
 58+ $this->getText("//table[@id='mw-movepage-table']/tbody/tr[1]/td[2]/strong/a"));
 59+ $movePageName = $this->getText( "//table[@id='mw-movepage-table']/tbody/tr[1]/td[2]/strong/a" );
 60+
 61+ // Verify 'To new title' field has current page name as the default name
 62+ $newTitle = $this->getValue( "wpNewTitle" );
 63+ $correct = strstr( $movePageName , $newTitle );
 64+ $this->assertEquals( $correct, true );
 65+
 66+ $this->type( "wpNewTitle", $displayName );
 67+ $this->click( "wpMove" );
 68+ $this->waitForPageToLoad( "30000" );
 69+
 70+ // Verify warning message for the same source and destination titles
 71+ $this->assertEquals( "Source and destination titles are the same; cannot move a page over itself.",
 72+ $this->getText("//div[@id='bodyContent']/p[4]/strong" ));
 73+
 74+ // Verify warning message for the blank title
 75+ $this->type( "wpNewTitle", "" );
 76+ $this->click( "wpMove" );
 77+ $this->waitForPageToLoad( "30000" );
 78+
 79+ // Verify warning message for the blank title
 80+ $this->assertEquals( "The requested page title was invalid, empty, or an incorrectly linked inter-language or inter-wiki title. It may contain one or more characters which cannot be used in titles.",
 81+ $this->getText( "//div[@id='bodyContent']/p[4]/strong" ));
 82+
 83+ // Verify warning messages for the invalid titles
 84+ $this->type( "wpNewTitle", "# < > [ ] | { }" );
 85+ $this->click( "wpMove" );
 86+ $this->waitForPageToLoad( "30000" );
 87+ $this->assertEquals( "The requested page title was invalid, empty, or an incorrectly linked inter-language or inter-wiki title. It may contain one or more characters which cannot be used in titles.",
 88+ $this->getText( "//div[@id='bodyContent']/p[4]/strong" ));
 89+
 90+ $this->type( "wpNewTitle", $displayName."move" );
 91+ $this->click( "wpMove" );
 92+ $this->waitForPageToLoad( "30000" );
 93+
 94+ // Verify move success message displayed correctly
 95+ $this->assertEquals( "\"".$displayName."\" has been moved to \"".$displayName."move"."\"",
 96+ $this->getText( "//div[@id='bodyContent']/p[1]/b" ));
 97+
 98+ $this->type( "searchInput", $newPage."move" );
 99+ $this->click( "searchGoButton" );
 100+ $this->waitForPageToLoad( "30000" );
 101+
 102+ // Verify search using new page name
 103+ $this->assertEquals( $displayName."move", $this->getText( "firstHeading" ));
 104+
 105+ $this->type( "searchInput", $newPage );
 106+ $this->click( "searchGoButton" );
 107+ $this->waitForPageToLoad( "30000" );
 108+
 109+ // Verify search using old page name
 110+ $redirectPageName = $this->getText( "//*[@id='contentSub']" );
 111+ $this->assertEquals( "(Redirected from ".$displayName.")" , $redirectPageName );
 112+
 113+ // newpage delete
 114+ $this->deletePage( $newPage."move" );
 115+ $this->deletePage( $newPage );
 116+ }
 117+}
 118+?>
Index: trunk/phase3/maintenance/tests/selenium/suites/MediaWikiEditorConfig.php
@@ -1,16 +1,47 @@
22 <?php
 3+
 4+/**
 5+ * Selenium server manager
 6+ *
 7+ * @file
 8+ * @ingroup Maintenance
 9+ * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com>
 10+ * http://citizendium.org/
 11+ *
 12+ * This program is free software; you can redistribute it and/or modify
 13+ * it under the terms of the GNU General Public License as published by
 14+ * the Free Software Foundation; either version 2 of the License, or
 15+ * (at your option) any later version.
 16+ *
 17+ * This program is distributed in the hope that it will be useful,
 18+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 19+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 20+ * GNU General Public License for more details.
 21+ *
 22+ * You should have received a copy of the GNU General Public License along
 23+ * with this program; if not, write to the Free Software Foundation, Inc.,
 24+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 25+ * http://www.gnu.org/copyleft/gpl.html
 26+ *
 27+ * @addtogroup Maintenance
 28+ *
 29+ */
 30+
331 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
 32+
 33+ public static function getSettings(&$includeFiles, &$globalConfigs) {
 34+ $includes = array(
 35+ //files that needed to be included would go here
 36+ 'maintenance/tests/selenium/suites/MediaWikiCommonFunction.php'
 37+ );
 38+ $configs = array(
 39+ 'wgPageLoadTime' => "600000"
 40+ );
 41+ $includeFiles = array_merge( $includeFiles, $includes );
 42+ $globalConfigs = array_merge( $globalConfigs, $configs);
 43+ return true;
 44+ }
 45+}
 46+
 47+
 48+
Index: trunk/phase3/maintenance/tests/selenium/suites/DeletePageAdminTestCase.php
@@ -1,68 +1,90 @@
22 <?php
3 -/*
4 - * This test case is part of the SimpleSeleniumTestSuite.
5 - * Configuration for these tests are dosumented as part of SimpleSeleniumTestSuite.php
 3+
 4+/**
 5+ * Selenium server manager
 6+ *
 7+ * @file
 8+ * @ingroup Maintenance
 9+ * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com>
 10+ * http://citizendium.org/
 11+ *
 12+ * This program is free software; you can redistribute it and/or modify
 13+ * it under the terms of the GNU General Public License as published by
 14+ * the Free Software Foundation; either version 2 of the License, or
 15+ * (at your option) any later version.
 16+ *
 17+ * This program is distributed in the hope that it will be useful,
 18+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 19+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 20+ * GNU General Public License for more details.
 21+ *
 22+ * You should have received a copy of the GNU General Public License along
 23+ * with this program; if not, write to the Free Software Foundation, Inc.,
 24+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 25+ * http://www.gnu.org/copyleft/gpl.html
 26+ *
 27+ * @addtogroup Maintenance
 28+ *
629 */
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" );
3630
37 - // Verify 'Delete' button available
38 - $this->assertTrue($this->isElementPresent( "wpConfirmB" ));
 31+require_once("maintenance/tests/selenium/suites/MediaWikiCommonFunction.php");
3932
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 - }
 33+class DeletePageAdminTestCase extends SeleniumTestCase {
5834
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 - }
 35+ // Verify adding a new page
 36+ public function testDeletePage() {
 37+
 38+
 39+ $newPage = "new";
 40+ $displayName = "New";
 41+
 42+ $this->open( $this->getUrl().'/index.php?title=Main_Page' );
 43+
 44+ $this->type( "searchInput", $newPage );
 45+ $this->click( "searchGoButton" );
 46+ $this->waitForPageToLoad( "30000" );
 47+ $this->click( "link=".$displayName );
 48+ $this->waitForPageToLoad( "60000" );
 49+ $this->type( "wpTextbox1", $newPage." text" );
 50+ $this->click( "wpSave" );
 51+
 52+ $this->open( $this->getUrl() .
 53+ '/index.php?title=Main_Page&action=edit' );
 54+ $this->click( "link=Log out" );
 55+ $this->waitForPageToLoad( "30000" );
 56+ $this->click( "link=Log in / create account" );
 57+ $this->waitForPageToLoad( "30000" );
 58+
 59+ $this->type( "wpName1", $this->selenium->getUser() );
 60+ $this->type( "wpPassword1", $this->selenium->getPass() );
 61+ $this->click( "wpLoginAttempt" );
 62+ $this->waitForPageToLoad( "30000" );
 63+ $this->type( "searchInput", "new" );
 64+ $this->click( "searchGoButton");
 65+ $this->waitForPageToLoad( "30000" );
 66+
 67+ // Verify 'Delete' link displayed
 68+ $source = $this->gettext( "link=Delete" );
 69+ $correct = strstr ( $source, "Delete" );
 70+ $this->assertEquals($correct, true );
 71+
 72+ $this->click( "link=Delete" );
 73+ $this->waitForPageToLoad( "30000" );
 74+
 75+ // Verify 'Delete' button available
 76+ $this->assertTrue($this->isElementPresent( "wpConfirmB" ));
 77+
 78+ $this->click( "wpConfirmB" );
 79+ $this->waitForPageToLoad( "30000" );
 80+
 81+ // Verify 'Action complete' text displayed
 82+ $source = $this->gettext( "firstHeading" );
 83+ $correct = strstr ( $source, "Action complete" );
 84+ $this->assertEquals( $correct, true );
 85+
 86+ // Verify '<Page Name> has been deleted. See deletion log for a record of recent deletions.' text displayed
 87+ $source = $this->gettext( "//div[@id='bodyContent']/p[1]" );
 88+ $correct = strstr ( $source, "\"New\" has been deleted. See deletion log for a record of recent deletions." );
 89+ $this->assertEquals( $correct, true );
 90+ }
6991 }
Index: trunk/phase3/maintenance/tests/selenium/suites/MyContributionsTestCase.php
@@ -0,0 +1,76 @@
 2+<?php
 3+
 4+/**
 5+ * Selenium server manager
 6+ *
 7+ * @file
 8+ * @ingroup Maintenance
 9+ * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com>
 10+ * http://citizendium.org/
 11+ *
 12+ * This program is free software; you can redistribute it and/or modify
 13+ * it under the terms of the GNU General Public License as published by
 14+ * the Free Software Foundation; either version 2 of the License, or
 15+ * (at your option) any later version.
 16+ *
 17+ * This program is distributed in the hope that it will be useful,
 18+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 19+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 20+ * GNU General Public License for more details.
 21+ *
 22+ * You should have received a copy of the GNU General Public License along
 23+ * with this program; if not, write to the Free Software Foundation, Inc.,
 24+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 25+ * http://www.gnu.org/copyleft/gpl.html
 26+ *
 27+ * @addtogroup Maintenance
 28+ *
 29+ */
 30+
 31+class MyContributionsTestCase extends SeleniumTestCase {
 32+
 33+ // Verify user contributions
 34+ public function testRecentChangesAvailability() {
 35+
 36+ $newPage = "mypage999";
 37+ $displayName = "Mypage999";
 38+
 39+ $this->open( $this->getUrl() .
 40+ '/index.php?title=Main_Page&action=edit' );
 41+
 42+ $this->type( "searchInput", $newPage);
 43+ $this->click( "searchGoButton" );
 44+ $this->waitForPageToLoad( "60000" );
 45+ $this->click( "link=".$displayName );
 46+ $this->waitForPageToLoad( "600000" );
 47+ $this->type( "wpTextbox1", $newPage." text" );
 48+ $this->click( "wpSave" );
 49+ $this->waitForPageToLoad( "60000" );
 50+
 51+ // Verify My contributions Link available
 52+ $this->assertTrue($this->isElementPresent( "link=My contributions" ));
 53+
 54+ $this->click( "link=My contributions" );
 55+ $this->waitForPageToLoad( "30000" );
 56+
 57+ // Verify recent page adding available on My Contributions list
 58+ $this->assertEquals( $displayName, $this->getText( "link=".$displayName ));
 59+
 60+ $this->type( "searchInput", $newPage );
 61+ $this->click( "searchGoButton" );
 62+ $this->waitForPageToLoad( "30000" );
 63+
 64+ $this->click( "link=Edit" );
 65+ $this->waitForPageToLoad( "30000" );
 66+ $this->type( "wpTextbox1", $newPage." text changed" );
 67+ $this->click( "wpSave" );
 68+ $this->waitForPageToLoad( "30000" );
 69+ $this->click( "link=My contributions" );
 70+ $this->waitForPageToLoad( "30000" );
 71+
 72+ // Verify recent page changes available on My Contributions
 73+ $this->assertTrue($this->isTextPresent($displayName." ‎ (top)"));
 74+ $this->deletePage($newPage);
 75+ }
 76+}
 77+?>
Index: trunk/phase3/maintenance/tests/selenium/suites/MyWatchListTestCase.php
@@ -0,0 +1,73 @@
 2+<?php
 3+
 4+/**
 5+ * Selenium server manager
 6+ *
 7+ * @file
 8+ * @ingroup Maintenance
 9+ * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com>
 10+ * http://citizendium.org/
 11+ *
 12+ * This program is free software; you can redistribute it and/or modify
 13+ * it under the terms of the GNU General Public License as published by
 14+ * the Free Software Foundation; either version 2 of the License, or
 15+ * (at your option) any later version.
 16+ *
 17+ * This program is distributed in the hope that it will be useful,
 18+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 19+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 20+ * GNU General Public License for more details.
 21+ *
 22+ * You should have received a copy of the GNU General Public License along
 23+ * with this program; if not, write to the Free Software Foundation, Inc.,
 24+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 25+ * http://www.gnu.org/copyleft/gpl.html
 26+ *
 27+ * @addtogroup Maintenance
 28+ *
 29+ */
 30+
 31+
 32+class MyWatchListTestCase extends SeleniumTestCase {
 33+
 34+ // Verify user watchlist
 35+ public function testMyWatchlist() {
 36+
 37+ $newPage = "mypage";
 38+ $displayName = "Mypage";
 39+ $wikiText = "watch page";
 40+
 41+ $this->open( $this->getUrl().'/index.php?title=Main_Page' );
 42+
 43+ $this->type( "searchInput", $newPage );
 44+ $this->click( "searchGoButton" );
 45+ $this->waitForPageToLoad( "30000" );
 46+ $this->click( "link=".$displayName );
 47+ $this->waitForPageToLoad( "600000" );
 48+
 49+ $this->click( "wpWatchthis" );
 50+ $this->type( "wpTextbox1",$wikiText );
 51+ $this->click( "wpSave" );
 52+ $this->waitForPageToLoad( "30000" );
 53+
 54+ // Verify link 'My Watchlist' available
 55+ $this->assertTrue( $this->isElementPresent( "link=My watchlist" ) );
 56+
 57+ $this->click( "link=My watchlist" );
 58+ $this->waitForPageToLoad( "30000" );
 59+
 60+ // Verify newly added page to the watchlist is available
 61+ $watchList = $this->getText( "//*[@id='bodyContent']" );
 62+ $this->assertContains( $displayName, $watchList );
 63+
 64+ $this->type( "searchInput", $newPage );
 65+ $this->click( "searchGoButton" );
 66+ $this->waitForPageToLoad( "30000" );
 67+ $this->click("link=Edit");
 68+ $this->waitForPageToLoad( "30000" );
 69+ $this->click( "wpWatchthis" );
 70+ $this->click( "wpSave" );
 71+ $this->deletePage( $newPage );
 72+ }
 73+}
 74+?>
Index: trunk/phase3/maintenance/tests/selenium/suites/EmailPasswordTestCase.php
@@ -0,0 +1,81 @@
 2+<?php
 3+
 4+/**
 5+ * Selenium server manager
 6+ *
 7+ * @file
 8+ * @ingroup Maintenance
 9+ * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com>
 10+ * http://citizendium.org/
 11+ *
 12+ * This program is free software; you can redistribute it and/or modify
 13+ * it under the terms of the GNU General Public License as published by
 14+ * the Free Software Foundation; either version 2 of the License, or
 15+ * (at your option) any later version.
 16+ *
 17+ * This program is distributed in the hope that it will be useful,
 18+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 19+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 20+ * GNU General Public License for more details.
 21+ *
 22+ * You should have received a copy of the GNU General Public License along
 23+ * with this program; if not, write to the Free Software Foundation, Inc.,
 24+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 25+ * http://www.gnu.org/copyleft/gpl.html
 26+ *
 27+ * @addtogroup Maintenance
 28+ *
 29+ */
 30+
 31+class EmailPasswordTestCase extends SeleniumTestCase {
 32+
 33+ // change user name for each and every test (with in 24 hours)
 34+ private $userName = "test1";
 35+
 36+ public function testEmailPasswordButton() {
 37+
 38+ $this->click( "link=Log out" );
 39+ $this->waitForPageToLoad( "30000" );
 40+
 41+ $this->open( $this->getUrl().'/index.php?title=Main_Page' );
 42+
 43+ // click Log in / create account link to open Log in / create account' page
 44+ $this->click( "link=Log in / create account" );
 45+ $this->waitForPageToLoad( "30000" );
 46+ $this->assertTrue($this->isElementPresent( "wpMailmypassword" ));
 47+ }
 48+
 49+ // Verify Email password functionality
 50+ public function testEmailPasswordMessages() {
 51+
 52+ $this->click( "link=Log out" );
 53+ $this->waitForPageToLoad( "30000" );
 54+
 55+ $this->open( $this->getUrl().'/index.php?title=Main_Page' );
 56+
 57+ // click Log in / create account link to open Log in / create account' page
 58+ $this->click( "link=Log in / create account" );
 59+ $this->waitForPageToLoad( "30000" );
 60+
 61+ $this->type( "wpName1", "" );
 62+ $this->click( "wpMailmypassword" );
 63+ $this->waitForPageToLoad( "30000" );
 64+ $this->assertEquals( "Login error\n You have not specified a valid user name.",
 65+ $this->getText("//div[@id='bodyContent']/div[4]"));
 66+
 67+ $this->type( "wpName1", $this->userName );
 68+ $this->click( "wpMailmypassword" );
 69+ $this->waitForPageToLoad( "30000" );
 70+
 71+ // Can not run on localhost
 72+ $this->assertEquals( "A new password has been sent to the e-mail address registered for ".ucfirst($this->userName).". Please log in again after you receive it.",
 73+ $this->getText("//div[@id='bodyContent']/div[4]" ));
 74+
 75+ $this->type( "wpName1", $this->userName );
 76+ $this->click( "wpMailmypassword" );
 77+ $this->waitForPageToLoad( "30000" );
 78+ $this->assertEquals( "Login error\n A password reminder has already been sent, within the last 24 hours. To prevent abuse, only one password reminder will be sent per 24 hours.",
 79+ $this->getText( "//div[@id='bodyContent']/div[4]" ));
 80+ }
 81+}
 82+?>
Index: trunk/phase3/maintenance/tests/selenium/suites/MediaWikExtraTestSuite.php
@@ -0,0 +1,20 @@
 2+<?php
 3+
 4+class MediaWikExtraTestSuite extends SeleniumTestSuite {
 5+ public function setUp() {
 6+ $this->setLoginBeforeTests( true );
 7+ parent::setUp();
 8+ }
 9+ public function addTests() {
 10+ $testFiles = array(
 11+ 'maintenance/tests/selenium/suites/MyContributionsTestCase.php',
 12+ 'maintenance/tests/selenium/suites/MyWatchListTestCase.php',
 13+ 'maintenance/tests/selenium/suites/UserPreferencesTestCase.php',
 14+ 'maintenance/tests/selenium/suites/MovePageTestCase.php',
 15+ 'maintenance/tests/selenium/suites/PageSearchTestCase.php',
 16+ 'maintenance/tests/selenium/suites/EmailPasswordTestCase.php',
 17+ 'maintenance/tests/selenium/suites/CreateAccountTestCase.php'
 18+ );
 19+ parent::addTestFiles( $testFiles );
 20+ }
 21+}
Index: trunk/phase3/maintenance/tests/selenium/suites/PageDeleteTestSuite.php
@@ -0,0 +1,16 @@
 2+<?php
 3+
 4+class PageDeleteTestSuite extends SeleniumTestSuite {
 5+ public function setUp() {
 6+ $this->setLoginBeforeTests( true );
 7+ parent::setUp();
 8+ }
 9+ public function addTests() {
 10+ $testFiles = array(
 11+ 'maintenance/tests/selenium/suites/DeletePageAdminTestCase.php'
 12+ );
 13+ parent::addTestFiles( $testFiles );
 14+ }
 15+
 16+
 17+}
Index: trunk/phase3/maintenance/tests/selenium/suites/PreviewPageTestCase.php
@@ -0,0 +1,53 @@
 2+<?php
 3+
 4+/**
 5+ * Selenium server manager
 6+ *
 7+ * @file
 8+ * @ingroup Maintenance
 9+ * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com>
 10+ * http://citizendium.org/
 11+ *
 12+ * This program is free software; you can redistribute it and/or modify
 13+ * it under the terms of the GNU General Public License as published by
 14+ * the Free Software Foundation; either version 2 of the License, or
 15+ * (at your option) any later version.
 16+ *
 17+ * This program is distributed in the hope that it will be useful,
 18+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 19+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 20+ * GNU General Public License for more details.
 21+ *
 22+ * You should have received a copy of the GNU General Public License along
 23+ * with this program; if not, write to the Free Software Foundation, Inc.,
 24+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 25+ * http://www.gnu.org/copyleft/gpl.html
 26+ *
 27+ * @addtogroup Maintenance
 28+ *
 29+ */
 30+
 31+class PreviewPageTestCase extends SeleniumTestCase {
 32+
 33+ // Verify adding a new page
 34+ public function testPreviewPage() {
 35+ $wikiText = "Adding this page to test the \n Preview button functionality";
 36+ $newPage = "Test Preview Page";
 37+ $this->open( $this->getUrl() .
 38+ '/index.php?title=Main_Page&action=edit' );
 39+ $this->getNewPage( $newPage );
 40+ $this->type( "wpTextbox1", $wikiText."" );
 41+ $this->assertTrue($this->isElementPresent( "//*[@id='wpPreview']" ));
 42+
 43+ $this->click( "wpPreview" );
 44+
 45+ // Verify saved page available
 46+ $source = $this->gettext( "firstHeading" );
 47+ $correct = strstr( $source, "Test Preview Page" );
 48+ $this->assertEquals( $correct, true);
 49+
 50+ // Verify page content previewed succesfully
 51+ $contentOfPreviewPage = $this->getText( "//*[@id='content']" );
 52+ $this->assertContains( $wikiText, $contentOfPreviewPage );
 53+ }
 54+}
Index: trunk/phase3/maintenance/tests/selenium/suites/CreateAccountTestCase.php
@@ -0,0 +1,114 @@
 2+<?php
 3+
 4+/**
 5+ * Selenium server manager
 6+ *
 7+ * @file
 8+ * @ingroup Maintenance
 9+ * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com>
 10+ * http://citizendium.org/
 11+ *
 12+ * This program is free software; you can redistribute it and/or modify
 13+ * it under the terms of the GNU General Public License as published by
 14+ * the Free Software Foundation; either version 2 of the License, or
 15+ * (at your option) any later version.
 16+ *
 17+ * This program is distributed in the hope that it will be useful,
 18+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 19+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 20+ * GNU General Public License for more details.
 21+ *
 22+ * You should have received a copy of the GNU General Public License along
 23+ * with this program; if not, write to the Free Software Foundation, Inc.,
 24+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 25+ * http://www.gnu.org/copyleft/gpl.html
 26+ *
 27+ * @addtogroup Maintenance
 28+ *
 29+ */
 30+
 31+Class CreateAccountTestCase extends SeleniumTestCase {
 32+
 33+ // Change these values before run the test
 34+ private $userName = "yourname4000";
 35+ private $password = "yourpass4000";
 36+
 37+ // Verify 'Log in/create account' link existance in Main page.
 38+ public function testMainPageLink() {
 39+
 40+ $this->click( "link=Log out" );
 41+ $this->waitForPageToLoad( "30000" );
 42+
 43+ $this->open( $this->getUrl().'/index.php?title=Main_Page' );
 44+ $this->assertTrue($this->isElementPresent( "link=Log in / create account" ));
 45+ }
 46+
 47+ // Verify 'Create an account' link existance in 'Log in / create account' Page.
 48+ public function testCreateAccountPageLink() {
 49+
 50+ $this->click( "link=Log out" );
 51+ $this->waitForPageToLoad( "30000" );
 52+
 53+ $this->open( $this->getUrl().'/index.php?title=Main_Page' );
 54+
 55+ // click Log in / create account link to open Log in / create account' page
 56+ $this->click( "link=Log in / create account" );
 57+ $this->waitForPageToLoad( "30000" );
 58+ $this->assertTrue($this->isElementPresent( "link=Create an account" ));
 59+ }
 60+
 61+ // Verify Create account
 62+ public function testCreateAccount() {
 63+
 64+ $this->click( "link=Log out" );
 65+ $this->waitForPageToLoad( "30000" );
 66+
 67+ $this->open( $this->getUrl().'/index.php?title=Main_Page' );
 68+
 69+ $this->click( "link=Log in / create account" );
 70+ $this->waitForPageToLoad( "30000" );
 71+
 72+ $this->click( "link=Create an account" );
 73+ $this->waitForPageToLoad( "30000" );
 74+
 75+ // Verify for blank user name
 76+ $this->type( "wpName2", "" );
 77+ $this->click( "wpCreateaccount" );
 78+ $this->waitForPageToLoad( "30000" );
 79+ $this->assertEquals( "Login error\n You have not specified a valid user name.",
 80+ $this->getText( "//div[@id='bodyContent']/div[4]" ));
 81+
 82+ // Verify for invalid user name
 83+ $this->type( "wpName2", "@" );
 84+ $this->click("wpCreateaccount" );
 85+ $this->waitForPageToLoad( "30000" );
 86+ $this->assertEquals( "Login error\n You have not specified a valid user name.",
 87+ $this->getText( "//div[@id='bodyContent']/div[4]" ));
 88+
 89+ // start of test for blank password
 90+ $this->type( "wpName2", $this->userName);
 91+ $this->type( "wpPassword2", "" );
 92+ $this->click( "wpCreateaccount" );
 93+ $this->waitForPageToLoad( "30000" );
 94+ $this->assertEquals( "Login error\n Passwords must be at least 1 character.",
 95+ $this->getText("//div[@id='bodyContent']/div[4]" ));
 96+
 97+ $this->type( "wpName2", $this->userName );
 98+ $this->type( "wpPassword2", $this->password );
 99+ $this->click( "wpCreateaccount" );
 100+ $this->waitForPageToLoad( "30000" );
 101+ $this->assertEquals( "Login error\n The passwords you entered do not match.",
 102+ $this->getText( "//div[@id='bodyContent']/div[4]" ));
 103+
 104+ $this->type( "wpName2", $this->userName );
 105+ $this->type( "wpPassword2", $this->password );
 106+ $this->type( "wpRetype", $this->password );
 107+ $this->click( "wpCreateaccount" );
 108+ $this->waitForPageToLoad( "30000 ");
 109+
 110+ // Verify successful account creation for valid combination of 'Username', 'Password', 'Retype password'
 111+ $this->assertEquals( "Welcome, ".ucfirst( $this->userName )."!",
 112+ $this->getText( "Welcome,_".ucfirst( $this->userName )."!" ));
 113+ }
 114+}
 115+?>
Index: trunk/phase3/maintenance/tests/selenium/suites/MediaWikiEditorTestSuite.php
@@ -1,30 +1,18 @@
22 <?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'
253
26 - );
27 - parent::addTestFiles( $testFiles );
28 - }
29 -
30 -
 4+class MediaWikiEditorTestSuite extends SeleniumTestSuite {
 5+ public function setUp() {
 6+ $this->setLoginBeforeTests( true );
 7+ parent::setUp();
 8+ }
 9+ public function addTests() {
 10+ $testFiles = array(
 11+ 'maintenance/tests/selenium/suites/AddNewPageTestCase.php',
 12+ 'maintenance/tests/selenium/suites/AddContentToNewPageTestCase.php',
 13+ 'maintenance/tests/selenium/suites/PreviewPageTestCase.php',
 14+ 'maintenance/tests/selenium/suites/SavePageTestCase.php',
 15+ );
 16+ parent::addTestFiles( $testFiles );
 17+ }
3118 }
 19+
Index: trunk/phase3/maintenance/tests/selenium/suites/SavePageTestCase.php
@@ -0,0 +1,58 @@
 2+<?php
 3+
 4+/**
 5+ * Selenium server manager
 6+ *
 7+ * @file
 8+ * @ingroup Maintenance
 9+ * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com>
 10+ * http://citizendium.org/
 11+ *
 12+ * This program is free software; you can redistribute it and/or modify
 13+ * it under the terms of the GNU General Public License as published by
 14+ * the Free Software Foundation; either version 2 of the License, or
 15+ * (at your option) any later version.
 16+ *
 17+ * This program is distributed in the hope that it will be useful,
 18+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 19+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 20+ * GNU General Public License for more details.
 21+ *
 22+ * You should have received a copy of the GNU General Public License along
 23+ * with this program; if not, write to the Free Software Foundation, Inc.,
 24+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 25+ * http://www.gnu.org/copyleft/gpl.html
 26+ *
 27+ * @addtogroup Maintenance
 28+ *
 29+ */
 30+
 31+class SavePageTestCase extends SeleniumTestCase {
 32+
 33+ // Verify adding a new page
 34+ public function testSavePage() {
 35+ $wikiText = "Adding this page to test the Save button functionality";
 36+ $newPage = "Test Save Page";
 37+
 38+ $this->open( $this->getUrl() .
 39+ '/index.php?title=Main_Page&action=edit' );
 40+ $this->getNewPage($newPage);
 41+ $this->type("wpTextbox1", $wikiText);
 42+
 43+ // verify 'Save' button available
 44+ $this->assertTrue($this->isElementPresent( "wpSave" ));
 45+ $this->click( "wpSave" );
 46+
 47+ // Verify saved page available
 48+ $source = $this->gettext( "firstHeading" );
 49+ $correct = strstr( $source, "Test Save Page" );
 50+
 51+ // Verify Saved page name displayed correctly
 52+ $this->assertEquals( $correct, true );
 53+
 54+ // Verify page content saved succesfully
 55+ $contentOfSavedPage = $this->getText( "//*[@id='content']" );
 56+ $this->assertContains( $wikiText, $contentOfSavedPage );
 57+ $this->deletePage( $newPage );
 58+ }
 59+}

Follow-up revisions

RevisionCommit summaryAuthorDate
r77657Followup r77654, SVN PROPS!!!reedy14:16, 3 December 2010
r77745Followup r77654, remove trailing ?> at end of file.platonides22:28, 4 December 2010
r79285Follow up r77654...platonides19:18, 30 December 2010

Comments

#Comment by MarkAHershberger (talk | contribs)   02:26, 4 December 2010

+?>

Don't do this. From http://www.mediawiki.org/wiki/Manual:Coding_conventions:

When working in a pure PHP environment, remove any trailing ?> tags

Status & tagging log