3 * This test case is part of the SimpleSeleniumTestSuite.
4 * Configuration for these tests are dosumented as part of SimpleSeleniumTestSuite.php
6 class AddContentToNewPageTestCase
extends SeleniumTestCase
{
8 // Add bold text and verify output
9 public function testAddBoldText(){
10 $blnElementPresent = False;
11 $blnTextPresent = False;
12 $this->getExistingPage();
13 $this->clickEditLink();
14 $this->loadWikiEditor();
15 $this->clearWikiEditor();
16 $this->click( "//*[@id='mw-editbutton-bold']" );
17 $this->clickShowPreviewBtn();
18 $this->waitForPageToLoad( "600000" );
21 $this->assertTrue($this->isElementPresent("//div[@id='wikiPreview']/p/b"));
22 $blnElementPresent = True;
23 } catch ( PHPUnit_Framework_AssertionFailedError
$e ){
24 $blnElementPresent = False;
28 $this->assertTrue($this->isTextPresent( "Bold text" ));
29 $blnTextPresent = True;
31 } catch ( PHPUnit_Framework_AssertionFailedError
$e ){
32 $blnTextPresent = False;
35 // Verify bold text displayed on mediawiki preview
36 if (( $blnElementPresent = True ) && ( $blnTextPresent = True )){
37 echo "\n Pass : Bold text displayed in the preview \n";
40 echo "\n Fail : Bold text displayed in the preview \n";
44 // Add italic text and verify output
45 public function testAddItalicText(){
46 $this->getExistingPage();
47 $this->clickEditLink();
48 $this->loadWikiEditor();
49 $this->clearWikiEditor();
50 $this->click( "//*[@id='mw-editbutton-italic']" );
51 $this->clickShowPreviewBtn();
52 $this->waitForPageToLoad( "600000" );
54 // Verify italic text displayed on mediawiki preview
56 $this->assertTrue($this->isElementPresent("//div[@id='wikiPreview']/p/i"));
57 $blnElementPresent = True;
58 } catch ( PHPUnit_Framework_AssertionFailedError
$e ){
59 $blnElementPresent = False;
63 $this->assertTrue($this->isTextPresent( "Italic text" ));
64 $blnTextPresent = True;
66 } catch ( PHPUnit_Framework_AssertionFailedError
$e ){
67 $blnTextPresent = False;
70 // Verify italic text displayed on mediawiki preview
71 if (( $blnElementPresent = True ) && ( $blnTextPresent = True )){
72 echo "\n Pass : Italic text displayed in the preview \n";
75 echo "\n Fail : Italic text displayed in the preview \n";
80 // Add internal link for a new page and verify output in the preview
81 public function testAddInternalLinkNewPage(){
82 $this->getExistingPage();
83 $this->clickEditLink();
84 $this->loadWikiEditor();
85 $this->clearWikiEditor();
86 $this->click( "//*[@id='mw-editbutton-link']" );
87 $this->clickShowPreviewBtn();
88 $this->waitForPageToLoad( "600000" );
90 // Verify internal link displayed on mediawiki preview
91 $source = $this->getText( "//*[@id='wikiPreview']/p/a" );
92 $correct = strstr( $source, "Link title" );
94 $this->assertEquals( $correct, true );
95 echo "\n Pass : Internal link displayed in the preview \n";
97 } catch ( PHPUnit_Framework_AssertionFailedError
$e ){
98 echo "\n Pass : Internal link displayed in the preview \n";
101 $this->click( "link=Link title" );
102 $this->waitForPageToLoad( "600000" );
104 // Verify internal link open as a new page - editing mode
105 $source = $this->getText( "firstHeading" );
106 $correct = strstr( $source, "Editing Link title" );
108 $this->assertEquals( $correct, true );
109 echo "\n Pass : Internal link opened as a new page in the editing mode \n";
111 } catch ( PHPUnit_Framework_AssertionFailedError
$e ){
112 echo "\n Fail : Internal link opened as a new page in the editing mode \n";
116 // Add external link and verify output in the preview
117 public function testAddExternalLink(){
118 $this->getExistingPage();
119 $this->clickEditLink();
120 $this->loadWikiEditor();
121 $this->clearWikiEditor();
122 $this->click( "//*[@id='mw-editbutton-extlink']" );
123 $this->type( "wpTextbox1", "[http://www.google.com Google]" );
124 $this->clickShowPreviewBtn();
125 $this->waitForPageToLoad( "600000" );
127 // Verify external links displayed on mediawiki preview
128 $source = $this->getText( "//*[@id='wikiPreview']/p/a" );
129 $correct = strstr( $source, "Google" );
132 $this->assertEquals( $correct, true );
133 echo "\n Pass : External link displayed in the preview \n";
135 } catch ( PHPUnit_Framework_AssertionFailedError
$e ){
136 echo "\n Fail : External link displayed in thw preview \n";
139 $this->click( "link=Google" );
140 $this->waitForPageToLoad( "600000" );
142 // Verify external link opens
143 $source = $this->getTitle();
144 $correct = strstr( $source, "Google" );
146 $this->assertEquals( $correct, true);
147 echo "\n Pass : External link opened \n";
149 } catch (PHPUnit_Framework_AssertionFailedError
$e){
150 echo "\n Fail : External link opened \n";
155 // Add level 2 headline and verify output in the preview
156 public function testAddLevel2HeadLine(){
157 $blnElementPresent = False;
158 $blnTextPresent = False;
159 $this->getExistingPage();
160 $this->clickEditLink();
161 $this->loadWikiEditor();
162 $this->clearWikiEditor();
163 $this->click( "mw-editbutton-headline" );
164 $this->clickShowPreviewBtn();
165 $this->waitForPageToLoad( "600000" );
168 $this->assertTrue($this->isElementPresent("//div[@id='wikiPreview']/h2"));
169 $blnElementPresent = True;
170 } catch ( PHPUnit_Framework_AssertionFailedError
$e ){
171 $blnElementPresent = False;
175 $source = $this->getText( "//*[@id='Headline_text']" );
176 $correct = strstr( $source, "Headline text" );
177 $this->assertEquals( $correct, true );
178 $blnTextPresent = True;
179 } catch ( PHPUnit_Framework_AssertionFailedError
$e ){
180 $blnTextPresent = False;
183 if(($blnElementPresent = True) && ($blnTextPresent = True)){
184 echo "\n Pass : Headline text displayed in the preview \n";
187 echo "\n Fail : Headline text displayed in the preview \n";
191 // Add text with ignore wiki format and verify output the preview
192 public function testAddNoWikiFormat(){
193 $this->getExistingPage();
194 $this->clickEditLink();
195 $this->loadWikiEditor();
196 $this->clearWikiEditor();
197 $this->click( "//*[@id='mw-editbutton-nowiki']" );
198 $this->clickShowPreviewBtn();
199 $this->waitForPageToLoad( "600000" );
201 // Verify ignore wiki format text displayed on mediawiki preview
202 $source = $this->getText( "//div[@id='wikiPreview']/p" );
203 $correct = strstr( $source, "Insert non-formatted text here" );
205 $this->assertEquals( $correct, true );
206 echo "\n Pass : Text available without wiki formats in the preview \n ";
208 } catch (PHPUnit_Framework_AssertionFailedError
$e){
209 echo "\n Fail : Text available without wiki formats in the preview\n ";
213 // Add signature and verify output in the preview
214 public function testAddUserSignature(){
215 $this->getExistingPage();
216 $this->clickEditLink();
217 $this->loadWikiEditor();
218 $this->clearWikiEditor();
219 $this->click( "mw-editbutton-signature" );
220 $this->clickShowPreviewBtn();
221 $this->waitForPageToLoad( "600000" );
223 // Verify signature displayed on mediawiki preview
224 $source = $this->getText( "//*[@id='wikiPreview']/p/a" );
225 $username = $this->getText( "//*[@id='pt-userpage']/a" );
226 $correct = strstr( $source, $username );
229 $this->assertEquals( $correct, true);
230 echo "\n Pass : Correct name displayed in the preview \n ";
232 } catch (PHPUnit_Framework_AssertionFailedError
$e){
233 echo "\n Fail : Correct name displayed in the preview \n ";
237 // Add horizontal line and verify output in the preview
238 public function testHorizontalLine(){
239 $this->getExistingPage();
240 $this->clickEditLink();
241 $this->loadWikiEditor();
242 $this->clearWikiEditor();
243 $this->click( "mw-editbutton-hr" );
245 $this->clickShowPreviewBtn();
246 $this->waitForPageToLoad( "600000" );
248 // Verify horizontal line displayed on mediawiki preview
250 $this->assertTrue( $this->isElementPresent( "//div[@id='wikiPreview']/hr" ));
251 echo "\n Pass: Horizontal line displayed in the preview \n";
252 } catch (PHPUnit_Framework_AssertionFailedError
$e){
253 echo "\n Fail : Horizontal line displayed in the preview \n ";