Index: trunk/testing/selenium/UsabilityInitiative/WikiAutomationTC/testCases/WikiToolBarNTOC.php |
— | — | @@ -0,0 +1,245 @@ |
| 2 | +<?php |
| 3 | +require_once 'WikiCommonTC.php'; |
| 4 | +/** |
| 5 | + * This test case will be handling the NTOC related functions. |
| 6 | + * Adding different header levels via tool bar and verify the output |
| 7 | + * Date : Apr - 2010 |
| 8 | + * @author : BhagyaG - Calcey |
| 9 | + */ |
| 10 | +class WikiToolBarNTOC extends WikiCommonTC { |
| 11 | + |
| 12 | + // Set up the testing environment |
| 13 | + function setup(){ |
| 14 | + parent::setUp(); |
| 15 | + } |
| 16 | + |
| 17 | + |
| 18 | + // Add header level 2 and verify Header output |
| 19 | + function testHeaderLevel2(){ |
| 20 | + |
| 21 | + parent::doOpenLink(); |
| 22 | + parent::doLogin(); |
| 23 | + $this->open("/deployment-en/Main_Page"); |
| 24 | + $this->waitForPageToLoad("30000"); |
| 25 | + $this->click("link=Random article"); |
| 26 | + $this->waitForPageToLoad("30000"); |
| 27 | + $this->click("//li[@id='ca-edit']/a/span"); |
| 28 | + $this->waitForPageToLoad("30000"); |
| 29 | + parent::doExpandAdvanceSection(); |
| 30 | + $this->click("link=Heading"); |
| 31 | + $this->click("link=Heading"); |
| 32 | + $this->click("link=Level 2"); |
| 33 | + $this->type("wpTextbox1", "==Heading text=="); |
| 34 | + $this->click("wpPreview"); |
| 35 | + $this->waitForPageToLoad("30000"); |
| 36 | + try { |
| 37 | + $this->assertEquals("Heading text", $this->getText("//*[@id='wikiPreview']/h2")); |
| 38 | + } catch (PHPUnit_Framework_AssertionFailedError $e) { |
| 39 | + array_push($this->verificationErrors, $e->toString()); |
| 40 | + } |
| 41 | + |
| 42 | + parent::doLogout(); |
| 43 | + |
| 44 | + } |
| 45 | + |
| 46 | + // Add header level 3 and verify Header output |
| 47 | + function testHeaderLevel3(){ |
| 48 | + |
| 49 | + parent::doOpenLink(); |
| 50 | + parent::doLogin(); |
| 51 | + $this->open("/deployment-en/Main_Page"); |
| 52 | + $this->waitForPageToLoad("30000"); |
| 53 | + $this->click("link=Random article"); |
| 54 | + $this->waitForPageToLoad("30000"); |
| 55 | + $this->click("//li[@id='ca-edit']/a/span"); |
| 56 | + $this->waitForPageToLoad("30000"); |
| 57 | + parent::doExpandAdvanceSection(); |
| 58 | + $this->click("link=Heading"); |
| 59 | + $this->click("link=Heading"); |
| 60 | + $this->click("link=Level 3"); |
| 61 | + $this->type("wpTextbox1", "===Heading text==="); |
| 62 | + $this->click("wpPreview"); |
| 63 | + $this->waitForPageToLoad("30000"); |
| 64 | + try { |
| 65 | + $this->assertEquals("Heading text", $this->getText("//*[@id='wikiPreview']/h3")); |
| 66 | + } catch (PHPUnit_Framework_AssertionFailedError $e) { |
| 67 | + array_push($this->verificationErrors, $e->toString()); |
| 68 | + } |
| 69 | + |
| 70 | + parent::doLogout(); |
| 71 | + |
| 72 | + } |
| 73 | + |
| 74 | + // Add header level 4 and verify Header output |
| 75 | + function testHeaderLevel4(){ |
| 76 | + |
| 77 | + parent::doOpenLink(); |
| 78 | + parent::doLogin(); |
| 79 | + $this->open("/deployment-en/Main_Page"); |
| 80 | + $this->waitForPageToLoad("30000"); |
| 81 | + $this->click("link=Random article"); |
| 82 | + $this->waitForPageToLoad("30000"); |
| 83 | + $this->click("//li[@id='ca-edit']/a/span"); |
| 84 | + $this->waitForPageToLoad("30000"); |
| 85 | + parent::doExpandAdvanceSection(); |
| 86 | + $this->click("link=Heading"); |
| 87 | + $this->click("link=Heading"); |
| 88 | + $this->click("link=Level 4"); |
| 89 | + $this->type("wpTextbox1", "====Heading text===="); |
| 90 | + $this->click("wpPreview"); |
| 91 | + $this->waitForPageToLoad("30000"); |
| 92 | + try { |
| 93 | + $this->assertEquals("Heading text", $this->getText("//*[@id='wikiPreview']/h4")); |
| 94 | + } catch (PHPUnit_Framework_AssertionFailedError $e) { |
| 95 | + array_push($this->verificationErrors, $e->toString()); |
| 96 | + } |
| 97 | + |
| 98 | + parent::doLogout(); |
| 99 | + |
| 100 | + } |
| 101 | + |
| 102 | + // Add header level 5 and verify Header output |
| 103 | + function testHeaderLevel5(){ |
| 104 | + parent::doOpenLink(); |
| 105 | + parent::doLogin(); |
| 106 | + $this->open("/deployment-en/Main_Page"); |
| 107 | + $this->waitForPageToLoad("30000"); |
| 108 | + $this->click("link=Random article"); |
| 109 | + $this->waitForPageToLoad("30000"); |
| 110 | + $this->click("//li[@id='ca-edit']/a/span"); |
| 111 | + $this->waitForPageToLoad("30000"); |
| 112 | + parent::doExpandAdvanceSection(); |
| 113 | + $this->click("link=Heading"); |
| 114 | + $this->click("link=Heading"); |
| 115 | + $this->click("link=Level 5"); |
| 116 | + $this->type("wpTextbox1", "=====Heading text====="); |
| 117 | + $this->click("wpPreview"); |
| 118 | + $this->waitForPageToLoad("30000"); |
| 119 | + try { |
| 120 | + $this->assertEquals("Heading text", $this->getText("//*[@id='wikiPreview']/h5")); |
| 121 | + } catch (PHPUnit_Framework_AssertionFailedError $e) { |
| 122 | + array_push($this->verificationErrors, $e->toString()); |
| 123 | + } |
| 124 | + |
| 125 | + parent::doLogout(); |
| 126 | + |
| 127 | + } |
| 128 | + |
| 129 | + // Add header level 2 & 3 and verify Header output |
| 130 | + function testHeaderLevel2and3(){ |
| 131 | + parent::doOpenLink(); |
| 132 | + parent::doLogin(); |
| 133 | + $this->open("/deployment-en/Main_Page"); |
| 134 | + $this->waitForPageToLoad("30000"); |
| 135 | + $this->click("link=Random article"); |
| 136 | + $this->waitForPageToLoad("30000"); |
| 137 | + $this->click("//li[@id='ca-edit']/a/span"); |
| 138 | + $this->waitForPageToLoad("30000"); |
| 139 | + parent::doExpandAdvanceSection(); |
| 140 | + $this->click("link=Heading"); |
| 141 | + $this->click("link=Level 2"); |
| 142 | + $this->click("link=Heading"); |
| 143 | + $this->click("link=Level 3"); |
| 144 | + $this->type("wpTextbox1", "==Heading text==\n===Heading text==="); |
| 145 | + $this->click("wpPreview"); |
| 146 | + $this->waitForPageToLoad("30000"); |
| 147 | + try { |
| 148 | + $this->assertEquals("Heading text", $this->getText("//*[@id='wikiPreview']/h2")); |
| 149 | + } catch (PHPUnit_Framework_AssertionFailedError $e) { |
| 150 | + array_push($this->verificationErrors, $e->toString()); |
| 151 | + } |
| 152 | + try { |
| 153 | + $this->assertEquals("Heading text", $this->getText("//*[@id='wikiPreview']/h3")); |
| 154 | + } catch (PHPUnit_Framework_AssertionFailedError $e) { |
| 155 | + array_push($this->verificationErrors, $e->toString()); |
| 156 | + } |
| 157 | + |
| 158 | + parent::doLogout(); |
| 159 | + } |
| 160 | + |
| 161 | + // Add header level 2 , 3 & 4 and verify Header output |
| 162 | + function testHeaderLevel23and4(){ |
| 163 | + parent::doOpenLink(); |
| 164 | + parent::doLogin(); |
| 165 | + $this->open("/deployment-en/Main_Page"); |
| 166 | + $this->waitForPageToLoad("30000"); |
| 167 | + $this->click("link=Random article"); |
| 168 | + $this->waitForPageToLoad("30000"); |
| 169 | + $this->click("//li[@id='ca-edit']/a/span"); |
| 170 | + $this->waitForPageToLoad("30000"); |
| 171 | + parent::doExpandAdvanceSection(); |
| 172 | + $this->click("link=Heading"); |
| 173 | + $this->click("link=Level 2"); |
| 174 | + $this->click("link=Heading"); |
| 175 | + $this->click("link=Level 3"); |
| 176 | + $this->click("link=Heading"); |
| 177 | + $this->click("link=Level 4"); |
| 178 | + $this->type("wpTextbox1", "==Heading text==\n===Heading text===\n====Heading text===="); |
| 179 | + $this->click("wpPreview"); |
| 180 | + $this->waitForPageToLoad("30000"); |
| 181 | + try { |
| 182 | + $this->assertEquals("Heading text", $this->getText("//*[@id='wikiPreview']/h2")); |
| 183 | + } catch (PHPUnit_Framework_AssertionFailedError $e) { |
| 184 | + array_push($this->verificationErrors, $e->toString()); |
| 185 | + } |
| 186 | + try { |
| 187 | + $this->assertEquals("Heading text", $this->getText("//*[@id='wikiPreview']/h3")); |
| 188 | + } catch (PHPUnit_Framework_AssertionFailedError $e) { |
| 189 | + array_push($this->verificationErrors, $e->toString()); |
| 190 | + } |
| 191 | + try { |
| 192 | + $this->assertEquals("Heading text", $this->getText("//*[@id='wikiPreview']/h4")); |
| 193 | + } catch (PHPUnit_Framework_AssertionFailedError $e) { |
| 194 | + array_push($this->verificationErrors, $e->toString()); |
| 195 | + } |
| 196 | + |
| 197 | + parent::doLogout(); |
| 198 | + } |
| 199 | + |
| 200 | + // Add header level 2 , 3 , 4 & 5 and verify Header output |
| 201 | + function testHeaderLevel234and5(){ |
| 202 | + parent::doOpenLink(); |
| 203 | + parent::doLogin(); |
| 204 | + $this->open("/deployment-en/Main_Page"); |
| 205 | + $this->waitForPageToLoad("30000"); |
| 206 | + $this->click("link=Random article"); |
| 207 | + $this->waitForPageToLoad("30000"); |
| 208 | + $this->click("//li[@id='ca-edit']/a/span"); |
| 209 | + $this->waitForPageToLoad("30000"); |
| 210 | + parent::doExpandAdvanceSection(); |
| 211 | + $this->click("link=Heading"); |
| 212 | + $this->click("link=Level 2"); |
| 213 | + $this->click("link=Heading"); |
| 214 | + $this->click("link=Level 3"); |
| 215 | + $this->click("link=Heading"); |
| 216 | + $this->click("link=Level 4"); |
| 217 | + $this->click("link=Heading"); |
| 218 | + $this->click("link=Level 5"); |
| 219 | + $this->type("wpTextbox1", "==Heading text==\n===Heading text===\n====Heading text====\n=====Heading text====="); |
| 220 | + $this->click("wpPreview"); |
| 221 | + $this->waitForPageToLoad("30000"); |
| 222 | + try { |
| 223 | + $this->assertEquals("Heading text", $this->getText("//*[@id='wikiPreview']/h2")); |
| 224 | + } catch (PHPUnit_Framework_AssertionFailedError $e) { |
| 225 | + array_push($this->verificationErrors, $e->toString()); |
| 226 | + } |
| 227 | + try { |
| 228 | + $this->assertEquals("Heading text", $this->getText("//*[@id='wikiPreview']/h3")); |
| 229 | + } catch (PHPUnit_Framework_AssertionFailedError $e) { |
| 230 | + array_push($this->verificationErrors, $e->toString()); |
| 231 | + } |
| 232 | + try { |
| 233 | + $this->assertEquals("Heading text", $this->getText("//*[@id='wikiPreview']/h4")); |
| 234 | + } catch (PHPUnit_Framework_AssertionFailedError $e) { |
| 235 | + array_push($this->verificationErrors, $e->toString()); |
| 236 | + } |
| 237 | + try { |
| 238 | + $this->assertEquals("Heading text", $this->getText("//*[@id='wikiPreview']/h5")); |
| 239 | + } catch (PHPUnit_Framework_AssertionFailedError $e) { |
| 240 | + array_push($this->verificationErrors, $e->toString()); |
| 241 | + } |
| 242 | + |
| 243 | + parent::doLogout(); |
| 244 | + } |
| 245 | +} |
| 246 | +?> |