Index: trunk/testing/selenium/UsabilityInitiative/WikiAutomationTC/testCases/WikiDialogs_TC.php |
— | — | @@ -1,7 +1,6 @@ |
2 | 2 | <?php |
3 | | -session_start(); |
4 | 3 | require_once 'WikiCommonFunction_TC.php'; |
5 | | -require_once 'Config.php'; |
| 4 | +include 'Config.php'; |
6 | 5 | /** |
7 | 6 | * This test case will be handling the Wiki Tool bar Dialog functions |
8 | 7 | * Date : Apr - 2010 |
— | — | @@ -11,24 +10,24 @@ |
12 | 11 | |
13 | 12 | // Add a internal link and verify |
14 | 13 | function verifyInternalLink(){ |
15 | | - $this->type("wpTextbox1", ""); |
16 | | - $this->click("link=Link"); |
17 | | - $this->type("wikieditor-toolbar-link-int-target", $_SESSION["WIKI_INTERNAL_LINK"]); |
18 | | - $this->assertTrue($this->isElementPresent("wikieditor-toolbar-link-int-target-status-exists")); |
19 | | - $this->assertEquals("on", $this->getValue("wikieditor-toolbar-link-type-int")); |
20 | | - $this->click("//div[13]/div[11]/button[1]"); |
21 | | - $this->click("wpPreview"); |
22 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 14 | + $this->type(TEXT_EDITOR, ""); |
| 15 | + $this->click(LINK_ADDLINK); |
| 16 | + $this->type(TEXT_LINKNAME, (WIKI_INTERNAL_LINK)); |
| 17 | + $this->assertTrue($this->isElementPresent(ICON_PAGEEXISTS)); |
| 18 | + $this->assertEquals("on", $this->getValue(OPT_INTERNAL)); |
| 19 | + $this->click(BUTTON_INSERTLINK); |
| 20 | + $this->click(BUTTON_PREVIEW); |
| 21 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
23 | 22 | try { |
24 | | - $this->assertEquals($_SESSION["WIKI_INTERNAL_LINK"], $this->getText("link=" . $_SESSION["WIKI_INTERNAL_LINK"])); |
| 23 | + $this->assertEquals((WIKI_INTERNAL_LINK), $this->getText(LINK_START . WIKI_INTERNAL_LINK)); |
25 | 24 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
26 | 25 | parent::doCreateScreenShot(__FUNCTION__); |
27 | 26 | array_push($this->verificationErrors, $e->toString()); |
28 | 27 | } |
29 | | - $this->click("link=Daimler-Chrysler"); |
30 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 28 | + $this->click(LINK_START. WIKI_INTERNAL_LINK); |
| 29 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
31 | 30 | try { |
32 | | - $this->assertTrue($this->isTextPresent($_SESSION["WIKI_INTERNAL_LINK"]), $this->getText("firstHeading")); |
| 31 | + $this->assertTrue($this->isTextPresent(WIKI_INTERNAL_LINK), $this->getText(TEXT_PAGE_HEADING)); |
33 | 32 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
34 | 33 | parent::doCreateScreenShot(__FUNCTION__); |
35 | 34 | array_push($this->verificationErrors, $e->toString()); |
— | — | @@ -37,26 +36,25 @@ |
38 | 37 | |
39 | 38 | // Add a internal link with different display text and verify |
40 | 39 | function verifyInternalLinkWithDisplayText(){ |
41 | | - $this->type("wpTextbox1", ""); |
42 | | - $this->click("link=Link"); |
43 | | - $this->type("wpTextbox1", ""); |
44 | | - $this->type("wikieditor-toolbar-link-int-target", $_SESSION["WIKI_INTERNAL_LINK"]); |
45 | | - $this->type("wikieditor-toolbar-link-int-text", $_SESSION["WIKI_INTERNAL_LINK"] . " Test"); |
46 | | - $this->assertTrue($this->isElementPresent("wikieditor-toolbar-link-int-target-status-exists")); |
47 | | - $this->assertEquals("on", $this->getValue("wikieditor-toolbar-link-type-int")); |
48 | | - $this->click("//div[13]/div[11]/button[1]"); |
49 | | - $this->click("wpPreview"); |
50 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 40 | + $this->type(TEXT_EDITOR, ""); |
| 41 | + $this->click(LINK_ADDLINK); |
| 42 | + $this->type(TEXT_LINKNAME, (WIKI_INTERNAL_LINK)); |
| 43 | + $this->type(TEXT_LINKDISPLAYNAME, (WIKI_INTERNAL_LINK) . TEXT_LINKDISPLAYNAME_APPENDTEXT); |
| 44 | + $this->assertTrue($this->isElementPresent(ICON_PAGEEXISTS)); |
| 45 | + $this->assertEquals("on", $this->getValue(OPT_INTERNAL)); |
| 46 | + $this->click(BUTTON_INSERTLINK); |
| 47 | + $this->click(BUTTON_PREVIEW); |
| 48 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
51 | 49 | try { |
52 | | - $this->assertEquals($_SESSION["WIKI_INTERNAL_LINK"]." Test", $this->getText("link=" .$_SESSION["WIKI_INTERNAL_LINK"] ." Test")); |
| 50 | + $this->assertEquals((WIKI_INTERNAL_LINK).TEXT_LINKDISPLAYNAME_APPENDTEXT, $this->getText(LINK_START .(WIKI_INTERNAL_LINK) .TEXT_LINKDISPLAYNAME_APPENDTEXT)); |
53 | 51 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
54 | 52 | parent::doCreateScreenShot(__FUNCTION__); |
55 | 53 | array_push($this->verificationErrors, $e->toString()); |
56 | 54 | } |
57 | | - $this->click("link=" .$_SESSION["WIKI_INTERNAL_LINK"]." Test"); |
58 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 55 | + $this->click(LINK_START .(WIKI_INTERNAL_LINK).TEXT_LINKDISPLAYNAME_APPENDTEXT); |
| 56 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
59 | 57 | try { |
60 | | - $this->assertTrue($this->isTextPresent($_SESSION["WIKI_INTERNAL_LINK"]), $this->getText("firstHeading")); |
| 58 | + $this->assertTrue($this->isTextPresent((WIKI_INTERNAL_LINK)), $this->getText(TEXT_PAGE_HEADING)); |
61 | 59 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
62 | 60 | parent::doCreateScreenShot(__FUNCTION__); |
63 | 61 | array_push($this->verificationErrors, $e->toString()); |
— | — | @@ -65,24 +63,25 @@ |
66 | 64 | |
67 | 65 | // Add a internal link with blank display text and verify |
68 | 66 | function verifyInternalLinkWithBlankDisplayText(){ |
69 | | - $this->click("link=Link"); |
70 | | - $this->type("wikieditor-toolbar-link-int-target", $_SESSION["WIKI_INTERNAL_LINK"]); |
71 | | - $this->type("wikieditor-toolbar-link-int-text", ""); |
72 | | - $this->assertTrue($this->isElementPresent("wikieditor-toolbar-link-int-target-status-exists")); |
73 | | - $this->assertEquals("on", $this->getValue("wikieditor-toolbar-link-type-int")); |
74 | | - $this->click("//div[13]/div[11]/button[1]"); |
75 | | - $this->click("wpPreview"); |
76 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 67 | + $this->type(TEXT_EDITOR, ""); |
| 68 | + $this->click(LINK_ADDLINK); |
| 69 | + $this->type(TEXT_LINKNAME, (WIKI_INTERNAL_LINK)); |
| 70 | + $this->type(TEXT_LINKDISPLAYNAME, ""); |
| 71 | + $this->assertTrue($this->isElementPresent(ICON_PAGEEXISTS)); |
| 72 | + $this->assertEquals("on", $this->getValue(OPT_INTERNAL)); |
| 73 | + $this->click(BUTTON_INSERTLINK); |
| 74 | + $this->click(BUTTON_PREVIEW); |
| 75 | + $this->waitForPageToLoad((WIKI_TEST_WAIT_TIME)); |
77 | 76 | try { |
78 | | - $this->assertEquals($_SESSION["WIKI_INTERNAL_LINK"], $this->getText("link=".$_SESSION["WIKI_INTERNAL_LINK"])); |
| 77 | + $this->assertEquals((WIKI_INTERNAL_LINK), $this->getText(LINK_START.(WIKI_INTERNAL_LINK))); |
79 | 78 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
80 | 79 | parent::doCreateScreenShot(__FUNCTION__); |
81 | 80 | array_push($this->verificationErrors, $e->toString()); |
82 | 81 | } |
83 | | - $this->click("link=".$_SESSION["WIKI_INTERNAL_LINK"]); |
84 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 82 | + $this->click(LINK_START.(WIKI_INTERNAL_LINK)); |
| 83 | + $this->waitForPageToLoad((WIKI_TEST_WAIT_TIME)); |
85 | 84 | try { |
86 | | - $this->assertEquals($_SESSION["WIKI_INTERNAL_LINK"], $this->getText("firstHeading")); |
| 85 | + $this->assertEquals((WIKI_INTERNAL_LINK), $this->getText(TEXT_PAGE_HEADING)); |
87 | 86 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
88 | 87 | parent::doCreateScreenShot(__FUNCTION__); |
89 | 88 | array_push($this->verificationErrors, $e->toString()); |
— | — | @@ -91,29 +90,29 @@ |
92 | 91 | |
93 | 92 | // Add external link and verify |
94 | 93 | function verifyExternalLink(){ |
95 | | - $this->type("wpTextbox1", ""); |
96 | | - $this->click("link=Link"); |
97 | | - $this->type("wikieditor-toolbar-link-int-target", "www.google.com"); |
| 94 | + $this->type(BUTTON_PREVIEW, ""); |
| 95 | + $this->click(LINK_ADDLINK); |
| 96 | + $this->type(TEXT_LINKNAME, WIKI_EXTERNAL_LINK); |
98 | 97 | try { |
99 | | - $this->assertEquals("External link", $this->getText("wikieditor-toolbar-link-int-target-status-external")); |
| 98 | + $this->assertTrue($this->isElementPresent(ICON_PAGEEXTERNAL)); |
100 | 99 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
101 | 100 | parent::doCreateScreenShot(__FUNCTION__); |
102 | 101 | array_push($this->verificationErrors, $e->toString()); |
103 | 102 | } |
104 | | - $this->assertEquals("on", $this->getValue("wikieditor-toolbar-link-type-ext")); |
105 | | - $this->click("//div[13]/div[11]/button[1]"); |
106 | | - $this->click("wpPreview"); |
107 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 103 | + $this->assertEquals("on", $this->getValue(OPT_EXTERNAL)); |
| 104 | + $this->click(BUTTON_INSERTLINK); |
| 105 | + $this->click(BUTTON_PREVIEW); |
| 106 | + $this->waitForPageToLoad((WIKI_TEST_WAIT_TIME)); |
108 | 107 | try { |
109 | | - $this->assertEquals($_SESSION["WIKI_EXTERNAL_LINK"], $this->getText("link=".$_SESSION["WIKI_EXTERNAL_LINK"])); |
| 108 | + $this->assertEquals((WIKI_EXTERNAL_LINK), $this->getText(LINK_START.(WIKI_EXTERNAL_LINK))); |
110 | 109 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
111 | 110 | parent::doCreateScreenShot(__FUNCTION__); |
112 | 111 | array_push($this->verificationErrors, $e->toString()); |
113 | 112 | } |
114 | | - $this->click("link=".$_SESSION["WIKI_EXTERNAL_LINK"]); |
115 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 113 | + $this->click(LINK_START.(WIKI_EXTERNAL_LINK)); |
| 114 | + $this->waitForPageToLoad((WIKI_TEST_WAIT_TIME)); |
116 | 115 | try { |
117 | | - $this->assertEquals($_SESSION["WIKI_EXTERNAL_LINK_TITLE"], $this->getTitle()); |
| 116 | + $this->assertEquals((WIKI_EXTERNAL_LINK_TITLE), $this->getTitle()); |
118 | 117 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
119 | 118 | parent::doCreateScreenShot(__FUNCTION__); |
120 | 119 | array_push($this->verificationErrors, $e->toString()); |
— | — | @@ -122,63 +121,62 @@ |
123 | 122 | |
124 | 123 | // Add external link with different display text and verify |
125 | 124 | function verifyExternalLinkWithDisplayText(){ |
126 | | - $this->type("wpTextbox1", ""); |
127 | | - $this->click("link=Link"); |
128 | | - $this->type("wikieditor-toolbar-link-int-target", $_SESSION["WIKI_EXTERNAL_LINK"]); |
129 | | - $this->type("wikieditor-toolbar-link-int-text", $_SESSION["WIKI_EXTERNAL_LINK_TITLE"]); |
| 125 | + $this->type(TEXT_EDITOR, ""); |
| 126 | + $this->click(LINK_ADDLINK); |
| 127 | + $this->type(TEXT_LINKNAME, (WIKI_EXTERNAL_LINK)); |
| 128 | + $this->type(TEXT_LINKDISPLAYNAME, (WIKI_EXTERNAL_LINK_TITLE)); |
130 | 129 | try { |
131 | | - $this->assertEquals("External link", $this->getText("wikieditor-toolbar-link-int-target-status-external")); |
| 130 | + $this->assertTrue($this->isElementPresent(ICON_PAGEEXTERNAL)); |
132 | 131 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
133 | 132 | parent::doCreateScreenShot(__FUNCTION__); |
134 | 133 | array_push($this->verificationErrors, $e->toString()); |
135 | 134 | } |
136 | | - $this->assertEquals("on", $this->getValue("wikieditor-toolbar-link-type-ext")); |
137 | | - $this->click("//div[13]/div[11]/button[1]"); |
138 | | - $this->click("wpPreview"); |
139 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 135 | + $this->assertEquals("on", $this->getValue(OPT_EXTERNAL)); |
| 136 | + $this->click(BUTTON_INSERTLINK); |
| 137 | + $this->click(BUTTON_PREVIEW); |
| 138 | + $this->waitForPageToLoad((WIKI_TEST_WAIT_TIME)); |
140 | 139 | try { |
141 | | - $this->assertEquals($_SESSION["WIKI_EXTERNAL_LINK_TITLE"], $this->getText("link=".$_SESSION["WIKI_EXTERNAL_LINK_TITLE"])); |
| 140 | + $this->assertEquals((WIKI_EXTERNAL_LINK_TITLE), $this->getText(LINK_START.(WIKI_EXTERNAL_LINK_TITLE))); |
142 | 141 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
143 | 142 | parent::doCreateScreenShot(__FUNCTION__); |
144 | 143 | array_push($this->verificationErrors, $e->toString()); |
145 | 144 | } |
146 | | - $this->click("link=".$_SESSION["WIKI_EXTERNAL_LINK_TITLE"]); |
147 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 145 | + $this->click(LINK_START.(WIKI_EXTERNAL_LINK_TITLE)); |
| 146 | + $this->waitForPageToLoad((WIKI_TEST_WAIT_TIME)); |
148 | 147 | try { |
149 | | - $this->assertEquals($_SESSION["WIKI_EXTERNAL_LINK_TITLE"], $this->getTitle()); |
| 148 | + $this->assertEquals((WIKI_EXTERNAL_LINK_TITLE), $this->getTitle()); |
150 | 149 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
151 | 150 | parent::doCreateScreenShot(__FUNCTION__); |
152 | 151 | array_push($this->verificationErrors, $e->toString()); |
153 | 152 | } |
154 | | - |
155 | 153 | } |
156 | 154 | |
157 | 155 | // Add external link with Blank display text and verify |
158 | 156 | function verifyExternalLinkWithBlankDisplayText(){ |
159 | | - $this->type("wpTextbox1", ""); |
160 | | - $this->click("link=Link"); |
161 | | - $this->type("wikieditor-toolbar-link-int-target", $_SESSION["WIKI_EXTERNAL_LINK"]); |
162 | | - $this->type("wikieditor-toolbar-link-int-text", ""); |
| 157 | + $this->type(TEXT_EDITOR, ""); |
| 158 | + $this->click(LINK_ADDLINK); |
| 159 | + $this->type(TEXT_LINKNAME, (WIKI_EXTERNAL_LINK)); |
| 160 | + $this->type(TEXT_LINKDISPLAYNAME, ""); |
163 | 161 | try { |
164 | | - $this->assertEquals("External link", $this->getText("wikieditor-toolbar-link-int-target-status-external")); |
| 162 | + $this->assertTrue($this->isElementPresent(ICON_PAGEEXTERNAL)); |
165 | 163 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
166 | 164 | parent::doCreateScreenShot(__FUNCTION__); |
167 | 165 | array_push($this->verificationErrors, $e->toString()); |
168 | 166 | } |
169 | | - $this->assertEquals("on", $this->getValue("wikieditor-toolbar-link-type-ext")); |
170 | | - $this->click("//div[13]/div[11]/button[1]"); |
171 | | - $this->click("wpPreview"); |
172 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 167 | + $this->assertEquals("on", $this->getValue(OPT_EXTERNAL)); |
| 168 | + $this->click(BUTTON_INSERTLINK); |
| 169 | + $this->click(BUTTON_PREVIEW); |
| 170 | + $this->waitForPageToLoad((WIKI_TEST_WAIT_TIME)); |
173 | 171 | try { |
174 | | - $this->assertEquals("[1]", $this->getText("link=[1]")); |
| 172 | + $this->assertEquals("[1]", $this->getText(LINK_START ."[1]")); |
175 | 173 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
176 | 174 | parent::doCreateScreenShot(__FUNCTION__); |
177 | 175 | array_push($this->verificationErrors, $e->toString()); |
178 | 176 | } |
179 | | - $this->click("link=[1]"); |
180 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 177 | + $this->click(LINK_START . "[1]"); |
| 178 | + $this->waitForPageToLoad((WIKI_TEST_WAIT_TIME)); |
181 | 179 | try { |
182 | | - $this->assertEquals($_SESSION["WIKI_EXTERNAL_LINK_TITLE"], $this->getTitle()); |
| 180 | + $this->assertEquals((WIKI_EXTERNAL_LINK_TITLE), $this->getTitle()); |
183 | 181 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
184 | 182 | parent::doCreateScreenShot(__FUNCTION__); |
185 | 183 | array_push($this->verificationErrors, $e->toString()); |
— | — | @@ -187,17 +185,24 @@ |
188 | 186 | |
189 | 187 | // Add a table and verify |
190 | 188 | function verifyCreateTable(){ |
| 189 | + $WIKI_TABLE_ROW = 2; |
| 190 | + $WIKI_TABLE_COL = "5"; |
191 | 191 | parent::doExpandAdvanceSection(); |
192 | | - $this->type("wpTextbox1", ""); |
193 | | - $this->click("link=Table"); |
194 | | - $this->type("wpTextbox1", ""); |
195 | | - $this->click("wikieditor-toolbar-table-sortable"); |
196 | | - $this->click("//div[3]/button[1]"); |
197 | | - $this->click("wikieditor-toolbar-table-sortable"); |
198 | | - $this->click("wpPreview"); |
199 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 192 | + $this->type(TEXT_EDITOR, ""); |
| 193 | + $this->click(LINK_ADDTABLE); |
| 194 | + $this->click(CHK_SORT); |
| 195 | + $this->type(TEXT_ROW, $WIKI_TABLE_ROW); |
| 196 | + $this->type(TEXT_COL, $WIKI_TABLE_COL); |
| 197 | + $this->click(BUTTON_INSERTABLE); |
| 198 | + $this->click(CHK_SORT); |
| 199 | + $this->click(BUTTON_PREVIEW); |
| 200 | + $this->waitForPageToLoad((WIKI_TEST_WAIT_TIME)); |
200 | 201 | try { |
201 | | - $this->assertEquals("Header text", $this->getText("//table[@id='sortable_table_id_0']/tbody/tr[1]/th[3]")); |
| 202 | + $WIKI_TABLE_ROW = $WIKI_TABLE_ROW+1; |
| 203 | + $this->assertTrue($this->isElementPresent(TEXT_TABLEID_OTHER . |
| 204 | + TEXT_VALIDATE_TABLE_PART1 . $WIKI_TABLE_ROW . |
| 205 | + TEXT_VALIDATE_TABLE_PART2 . $WIKI_TABLE_COL . |
| 206 | + TEXT_VALIDATE_TABLE_PART3 )); |
202 | 207 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
203 | 208 | parent::doCreateScreenShot(__FUNCTION__); |
204 | 209 | array_push($this->verificationErrors, $e->toString()); |
— | — | @@ -206,18 +211,23 @@ |
207 | 212 | |
208 | 213 | // Add a table and verify only with head row |
209 | 214 | function verifyCreateTableWithHeadRow(){ |
| 215 | + $WIKI_TABLE_ROW = 3; |
| 216 | + $WIKI_TABLE_COL = "4"; |
210 | 217 | parent::doExpandAdvanceSection(); |
211 | | - $this->type("wpTextbox1", ""); |
212 | | - $this->click("link=Table"); |
213 | | - $this->click("wikieditor-toolbar-table-wikitable"); |
214 | | - $this->type("wikieditor-toolbar-table-dimensions-rows", "4"); |
215 | | - $this->type("wikieditor-toolbar-table-dimensions-columns", "4"); |
216 | | - $this->click("//div[3]/button[1]"); |
217 | | - $this->click("wikieditor-toolbar-table-wikitable"); |
218 | | - $this->click("wpPreview"); |
219 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 218 | + $this->type(TEXT_EDITOR, ""); |
| 219 | + $this->click(LINK_ADDTABLE); |
| 220 | + $this->click(CHK_BOARDER); |
| 221 | + $this->type(TEXT_ROW, $WIKI_TABLE_ROW); |
| 222 | + $this->type(TEXT_COL, $WIKI_TABLE_COL); |
| 223 | + $this->click(BUTTON_INSERTABLE); |
| 224 | + $this->click(BUTTON_PREVIEW); |
| 225 | + $this->waitForPageToLoad((WIKI_TEST_WAIT_TIME)); |
220 | 226 | try { |
221 | | - $this->assertEquals("Header text", $this->getTable("//div[@id='wikiPreview']/table.0.0")); |
| 227 | + $WIKI_TABLE_ROW = $WIKI_TABLE_ROW+1; |
| 228 | + $this->assertTrue($this->isElementPresent(TEXT_TABLEID_OTHER . |
| 229 | + TEXT_VALIDATE_TABLE_PART1 . $WIKI_TABLE_ROW . |
| 230 | + TEXT_VALIDATE_TABLE_PART2 . $WIKI_TABLE_COL . |
| 231 | + TEXT_VALIDATE_TABLE_PART3)); |
222 | 232 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
223 | 233 | parent::doCreateScreenShot(__FUNCTION__); |
224 | 234 | array_push($this->verificationErrors, $e->toString()); |
— | — | @@ -226,16 +236,22 @@ |
227 | 237 | |
228 | 238 | // Add a table and verify only with borders |
229 | 239 | function verifyCreateTableWithBorders(){ |
230 | | - $this->type("wpTextbox1", ""); |
231 | | - $this->click("link=Table"); |
232 | | - $this->click("wikieditor-toolbar-table-dimensions-header"); |
233 | | - $this->type("wikieditor-toolbar-table-dimensions-columns", "5"); |
234 | | - $this->click("//div[3]/button[1]"); |
235 | | - $this->click("wikieditor-toolbar-table-dimensions-header"); |
236 | | - $this->click("wpPreview"); |
237 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 240 | + $WIKI_TABLE_ROW = "4"; |
| 241 | + $WIKI_TABLE_COL = "6"; |
| 242 | + $this->type(TEXT_EDITOR, ""); |
| 243 | + $this->click(LINK_ADDTABLE); |
| 244 | + $this->click(CHK_HEADER); |
| 245 | + $this->type(TEXT_ROW,$WIKI_TABLE_ROW); |
| 246 | + $this->type(TEXT_COL,$WIKI_TABLE_COL); |
| 247 | + $this->click(BUTTON_INSERTABLE); |
| 248 | + $this->click(CHK_HEADER); |
| 249 | + $this->click(BUTTON_PREVIEW); |
| 250 | + $this->waitForPageToLoad((WIKI_TEST_WAIT_TIME)); |
238 | 251 | try { |
239 | | - $this->assertEquals("Example", $this->getTable("//div[@id='wikiPreview']/table.1.3")); |
| 252 | + $this->assertTrue($this->isElementPresent(TEXT_TABLEID_OTHER . |
| 253 | + TEXT_VALIDATE_TABLE_PART1 . $WIKI_TABLE_ROW . |
| 254 | + TEXT_VALIDATE_TABLE_PART2 . $WIKI_TABLE_COL . |
| 255 | + TEXT_VALIDATE_TABLE_PART3)); |
240 | 256 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
241 | 257 | parent::doCreateScreenShot(__FUNCTION__); |
242 | 258 | array_push($this->verificationErrors, $e->toString()); |
— | — | @@ -244,21 +260,26 @@ |
245 | 261 | |
246 | 262 | // Add a table and verify only with sort row |
247 | 263 | function verifyCreateTableWithSortRow(){ |
248 | | - $this->type("wpTextbox1", ""); |
249 | | - $this->click("link=Table"); |
250 | | - $this->click("wikieditor-toolbar-table-dimensions-header"); |
251 | | - $this->click("wikieditor-toolbar-table-wikitable"); |
252 | | - $this->click("wikieditor-toolbar-table-sortable"); |
253 | | - $this->type("wikieditor-toolbar-table-dimensions-rows", "2"); |
254 | | - $this->type("wikieditor-toolbar-table-dimensions-columns", "5"); |
255 | | - $this->click("//div[3]/button[1]"); |
256 | | - $this->click("wikieditor-toolbar-table-dimensions-header"); |
257 | | - $this->click("wikieditor-toolbar-table-wikitable"); |
258 | | - $this->click("wikieditor-toolbar-table-sortable"); |
259 | | - $this->click("wpPreview"); |
260 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 264 | + $WIKI_TABLE_ROW = "2"; |
| 265 | + $WIKI_TABLE_COL = "5"; |
| 266 | + $this->type(TEXT_EDITOR, ""); |
| 267 | + $this->click(LINK_ADDTABLE); |
| 268 | + $this->click(CHK_HEADER); |
| 269 | + $this->click(CHK_BOARDER); |
| 270 | + $this->click(CHK_SORT); |
| 271 | + $this->type(TEXT_ROW, $WIKI_TABLE_ROW); |
| 272 | + $this->type(TEXT_COL, $WIKI_TABLE_COL); |
| 273 | + $this->click(BUTTON_INSERTABLE); |
| 274 | + $this->click(CHK_HEADER); |
| 275 | + $this->click(CHK_BOARDER); |
| 276 | + $this->click(CHK_SORT); |
| 277 | + $this->click(BUTTON_PREVIEW); |
| 278 | + $this->waitForPageToLoad((WIKI_TEST_WAIT_TIME)); |
261 | 279 | try { |
262 | | - $this->assertEquals("Example", $this->getTable("sortable_table_id_0.0.0")); |
| 280 | + $this->assertTrue($this->isElementPresent(TEXT_TABLEID_WITHALLFEATURES . |
| 281 | + TEXT_VALIDATE_TABLE_PART1 . $WIKI_TABLE_ROW . |
| 282 | + TEXT_VALIDATE_TABLE_PART2 . $WIKI_TABLE_COL . |
| 283 | + TEXT_VALIDATE_TABLE_PART3)); |
263 | 284 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
264 | 285 | parent::doCreateScreenShot(__FUNCTION__); |
265 | 286 | array_push($this->verificationErrors, $e->toString()); |
— | — | @@ -267,52 +288,83 @@ |
268 | 289 | |
269 | 290 | // Add a table without headers,borders and sort rows |
270 | 291 | function verifyCreateTableWithNoSpecialEffects(){ |
| 292 | + $WIKI_TABLE_ROW = "6"; |
| 293 | + $WIKI_TABLE_COL = "2"; |
271 | 294 | parent::doExpandAdvanceSection(); |
272 | | - $this->type("wpTextbox1", ""); |
273 | | - $this->click("link=Table"); |
274 | | - $this->click("wikieditor-toolbar-table-wikitable"); |
275 | | - $this->click("wikieditor-toolbar-table-dimensions-header"); |
276 | | - $this->type("wikieditor-toolbar-table-dimensions-rows", "6"); |
277 | | - $this->type("wikieditor-toolbar-table-dimensions-columns", "2"); |
278 | | - $this->click("//div[3]/button[1]"); |
279 | | - $this->click("wikieditor-toolbar-table-dimensions-header"); |
280 | | - $this->click("wikieditor-toolbar-table-wikitable"); |
281 | | - $this->click("wpPreview"); |
282 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 295 | + $this->type(TEXT_EDITOR, ""); |
| 296 | + $this->click(LINK_ADDTABLE); |
| 297 | + $this->click(CHK_BOARDER); |
| 298 | + $this->click(CHK_HEADER); |
| 299 | + $this->type(TEXT_ROW, $WIKI_TABLE_ROW); |
| 300 | + $this->type(TEXT_COL, $WIKI_TABLE_COL); |
| 301 | + $this->click(BUTTON_INSERTABLE); |
| 302 | + $this->click(CHK_BOARDER); |
| 303 | + $this->click(CHK_HEADER); |
| 304 | + $this->click(BUTTON_PREVIEW); |
| 305 | + $this->waitForPageToLoad((WIKI_TEST_WAIT_TIME)); |
283 | 306 | try { |
284 | | - $this->assertEquals("Example", $this->getTable("//div[@id='wikiPreview']/table.0.0")); |
| 307 | + $this->assertTrue($this->isElementPresent(TEXT_TABLEID_OTHER . |
| 308 | + TEXT_VALIDATE_TABLE_PART1 . $WIKI_TABLE_ROW . |
| 309 | + TEXT_VALIDATE_TABLE_PART2 . $WIKI_TABLE_COL . |
| 310 | + TEXT_VALIDATE_TABLE_PART3)); |
285 | 311 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
286 | 312 | parent::doCreateScreenShot(__FUNCTION__); |
287 | 313 | array_push($this->verificationErrors, $e->toString()); |
288 | 314 | } |
289 | 315 | } |
290 | | - |
| 316 | + |
| 317 | + // Add a table with headers,borders and sort rows |
| 318 | + function verifyCreateTableWithAllSpecialEffects(){ |
| 319 | + $WIKI_TABLE_ROW = 6; |
| 320 | + $WIKI_TABLE_COL = "2"; |
| 321 | + parent::doExpandAdvanceSection(); |
| 322 | + $this->type(TEXT_EDITOR, ""); |
| 323 | + $this->click(LINK_ADDTABLE); |
| 324 | + $this->click(CHK_SORT); |
| 325 | + $this->type(TEXT_ROW, $WIKI_TABLE_ROW); |
| 326 | + $this->type(TEXT_COL, $WIKI_TABLE_COL); |
| 327 | + $this->click(BUTTON_INSERTABLE); |
| 328 | + $this->click(CHK_SORT); |
| 329 | + $this->click(BUTTON_PREVIEW); |
| 330 | + $this->waitForPageToLoad((WIKI_TEST_WAIT_TIME)); |
| 331 | + try { |
| 332 | + $WIKI_TABLE_ROW = $WIKI_TABLE_ROW+1; |
| 333 | + $this->assertTrue($this->isElementPresent(TEXT_TABLEID_WITHALLFEATURES . |
| 334 | + TEXT_VALIDATE_TABLE_PART1 . $WIKI_TABLE_ROW . |
| 335 | + TEXT_VALIDATE_TABLE_PART2 . $WIKI_TABLE_COL . |
| 336 | + TEXT_VALIDATE_TABLE_PART3)); |
| 337 | + } catch (PHPUnit_Framework_AssertionFailedError $e) { |
| 338 | + parent::doCreateScreenShot(__FUNCTION__); |
| 339 | + array_push($this->verificationErrors, $e->toString()); |
| 340 | + } |
| 341 | + } |
| 342 | + |
291 | 343 | // Verify the replace all function on Search and Replace |
292 | 344 | function verifyTextSearchReplaceAll(){ |
293 | 345 | parent::doExpandAdvanceSection(); |
294 | | - $this->type("wpTextbox1", ""); |
295 | | - $this->click("link=Search and replace"); |
296 | | - $this->type("wpTextbox1", $_SESSION["WIKI_SAMPLE_TEXT"]); |
297 | | - $this->type("wikieditor-toolbar-replace-search", $_SESSION["WIKI_SEARCH_TEXT"]); |
298 | | - $this->type("wikieditor-toolbar-replace-replace", $_SESSION["WIKI_REPLACE_TEXT"]); |
299 | | - $this->click("//button[3]"); |
300 | | - $this->click("//button[4]"); |
301 | | - $this->click("wpPreview"); |
302 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 346 | + $this->type(TEXT_EDITOR, ""); |
| 347 | + $this->click(LINK_SEARCH); |
| 348 | + $this->type(TEXT_EDITOR, (TEXT_SAMPLE)); |
| 349 | + $this->type(INPUT_SEARCH, (TEXT_SEARCH)); |
| 350 | + $this->type(INPUT_REPLACE, (TEXT_REPLACE)); |
| 351 | + $this->click(BUTTON_REPLACEALL); |
| 352 | + $this->click(BUTTON_CANCEL); |
| 353 | + $this->click(BUTTON_PREVIEW); |
| 354 | + $this->waitForPageToLoad((WIKI_TEST_WAIT_TIME)); |
303 | 355 | try { |
304 | | - $this->assertEquals($_SESSION["WIKI_REPLACE_TEXT"], $this->getText("//div[@id='wikiPreview']/p[1]")); |
| 356 | + $this->assertEquals((TEXT_REPLACE), $this->getText(TEXT_PREVIEW_TEXT1)); |
305 | 357 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
306 | 358 | parent::doCreateScreenShot(__FUNCTION__); |
307 | 359 | array_push($this->verificationErrors, $e->toString()); |
308 | 360 | } |
309 | 361 | try { |
310 | | - $this->assertEquals($_SESSION["WIKI_REPLACE_TEXT"], $this->getText("//div[@id='wikiPreview']/p[2]")); |
| 362 | + $this->assertEquals((TEXT_REPLACE), $this->getText(TEXT_PREVIEW_TEXT2)); |
311 | 363 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
312 | 364 | parent::doCreateScreenShot(__FUNCTION__); |
313 | 365 | array_push($this->verificationErrors, $e->toString()); |
314 | 366 | } |
315 | 367 | try { |
316 | | - $this->assertEquals($_SESSION["WIKI_REPLACE_TEXT"], $this->getText("//div[@id='wikiPreview']/p[3]")); |
| 368 | + $this->assertEquals((TEXT_REPLACE), $this->getText(TEXT_PREVIEW_TEXT3)); |
317 | 369 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
318 | 370 | parent::doCreateScreenShot(__FUNCTION__); |
319 | 371 | array_push($this->verificationErrors, $e->toString()); |
— | — | @@ -322,40 +374,38 @@ |
323 | 375 | // Verify the replace next function on Search and Replace |
324 | 376 | function verifyTextSearchReplaceNext(){ |
325 | 377 | parent::doExpandAdvanceSection(); |
326 | | - $this->type("wpTextbox1", ""); |
327 | | - $this->click("link=Search and replace"); |
328 | | - $this->type("wpTextbox1", $_SESSION["WIKI_SAMPLE_TEXT"]); |
329 | | - $this->click("link=Search and replace"); |
330 | | - $this->type("wpTextbox1", $_SESSION["WIKI_SAMPLE_TEXT"]); |
331 | | - $this->type("wikieditor-toolbar-replace-search", $_SESSION["WIKI_SEARCH_TEXT"]); |
332 | | - $this->type("wikieditor-toolbar-replace-replace", $_SESSION["WIKI_REPLACE_TEXT"]); |
333 | | - $this->click("//div[13]/div[11]/button[2]"); |
334 | | - $this->click("//div[13]/div[11]/button[2]"); |
335 | | - $this->click("//button[4]"); |
336 | | - $this->click("wpPreview"); |
337 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 378 | + $this->type(TEXT_EDITOR, ""); |
| 379 | + $this->click(LINK_SEARCH); |
| 380 | + $this->type(TEXT_EDITOR, (TEXT_SAMPLE)); |
| 381 | + $this->type(INPUT_SEARCH, (TEXT_SEARCH)); |
| 382 | + $this->type(INPUT_REPLACE, (TEXT_REPLACE)); |
| 383 | + $this->click(BUTTON_REPLACENEXT); |
| 384 | + $this->click(BUTTON_REPLACENEXT); |
| 385 | + $this->click(BUTTON_CANCEL); |
| 386 | + $this->click(BUTTON_PREVIEW); |
| 387 | + $this->waitForPageToLoad((WIKI_TEST_WAIT_TIME)); |
338 | 388 | try { |
339 | | - $this->assertEquals($_SESSION["WIKI_REPLACE_TEXT"], $this->getText("//div[@id='wikiPreview']/p[1]")); |
| 389 | + $this->assertEquals((TEXT_REPLACE), $this->getText(TEXT_PREVIEW_TEXT1)); |
340 | 390 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
341 | 391 | parent::doCreateScreenShot(__FUNCTION__); |
342 | 392 | array_push($this->verificationErrors, $e->toString()); |
343 | 393 | } |
344 | 394 | try { |
345 | | - $this->assertEquals($_SESSION["WIKI_REPLACE_TEXT"], $this->getText("//div[@id='wikiPreview']/p[2]")); |
| 395 | + $this->assertEquals((TEXT_REPLACE), $this->getText(TEXT_PREVIEW_TEXT2)); |
346 | 396 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
347 | 397 | parent::doCreateScreenShot(__FUNCTION__); |
348 | 398 | array_push($this->verificationErrors, $e->toString()); |
349 | 399 | } |
350 | 400 | try { |
351 | | - $this->assertEquals($_SESSION["WIKI_SEARCH_TEXT"], $this->getText("//div[@id='wikiPreview']/p[3]")); |
| 401 | + $this->assertEquals((TEXT_SEARCH), $this->getText(TEXT_PREVIEW_TEXT3)); |
352 | 402 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
353 | 403 | parent::doCreateScreenShot(__FUNCTION__); |
354 | 404 | array_push($this->verificationErrors, $e->toString()); |
355 | 405 | } |
356 | 406 | } |
357 | 407 | |
358 | | - /* |
359 | | - * // When user click on find, text highlight on back which is not captured in Selenium directly. |
| 408 | + /*/Verify the find next function on Search and Replace |
| 409 | + // When user click on find, text highlight on back which is not captured in Selenium directly. |
360 | 410 | function verifyTextSearchFindNext(){ |
361 | 411 | parent::doExpandAdvanceSection(); |
362 | 412 | $this->type("wpTextbox1", ""); |
— | — | @@ -363,7 +413,75 @@ |
364 | 414 | $this->click("link=Search and replace"); |
365 | 415 | $this->type("wikieditor-toolbar-replace-search", "Test"); |
366 | 416 | |
| 417 | + }*/ |
| 418 | + |
| 419 | + |
| 420 | + // Verify Match Case option with Replace All on Search and Replace |
| 421 | + function verifyTextMatchCase(){ |
| 422 | + parent::doExpandAdvanceSection(); |
| 423 | + $this->type(TEXT_EDITOR, ""); |
| 424 | + $this->click(LINK_SEARCH); |
| 425 | + $this->type(TEXT_EDITOR, (TEXT_SAMPLE_CASE)); |
| 426 | + $this->type(INPUT_SEARCH, (TEXT_SEARCH_CASE)); |
| 427 | + $this->type(INPUT_REPLACE, (TEXT_REPLACE)); |
| 428 | + $this->click(CHK_MATCHCASE); |
| 429 | + $this->click(BUTTON_REPLACEALL); |
| 430 | + $this->click(BUTTON_CANCEL); |
| 431 | + $this->click(BUTTON_PREVIEW); |
| 432 | + $this->waitForPageToLoad((WIKI_TEST_WAIT_TIME)); |
| 433 | + try { |
| 434 | + $this->assertEquals((TEXT_SEARCH), $this->getText(TEXT_PREVIEW_TEXT1)); |
| 435 | + } catch (PHPUnit_Framework_AssertionFailedError $e) { |
| 436 | + parent::doCreateScreenShot(__FUNCTION__); |
| 437 | + array_push($this->verificationErrors, $e->toString()); |
| 438 | + } |
| 439 | + try { |
| 440 | + $this->assertEquals((TEXT_REPLACE), $this->getText(TEXT_PREVIEW_TEXT2)); |
| 441 | + } catch (PHPUnit_Framework_AssertionFailedError $e) { |
| 442 | + parent::doCreateScreenShot(__FUNCTION__); |
| 443 | + array_push($this->verificationErrors, $e->toString()); |
| 444 | + } |
| 445 | + try { |
| 446 | + $this->assertEquals((TEXT_REPLACE), $this->getText(TEXT_PREVIEW_TEXT3)); |
| 447 | + } catch (PHPUnit_Framework_AssertionFailedError $e) { |
| 448 | + parent::doCreateScreenShot(__FUNCTION__); |
| 449 | + array_push($this->verificationErrors, $e->toString()); |
| 450 | + } |
| 451 | + |
367 | 452 | } |
368 | | - */ |
| 453 | + |
| 454 | + // Verify Regular expression option with Replace All on Search and Replace |
| 455 | + function verifyRegEx(){ |
| 456 | + parent::doExpandAdvanceSection(); |
| 457 | + $this->type(TEXT_EDITOR, ""); |
| 458 | + $this->click(LINK_SEARCH); |
| 459 | + $this->type(TEXT_EDITOR, (TEXT_SAMPLE_REGEX)); |
| 460 | + $this->type(INPUT_SEARCH, (TEXT_SEARCH_REGEX)); |
| 461 | + $this->type(INPUT_REPLACE, (TEXT_REPLACE_REGEX)); |
| 462 | + $this->click(CHK_REGEX); |
| 463 | + $this->click(BUTTON_REPLACEALL); |
| 464 | + $this->click(BUTTON_CANCEL); |
| 465 | + $this->click(BUTTON_PREVIEW); |
| 466 | + $this->waitForPageToLoad((WIKI_TEST_WAIT_TIME)); |
| 467 | + try { |
| 468 | + $this->assertEquals((TEXT_REGEX_PREVIEW), $this->getText(TEXT_PREVIEW_TEXT1)); |
| 469 | + } catch (PHPUnit_Framework_AssertionFailedError $e) { |
| 470 | + parent::doCreateScreenShot(__FUNCTION__); |
| 471 | + array_push($this->verificationErrors, $e->toString()); |
| 472 | + } |
| 473 | + try { |
| 474 | + $this->assertEquals((TEXT_REGEX_PREVIEW), $this->getText(TEXT_PREVIEW_TEXT2)); |
| 475 | + } catch (PHPUnit_Framework_AssertionFailedError $e) { |
| 476 | + parent::doCreateScreenShot(__FUNCTION__); |
| 477 | + array_push($this->verificationErrors, $e->toString()); |
| 478 | + } |
| 479 | + try { |
| 480 | + $this->assertEquals((TEXT_REGEX_PREVIEW), $this->getText(TEXT_PREVIEW_TEXT3)); |
| 481 | + } catch (PHPUnit_Framework_AssertionFailedError $e) { |
| 482 | + parent::doCreateScreenShot(__FUNCTION__); |
| 483 | + array_push($this->verificationErrors, $e->toString()); |
| 484 | + } |
| 485 | + } |
| 486 | + |
369 | 487 | } |
370 | | -?> |
| 488 | +?> |
\ No newline at end of file |
Index: trunk/testing/selenium/UsabilityInitiative/WikiAutomationTC/testCases/WikiToolBarOther_NewPage.php |
— | — | @@ -12,7 +12,6 @@ |
13 | 13 | parent::setUp(); |
14 | 14 | } |
15 | 15 | |
16 | | - |
17 | 16 | //Create a new page temporary |
18 | 17 | function createNewPage(){ |
19 | 18 | parent::doOpenLink(); |
— | — | @@ -22,11 +21,18 @@ |
23 | 22 | |
24 | 23 | // Click on Embedded file function and verify the output |
25 | 24 | function testEmbeddedFile(){ |
26 | | - $this->createNewPage(); |
| 25 | + $this->createNewPage(); |
27 | 26 | parent::verifyEmbeddedFile(); |
28 | 27 | parent::doLogout(); |
29 | 28 | } |
30 | 29 | |
| 30 | + //Create a reference and verify the output |
| 31 | + function testReferenceLink(){ |
| 32 | + $this->createNewPage(); |
| 33 | + parent::verifyReference(); |
| 34 | + parent::doLogout(); |
| 35 | + } |
| 36 | + |
31 | 37 | // Click on Picture Gallery function and verify the output |
32 | 38 | function testPictureGallery(){ |
33 | 39 | $this->createNewPage(); |
Index: trunk/testing/selenium/UsabilityInitiative/WikiAutomationTC/testCases/WikiToolBarOther_ExistingPage.php |
— | — | @@ -28,6 +28,14 @@ |
29 | 29 | parent::doLogout(); |
30 | 30 | } |
31 | 31 | |
| 32 | + //Create a reference and verify the output |
| 33 | + function testReferenceLink(){ |
| 34 | + $this->openRandomPage(); |
| 35 | + parent::verifyReference(); |
| 36 | + parent::doLogout(); |
| 37 | + } |
| 38 | + |
| 39 | + |
32 | 40 | // Click on Picture Gallery function and verify the output |
33 | 41 | function testPictureGallery(){ |
34 | 42 | $this->openRandomPage(); |
Index: trunk/testing/selenium/UsabilityInitiative/WikiAutomationTC/testCases/WikiDialogs_ExsistingPage.php |
— | — | @@ -25,7 +25,8 @@ |
26 | 26 | parent::doLogout(); |
27 | 27 | } |
28 | 28 | |
29 | | - // Add a internal link with different display text and verify |
| 29 | + |
| 30 | + // Add a internal link with different display text and verify |
30 | 31 | function testInternalLinkWithDisplayText(){ |
31 | 32 | $this->openRandomPage(); |
32 | 33 | parent::verifyInternalLinkWithDisplayText(); |
— | — | @@ -95,6 +96,12 @@ |
96 | 97 | parent::doLogout(); |
97 | 98 | } |
98 | 99 | |
| 100 | + // Add a table with headers,borders and sort rows |
| 101 | + function testCreateTableWithAllSpecialEffects(){ |
| 102 | + $this->openRandomPage(); |
| 103 | + parent::verifyCreateTableWithAllSpecialEffects(); |
| 104 | + parent::doLogout(); |
| 105 | + } |
99 | 106 | // Verify the replace all function on Search and Replace |
100 | 107 | function testTextSearchReplaceAll(){ |
101 | 108 | $this->openRandomPage(); |
— | — | @@ -109,8 +116,8 @@ |
110 | 117 | parent::doLogout(); |
111 | 118 | } |
112 | 119 | |
113 | | - // When user click on find, text highlight on back which is not captured in Selenium directly. */ |
114 | | - /* function testTextSearchFindNext(){ |
| 120 | + // When user click on find, text highlight on back which is not captured in Selenium directly. |
| 121 | + function testTextSearchFindNext(){ |
115 | 122 | parent::doOpenLink(); |
116 | 123 | parent::doLogin(); |
117 | 124 | $this->open("/deployment-en/Main_Page"); |
— | — | @@ -118,6 +125,20 @@ |
119 | 126 | parent::doAccessRandomPage(); |
120 | 127 | parent::verifyTextSearchFindNext(); |
121 | 128 | parent::doLogout(); |
122 | | - }*/ |
| 129 | + } |
| 130 | + |
| 131 | + // Verify the Match Case option with Replace All on Search and Replace |
| 132 | + function testTextMatchCase(){ |
| 133 | + $this->openRandomPage(); |
| 134 | + parent::verifyTextMatchCase(); |
| 135 | + parent::doLogout(); |
| 136 | + } |
| 137 | + |
| 138 | + //Verify Regular expression option with Replace All on Search and Replace |
| 139 | + function testRegEx(){ |
| 140 | + $this->openRandomPage(); |
| 141 | + parent::verifyRegEx(); |
| 142 | + parent::doLogout(); |
| 143 | + } |
123 | 144 | } |
124 | 145 | ?> |
Index: trunk/testing/selenium/UsabilityInitiative/WikiAutomationTC/testCases/Config.php |
— | — | @@ -4,22 +4,190 @@ |
5 | 5 | * Date : Apr - 2010 |
6 | 6 | * @author : BhagyaG - Calcey |
7 | 7 | */ |
8 | | -$_SESSION["WIKI_WEB_URL"]="http://prototype.wikimedia.org/"; // The web site URL |
9 | | -$_SESSION["WIKI_OPEN_PAGE"]= "/en.wikipedia.org/Main_Page"; // Main page URL |
10 | | -$_SESSION["WIKI_TEST_WAIT_TIME"]= "30000"; // Waiting time |
11 | | -$_SESSION["WIKI_USER_NAME"]= "bhagya_ca"; // User name |
12 | | -$_SESSION["WIKI_USER_PASSWORD"]= "test"; // Password |
13 | | -$_SESSION["WIKI_USER_DISPLAY_NAME"]= "Bhagya ca"; // Display name of the user |
14 | | -$_SESSION["WIKI_SEARCH_PAGE"]= "Hair (musical)"; // Page name to search |
15 | | -$_SESSION["WIKI_SEARCH_TEXT"]= "TV"; // Text to search |
16 | | -$_SESSION["WIKI_INTERNAL_LINK"]= "Daimler-Chrysler"; // Exisiting page name to add as an internal tag |
17 | | -$_SESSION["WIKI_EXTERNAL_LINK"]= "www.google.com"; // External web site name |
18 | | -$_SESSION["WIKI_EXTERNAL_LINK_TITLE"] = "Google"; // Page title of the external web site name |
19 | | -$_SESSION["WIKI_SAMPLE_TEXT"] = "calcey qa\n\ncalcey qa\n\ncalcey qa"; // String to type in the editor to use for search and replace |
20 | | -$_SESSION["WIKI_SEARCH_TEXT"] = "calcey qa"; // Text use for search |
21 | | -$_SESSION["WIKI_REPLACE_TEXT"] = "test team" ; // Text use for replace search text |
22 | | -$_SESSION["WIKI_CODE_PATH"] = getcwd(); |
23 | | -$_SESSION["WIKI_SCREENSHOTS_PATH"] = "screenshots"; |
24 | | -$_SESSION["WIKI_SCREENSHOTS_TYPE"] = "png"; |
| 8 | +// Common variables |
25 | 9 | |
| 10 | +define ('WIKI_WEB_URL', "http://prototype.wikimedia.org/"); // Domain name |
| 11 | +define ('WIKI_OPEN_PAGE',"/en.wikipedia.org/Main_Page"); // Main page URL |
| 12 | + |
| 13 | +define ('WIKI_TEST_WAIT_TIME', "30000"); // Waiting time |
| 14 | +define ('WIKI_USER_NAME', "bhagya_ca"); // User name |
| 15 | +define ('WIKI_USER_PASSWORD', "test"); // Password |
| 16 | +define ('WIKI_USER_DISPLAY_NAME', "Bhagya ca"); // Display name of the user |
| 17 | +define ('WIKI_SEARCH_PAGE',"Hair (musical)"); // Page name to search |
| 18 | +define ('WIKI_TEXT_SEARCH',"TV"); // Text to search |
| 19 | +define ('WIKI_INTERNAL_LINK',"Daimler-Chrysler"); // Exisiting page name to add as an internal tag |
| 20 | +define ('WIKI_EXTERNAL_LINK',"www.google.com"); // External web site name |
| 21 | +define ('WIKI_EXTERNAL_LINK_TITLE',"Google"); // Page title of the external web site name |
| 22 | +define ('WIKI_CODE_PATH',getcwd()); // get the current path of the program |
| 23 | +define ('WIKI_SCREENSHOTS_PATH',"screenshots"); // the folder the error screen shots will be saved |
| 24 | +define ('WIKI_SCREENSHOTS_TYPE',"png"); // screen print type |
| 25 | +define ('WIKI_TEMP_NEWPAGE',"TestWikiPage"); // temporary creating new page name |
| 26 | + |
| 27 | + |
| 28 | +// tool bar, buttons , links |
| 29 | +// commonly using links |
| 30 | +define ('LINK_MAIN_PAGE',"link=Main page"); |
| 31 | +define ('LINK_RANDOM_PAGE',"link=Random article"); |
| 32 | +define ('TEXT_PAGE_HEADING',"firstHeading"); |
| 33 | +define ('LINK_START',"link="); |
| 34 | +define ('LINK_EDITPAGE',"//li[@id='ca-edit']/a/span"); |
| 35 | +define ('TEXT_EDITOR',"wpTextbox1"); |
| 36 | +define ('BUTTON_PREVIEW',"wpPreview"); |
| 37 | + |
| 38 | +// for WikiSearch_TC |
| 39 | +define ('INPUT_SEARCH_BOX', "searchInput"); |
| 40 | +define ('BUTTON_SEARCH',"searchButton"); |
| 41 | +define ('TEXT_SEARCH_RESULT_HEADING'," - Search results - Wikipedia, the free encyclopedia"); |
| 42 | + |
| 43 | +// for WikiWatchUnWatch_TC |
| 44 | +define ('LINK_WATCH_PAGE',"link=Watch"); |
| 45 | +define ('LINK_WATCH_LIST',"link=My watchlist"); |
| 46 | +define ('LINK_WATCH_EDIT',"link=View and edit watchlist"); |
| 47 | +define ('LINK_UNWATCH',"link=Unwatch"); |
| 48 | +define ('BUTTON_WATCH',"wpWatchthis"); |
| 49 | +define ('BUTTON_SAVE_WATCH',"wpSave"); |
| 50 | +define ('TEXT_WATCH',"Watch"); |
| 51 | +define ('TEXT_UNWATCH',"Unwatch"); |
| 52 | + |
| 53 | +// for WikiCommonFunction_TC |
| 54 | +define ('TEXT_LOGOUT',"Log out"); |
| 55 | +define ('LINK_LOGOUT',"link=Log out"); |
| 56 | +define ('LINK_LOGIN',"link=Log in / create account"); |
| 57 | +define ('TEXT_LOGOUT_CONFIRM',"Log in / create account"); |
| 58 | +define ('INPUT_USER_NAME', "wpName1"); |
| 59 | +define ('INPUT_PASSWD', "wpPassword1"); |
| 60 | +define ('BUTTON_LOGIN',"wpLoginAttempt"); |
| 61 | +define ('TEXT_HEADING',"Heading"); |
| 62 | +define ('LINK_ADVANCED',"link=Advanced"); |
| 63 | + |
| 64 | +// for WikiDialogs_TC |
| 65 | +define ('LINK_ADDLINK',"//div[@id='wikiEditor-ui-toolbar']/div[1]/div[2]/span[1]"); |
| 66 | +define ('TEXT_LINKNAME',"wikieditor-toolbar-link-int-target"); |
| 67 | +define ('TEXT_LINKDISPLAYNAME',"wikieditor-toolbar-link-int-text"); |
| 68 | +define ('TEXT_LINKDISPLAYNAME_APPENDTEXT'," Test"); |
| 69 | +define ('ICON_PAGEEXISTS',"wikieditor-toolbar-link-int-target-status-exists"); |
| 70 | +define ('ICON_PAGEEXTERNAL',"wikieditor-toolbar-link-int-target-status-external"); |
| 71 | +define ('OPT_INTERNAL',"wikieditor-toolbar-link-type-int"); |
| 72 | +define ('OPT_EXTERNAL',"wikieditor-toolbar-link-type-ext"); |
| 73 | +define ('BUTTON_INSERTLINK',"//div[10]/div[11]/button[1]"); |
| 74 | +define ('LINK_ADDTABLE',"//div[@id='wikiEditor-ui-toolbar']/div[3]/div[1]/div[4]/span[2]"); |
| 75 | +define ('CHK_HEADER',"wikieditor-toolbar-table-dimensions-header"); |
| 76 | +define ('CHK_BOARDER',"wikieditor-toolbar-table-wikitable"); |
| 77 | +define ('CHK_SORT',"wikieditor-toolbar-table-sortable"); |
| 78 | +define ('TEXT_ROW',"wikieditor-toolbar-table-dimensions-rows"); |
| 79 | +define ('TEXT_COL',"wikieditor-toolbar-table-dimensions-columns"); |
| 80 | +define ('BUTTON_INSERTABLE',"//div[3]/button[1]"); |
| 81 | +define ('TEXT_HEADTABLE_TEXT',"Header text"); |
| 82 | +define ('TEXT_TABLEID_WITHALLFEATURES', "//table[@id='sortable_table_id_0']/tbody/" ); |
| 83 | +define ('TEXT_TABLEID_OTHER', "//div[@id='wikiPreview']/table/tbody/" ); |
| 84 | +define ('TEXT_VALIDATE_TABLE_PART1', "tr["); |
| 85 | +define ('TEXT_VALIDATE_TABLE_PART2',"]/td["); |
| 86 | +define ('TEXT_VALIDATE_TABLE_PART3',"]"); |
| 87 | +define ('LINK_SEARCH',"//div[@id='wikiEditor-ui-toolbar']/div[3]/div[1]/div[5]/span"); |
| 88 | +define ('INPUT_SEARCH',"wikieditor-toolbar-replace-search"); |
| 89 | +define ('INPUT_REPLACE',"wikieditor-toolbar-replace-replace"); |
| 90 | +define ('BUTTON_REPLACEALL',"//button[3]"); |
| 91 | +define ('BUTTON_REPLACENEXT',"//button[2]"); |
| 92 | +define ('BUTTON_CANCEL',"//button[4]"); |
| 93 | +define ('TEXT_PREVIEW_TEXT1',"//div[@id='wikiPreview']/p[1]"); |
| 94 | +define ('TEXT_PREVIEW_TEXT2',"//div[@id='wikiPreview']/p[2]"); |
| 95 | +define ('TEXT_PREVIEW_TEXT3',"//div[@id='wikiPreview']/p[3]"); |
| 96 | +define ('TEXT_SAMPLE',"calcey qa\n\ncalcey qa\n\ncalcey qa"); |
| 97 | +define ('TEXT_SAMPLE_CASE',"calcey qa\n\nCalcey qa\n\nCalcey qa"); |
| 98 | +define ('TEXT_SAMPLE_REGEX',"testing Plan\n\ntest Plan\n\ntestQA Plan"); |
| 99 | +define ('TEXT_SEARCH',"calcey qa"); |
| 100 | +define ('TEXT_SEARCH_CASE',"Calcey qa"); |
| 101 | +define ('TEXT_SEARCH_REGEX',"test[^ ]*"); |
| 102 | +define ('TEXT_REPLACE',"test team") ; |
| 103 | +define ('TEXT_REPLACE_REGEX',"QA") ; |
| 104 | +define ('TEXT_REGEX_PREVIEW',"QA Plan") ; |
| 105 | +define ('CHK_MATCHCASE',"wikieditor-toolbar-replace-case"); |
| 106 | +define ('CHK_REGEX',"wikieditor-toolbar-replace-regex"); |
| 107 | + |
| 108 | + |
| 109 | +// For WikiTextFormat_TC |
| 110 | +define ('LINK_BOLD',"//*[@id='wikiEditor-ui-toolbar']/div[1]/div[1]/span[1]"); |
| 111 | +define ('TEXT_BOLD',"'''Bold''' text"); |
| 112 | +define ('TEXT_VALIDATE_BOLD',"Bold"); |
| 113 | +define ('TEXT_VALIDATE_BOLDTEXT',"//div[@id='wikiPreview']/p/b"); |
| 114 | +define ('LINK_ITALIC',"//*[@id='wikiEditor-ui-toolbar']/div[1]/div[1]/span[2]"); |
| 115 | +define ('TEXT_ITALIC',"''Italian'' text"); |
| 116 | +define ('TEXT_VALIDATE_ITALIC',"Italian"); |
| 117 | +define ('TEXT_VALIDATE_ITALICTEXT',"//div[@id='wikiPreview']/p/i"); |
| 118 | +define ('TEXT_ITALIC_BOLD',"Text '''''Italic & Bold'''''"); |
| 119 | +define ('TEXT_VALIDATE_ITALICBOLD',"Italic & Bold"); |
| 120 | +define ('TEXT_VALIDATE_ITALICBOLDTEXT',"//div[@id='wikiPreview']/p/i/b"); |
| 121 | +define ('LINK_BULLET',"//*[@id='wikiEditor-ui-toolbar']/div[3]/div[1]/div[2]/span[1]"); |
| 122 | +define ('TEXT_BULLET',"* Bulleted list item\n* Bulleted list item\n* Bulleted list item"); |
| 123 | +define ('TEXT_BULLET_TEXT',"Bulleted list item"); |
| 124 | +define ('TEXT_BULLET_1',"//div[@id='wikiPreview']/ul/li[1]"); |
| 125 | +define ('TEXT_BULLET_2',"//div[@id='wikiPreview']/ul/li[2]"); |
| 126 | +define ('TEXT_BULLET_3',"//div[@id='wikiPreview']/ul/li[3]"); |
| 127 | +define ('LINK_NUMBERED',"//*[@id='wikiEditor-ui-toolbar']/div[3]/div[1]/div[2]/span[2]"); |
| 128 | +define ('TEXT_NUMBERED',"# Numbered list item\n# Numbered list item\n# Numbered list item"); |
| 129 | +define ('TEXT_NUMBERED_TEXT',"Numbered list item"); |
| 130 | +define ('TEXT_NUMBERED_1',"//div[@id='wikiPreview']/ol/li[1]"); |
| 131 | +define ('TEXT_NUMBERED_2',"//div[@id='wikiPreview']/ol/li[2]"); |
| 132 | +define ('TEXT_NUMBERED_3',"//div[@id='wikiPreview']/ol/li[3]"); |
| 133 | +define ('TEXT_NOWIKI',"<nowiki>==Heading text==</nowiki>"); |
| 134 | +define ('TEXT_NOWIKI_TEXT',"==Heading text=="); |
| 135 | +define ('TEXT_NOWIKI_VALIDATE',"//div[@id='wikiPreview']/p"); |
| 136 | +define ('TEXT_LINEBREAK',"this is a test text to check the line\n break."); |
| 137 | +define ('TEXT_LINEBREAK_TEXT',"this is a test text to check the line\n break."); |
| 138 | +define ('TEXT_LINEBREAK_VALIDATE',"//div[@id='wikiPreview']/p"); |
| 139 | +define ('LINK_TEXTBIG',"//*[@id='wikiEditor-ui-toolbar']/div[3]/div[1]/div[3]/span[1]"); |
| 140 | +define ('TEXT_TEXTBIG',"<big>This</big> text"); |
| 141 | +define ('TEXT_TEXTBIG_TEXT',"This"); |
| 142 | +define ('TEXT_TEXTBIG_VALIDATE',"//div[@id='wikiPreview']/p/big"); |
| 143 | +define ('LINK_TEXTSMALL',"//*[@id='wikiEditor-ui-toolbar']/div[3]/div[1]/div[3]/span[2]"); |
| 144 | +define ('TEXT_TEXTSMALL',"<small>This</small> text\n"); |
| 145 | +define ('TEXT_TEXTSMALL_TEXT',"This"); |
| 146 | +define ('TEXT_TEXTSMALL_VALIDATE',"//div[@id='wikiPreview']/p/small"); |
| 147 | +define ('LINK_TEXTSUPER',"//*[@id='wikiEditor-ui-toolbar']/div[3]/div[1]/div[3]/span[3]"); |
| 148 | +define ('TEXT_TEXTSUPER',"<sup>This</sup> text\n"); |
| 149 | +define ('TEXT_TEXTSUPER_TEXT',"This"); |
| 150 | +define ('TEXT_TEXTSUPER_VALIDATE',"//div[@id='wikiPreview']/p/sup"); |
| 151 | +define ('LINK_TEXTSUB',"//*[@id='wikiEditor-ui-toolbar']/div[3]/div[1]/div[3]/span[4]"); |
| 152 | +define ('TEXT_TEXTSUB', "<sub>This</sub> text\n"); |
| 153 | +define ('TEXT_TEXTSUB_TEXT',"This"); |
| 154 | +define ('TEXT_TEXTSUB_VALIDATE',"//div[@id='wikiPreview']/p/sub"); |
| 155 | + |
| 156 | +// for WikiToolBarOther_TC |
| 157 | + |
| 158 | +define ('LINK_TEXTEMBEDDED',"//*[@id='wikiEditor-ui-toolbar']/div[1]/div[2]/span[2]"); |
| 159 | +define ('TEXT_TEXTEMBEDDED',"[[File:Example.jpg]]"); |
| 160 | +define ('TEXT_TEXTEMBEDDED_VALIDATE',"//img[@alt='Example.jpg']"); |
| 161 | + |
| 162 | +define ('LINK_TEXTREFERENCE',"//*[@id='wikiEditor-ui-toolbar']/div[1]/div[2]/span[3]"); |
| 163 | +define ('INPUT_TEXTREFERENCE', "wikieditor-toolbar-reference-text"); |
| 164 | +define ('TEXT_TEXTREFERENCE', "Test Reference"); |
| 165 | +define ('BUTTON_REFERENCE', "//button[@type='button']"); |
| 166 | +define ('TEXT_TEXTREFERENCE_EDITOR',"This is a text <ref>Test Reference</ref>\n\n\n{{reflist}}"); |
| 167 | +define ('TEXT_REFERENCEID', "[1]"); |
| 168 | +define ('TEXT_REFERENCELINK', "link=[1]"); |
| 169 | +define ('TEXT_REFERENCE', "^ Test Reference"); |
| 170 | +define ('TEXT_PICTURELINK', "//*[@id='wikiEditor-ui-toolbar']/div[3]/div[1]/div[4]/span[1]"); |
| 171 | +define ('IMAGE_EXAMPLE1',"//img[contains(@src,'http://upload.wikimedia.org/wikipedia/commons/thumb/a/a9/Example.jpg/116px-Example.jpg')]"); |
| 172 | +define ('TEXT_IMG1CAPTION',"Caption1"); |
| 173 | +define ('TABLE_CAPTION1',"//div[@id='wikiPreview']/table.0.0"); |
| 174 | +define ('IMAGE_EXAMPLE2',"//div[@id='wikiPreview']/table/tbody/tr/td[2]/div/div[1]/div/a/img"); |
| 175 | +define ('TEXT_IMG2CAPTION',"Caption2"); |
| 176 | +define ('TABLE_CAPTION2',"//div[@id='wikiPreview']/table.0.1"); |
| 177 | + |
| 178 | + |
| 179 | +// for WikiNTOC_TC |
| 180 | +define ('LINK_HEADER',"link=Heading"); |
| 181 | +define ('TEXT_HEADER',"Heading text"); |
| 182 | +define ('LINK_LEVEL2HEADER',"link=Level 2"); |
| 183 | +define ('TEXT_LEVEL2HEADER',"==Heading text=="); |
| 184 | +define ('TEXT_LEVEL2HEADER_SIZE',"//*[@id='wikiPreview']/h2"); |
| 185 | +define ('LINK_LEVEL3HEADER',"link=Level 3"); |
| 186 | +define ('TEXT_LEVEL3HEADER',"===Heading text==="); |
| 187 | +define ('TEXT_LEVEL3HEADER_SIZE',"//*[@id='wikiPreview']/h3"); |
| 188 | +define ('LINK_LEVEL4HEADER',"link=Level 4"); |
| 189 | +define ('TEXT_LEVEL4HEADER',"====Heading text===="); |
| 190 | +define ('TEXT_LEVEL4HEADER_SIZE',"//*[@id='wikiPreview']/h4"); |
| 191 | +define ('LINK_LEVEL5HEADER',"link=Level 5"); |
| 192 | +define ('TEXT_LEVEL5HEADER',"=====Heading text====="); |
| 193 | +define ('TEXT_LEVEL5HEADER_SIZE',"//*[@id='wikiPreview']/h5"); |
26 | 194 | ?> |
Index: trunk/testing/selenium/UsabilityInitiative/WikiAutomationTC/testCases/WikSearch_TC.php |
— | — | @@ -1,9 +1,6 @@ |
2 | 2 | <?php |
3 | | -session_start(); |
4 | | -require_once('log4php/Logger.php'); |
5 | | -Logger::configure('log4php.properties'); |
6 | 3 | require_once 'WikiCommonFunction_TC.php'; |
7 | | -require_once 'Config.php'; |
| 4 | +include 'Config.php'; |
8 | 5 | |
9 | 6 | /** |
10 | 7 | * This test case will be handling the search function. |
— | — | @@ -11,54 +8,44 @@ |
12 | 9 | * @author : BhagyaG - Calcey |
13 | 10 | */ |
14 | 11 | class WikiSearch_TC extends WikiCommonFunction_TC { |
15 | | - private $logger; |
16 | 12 | |
17 | 13 | // Set up the testing environment |
18 | 14 | function setup(){ |
19 | 15 | parent::setUp(); |
20 | | - $this->logger = Logger::getLogger(__CLASS__); |
21 | 16 | } |
22 | 17 | |
23 | | - |
24 | 18 | // Search for a Wiki Page. Search result should be directed to the page itself |
25 | 19 | function testSearchPage(){ |
26 | | - $this->logger->info('Test Search Page - Start'); |
27 | 20 | parent::doOpenLink(); |
28 | 21 | parent::doLogin(); |
29 | | - $this->click("link=Main page"); |
30 | | - $this->type("//*[@id='searchInput']", $_SESSION["WIKI_SEARCH_PAGE"]); |
31 | | - $this->click("//*[@id='searchButton']"); |
32 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 22 | + $this->type(INPUT_SEARCH_BOX,(WIKI_SEARCH_PAGE)); |
| 23 | + $this->click(BUTTON_SEARCH); |
| 24 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
33 | 25 | try { |
34 | | - $this->assertEquals($_SESSION["WIKI_SEARCH_PAGE"], $this->getText("//*[@id='firstHeading']")); |
| 26 | + $this->assertEquals((WIKI_SEARCH_PAGE), $this->getText(TEXT_PAGE_HEADING)); |
35 | 27 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
36 | 28 | parent::doCreateScreenShot(__FUNCTION__); |
37 | 29 | array_push($this->verificationErrors, $e->toString()); |
38 | 30 | } |
39 | | - $this->click("link=Main page"); |
40 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
41 | 31 | parent::doLogout(); |
42 | | - $this->logger->info('Test Search Page - End'); |
43 | 32 | } |
44 | 33 | |
45 | | - |
46 | 34 | // Search for a text. Search result should display links which contain the search text |
47 | 35 | function testSearchText(){ |
48 | 36 | parent::doOpenLink(); |
49 | 37 | parent::doLogin(); |
50 | | - $this->click("link=Main page"); |
51 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
52 | | - $this->type("//*[@id='searchInput']",$_SESSION["WIKI_SEARCH_TEXT"]); |
53 | | - $this->click("searchButton"); |
54 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 38 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
| 39 | + $this->type(INPUT_SEARCH_BOX,WIKI_TEXT_SEARCH); |
| 40 | + $this->click(BUTTON_SEARCH); |
| 41 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
55 | 42 | try { |
56 | | - $this->assertEquals("Search results", $this->getText("firstHeading")); |
| 43 | + $this->assertEquals("Search results", $this->getText(TEXT_PAGE_HEADING)); |
57 | 44 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
58 | 45 | parent::doCreateScreenShot(__FUNCTION__); |
59 | 46 | array_push($this->verificationErrors, $e->toString()); |
60 | 47 | } |
61 | 48 | try { |
62 | | - $this->assertEquals($_SESSION["WIKI_SEARCH_TEXT"] . " - Search results - Wikipedia, the free encyclopedia", $this->getTitle()); |
| 49 | + $this->assertEquals((WIKI_TEXT_SEARCH) . TEXT_SEARCH_RESULT_HEADING, $this->getTitle()); |
63 | 50 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
64 | 51 | parent::doCreateScreenShot(__FUNCTION__); |
65 | 52 | array_push($this->verificationErrors, $e->toString()); |
Index: trunk/testing/selenium/UsabilityInitiative/WikiAutomationTC/testCases/WikiTextFormat_TC.php |
— | — | @@ -11,28 +11,29 @@ |
12 | 12 | |
13 | 13 | // Mark text Bold and verify output |
14 | 14 | function verifyTextBold(){ |
15 | | - $this->type("wpTextbox1", ""); |
16 | | - $this->click("link=Bold"); |
17 | | - $this->type("wpTextbox1", "'''Bold''' text"); |
18 | | - $this->click("wpPreview"); |
19 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 15 | + $this->type(TEXT_EDITOR, ""); |
| 16 | + $this->click(LINK_BOLD); |
| 17 | + $this->type(TEXT_EDITOR,TEXT_BOLD); |
| 18 | + $this->click(BUTTON_PREVIEW); |
| 19 | + $this->waitForPageToLoad(50000); |
20 | 20 | try { |
21 | | - $this->assertEquals("Bold", $this->getText("//div[@id='wikiPreview']/p/b")); |
| 21 | + $this->assertEquals(TEXT_VALIDATE_BOLD, $this->getText(TEXT_VALIDATE_BOLDTEXT)); |
22 | 22 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
23 | 23 | parent::doCreateScreenShot(__FUNCTION__); |
24 | 24 | array_push($this->verificationErrors, $e->toString()); |
25 | 25 | } |
| 26 | + |
26 | 27 | } |
27 | 28 | |
28 | 29 | // Mark text Italic and verify output |
29 | 30 | function verifyTextItalic(){ |
30 | | - $this->type("wpTextbox1", ""); |
31 | | - $this->click("link=Italic"); |
32 | | - $this->type("wpTextbox1", "''Italian'' text"); |
33 | | - $this->click("wpPreview"); |
34 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 31 | + $this->type(TEXT_EDITOR, ""); |
| 32 | + $this->click(LINK_ITALIC); |
| 33 | + $this->type(TEXT_EDITOR, TEXT_ITALIC); |
| 34 | + $this->click(BUTTON_PREVIEW); |
| 35 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
35 | 36 | try { |
36 | | - $this->assertEquals("Italian", $this->getText("//div[@id='wikiPreview']/p/i")); |
| 37 | + $this->assertEquals(TEXT_VALIDATE_ITALIC, $this->getText(TEXT_VALIDATE_ITALICTEXT)); |
37 | 38 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
38 | 39 | parent::doCreateScreenShot(__FUNCTION__); |
39 | 40 | array_push($this->verificationErrors, $e->toString()); |
— | — | @@ -41,45 +42,44 @@ |
42 | 43 | |
43 | 44 | // Mark text Bold and Italic and verify output |
44 | 45 | function verifyTextItalicandBold(){ |
45 | | - $this->type("wpTextbox1", ""); |
46 | | - $this->click("link=Italic"); |
47 | | - $this->click("link=Bold"); |
48 | | - $this->type("wpTextbox1", "Text '''''Italic & Bold'''''"); |
49 | | - $this->click("wpPreview"); |
50 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 46 | + $this->type(TEXT_EDITOR, ""); |
| 47 | + $this->click(LINK_ITALIC); |
| 48 | + $this->click(LINK_BOLD); |
| 49 | + $this->type(TEXT_EDITOR, TEXT_ITALIC_BOLD); |
| 50 | + $this->click(BUTTON_PREVIEW); |
| 51 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
51 | 52 | try { |
52 | | - $this->assertEquals("Italic & Bold", $this->getText("//div[@id='wikiPreview']/p/i/b")); |
| 53 | + $this->assertEquals(TEXT_VALIDATE_ITALICBOLD, $this->getText(TEXT_VALIDATE_ITALICBOLDTEXT)); |
53 | 54 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
54 | 55 | parent::doCreateScreenShot(__FUNCTION__); |
55 | 56 | array_push($this->verificationErrors, $e->toString()); |
56 | 57 | } |
57 | 58 | } |
58 | 59 | |
59 | | - |
60 | 60 | // Use Bullet Item function and verify output |
61 | 61 | function verifyBulletItem(){ |
62 | 62 | parent::doExpandAdvanceSection(); |
63 | | - $this->type("wpTextbox1", ""); |
64 | | - $this->click("link=Bulleted list"); |
65 | | - $this->click("link=Bulleted list"); |
66 | | - $this->click("link=Bulleted list"); |
67 | | - $this->type("wpTextbox1", "* Bulleted list item\n* Bulleted list item\n* Bulleted list item"); |
68 | | - $this->click("wpPreview"); |
69 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 63 | + $this->type(TEXT_EDITOR, ""); |
| 64 | + $this->click(LINK_BULLET); |
| 65 | + $this->click(LINK_BULLET); |
| 66 | + $this->click(LINK_BULLET); |
| 67 | + $this->type(TEXT_EDITOR, TEXT_BULLET); |
| 68 | + $this->click(BUTTON_PREVIEW); |
| 69 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
70 | 70 | try { |
71 | | - $this->assertEquals("Bulleted list item", $this->getText("//div[@id='wikiPreview']/ul/li[1]")); |
| 71 | + $this->assertEquals(TEXT_BULLET_TEXT, $this->getText(TEXT_BULLET_1)); |
72 | 72 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
73 | 73 | parent::doCreateScreenShot(__FUNCTION__); |
74 | 74 | array_push($this->verificationErrors, $e->toString()); |
75 | 75 | } |
76 | 76 | try { |
77 | | - $this->assertEquals("Bulleted list item", $this->getText("//div[@id='wikiPreview']/ul/li[2]")); |
| 77 | + $this->assertEquals(TEXT_BULLET_TEXT, $this->getText(TEXT_BULLET_2)); |
78 | 78 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
79 | 79 | parent::doCreateScreenShot(__FUNCTION__); |
80 | 80 | array_push($this->verificationErrors, $e->toString()); |
81 | 81 | } |
82 | 82 | try { |
83 | | - $this->assertEquals("Bulleted list item", $this->getText("//div[@id='wikiPreview']/ul/li[3]")); |
| 83 | + $this->assertEquals(TEXT_BULLET_TEXT, $this->getText(TEXT_BULLET_3)); |
84 | 84 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
85 | 85 | parent::doCreateScreenShot(__FUNCTION__); |
86 | 86 | array_push($this->verificationErrors, $e->toString()); |
— | — | @@ -89,27 +89,27 @@ |
90 | 90 | // Use Numbered Item function and verify output |
91 | 91 | function verifyNumberedItem(){ |
92 | 92 | parent::doExpandAdvanceSection(); |
93 | | - $this->type("wpTextbox1", ""); |
94 | | - $this->click("link=Numbered list"); |
95 | | - $this->click("link=Numbered list"); |
96 | | - $this->click("link=Numbered list"); |
97 | | - $this->type("wpTextbox1", "# Numbered list item\n# Numbered list item\n# Numbered list item"); |
98 | | - $this->click("wpPreview"); |
99 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 93 | + $this->type(TEXT_EDITOR, ""); |
| 94 | + $this->click(LINK_NUMBERED); |
| 95 | + $this->click(LINK_NUMBERED); |
| 96 | + $this->click(LINK_NUMBERED); |
| 97 | + $this->type(TEXT_EDITOR, TEXT_NUMBERED); |
| 98 | + $this->click(BUTTON_PREVIEW); |
| 99 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
100 | 100 | try { |
101 | | - $this->assertEquals("Numbered list item", $this->getText("//div[@id='wikiPreview']/ol/li[1]")); |
| 101 | + $this->assertEquals(TEXT_NUMBERED_TEXT, $this->getText(TEXT_NUMBERED_1)); |
102 | 102 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
103 | 103 | parent::doCreateScreenShot(__FUNCTION__); |
104 | 104 | array_push($this->verificationErrors, $e->toString()); |
105 | 105 | } |
106 | 106 | try { |
107 | | - $this->assertEquals("Numbered list item", $this->getText("//div[@id='wikiPreview']/ol/li[2]")); |
| 107 | + $this->assertEquals(TEXT_NUMBERED_TEXT, $this->getText(TEXT_NUMBERED_2)); |
108 | 108 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
109 | 109 | parent::doCreateScreenShot(__FUNCTION__); |
110 | 110 | array_push($this->verificationErrors, $e->toString()); |
111 | 111 | } |
112 | 112 | try { |
113 | | - $this->assertEquals("Numbered list item", $this->getText("//div[@id='wikiPreview']/ol/li[3]")); |
| 113 | + $this->assertEquals(TEXT_NUMBERED_TEXT, $this->getText(TEXT_NUMBERED_3)); |
114 | 114 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
115 | 115 | parent::doCreateScreenShot(__FUNCTION__); |
116 | 116 | array_push($this->verificationErrors, $e->toString()); |
— | — | @@ -119,12 +119,12 @@ |
120 | 120 | // Mark text as Nowiki and verify output |
121 | 121 | function verifyNoWiki(){ |
122 | 122 | parent::doExpandAdvanceSection(); |
123 | | - $this->type("wpTextbox1", ""); |
124 | | - $this->type("wpTextbox1", "<nowiki>==Heading text==</nowiki>"); |
125 | | - $this->click("wpPreview"); |
126 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 123 | + $this->type(TEXT_EDITOR, ""); |
| 124 | + $this->type(TEXT_EDITOR, TEXT_NOWIKI); |
| 125 | + $this->click(BUTTON_PREVIEW); |
| 126 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
127 | 127 | try { |
128 | | - $this->assertEquals("==Heading text==", $this->getText("//div[@id='wikiPreview']/p")); |
| 128 | + $this->assertEquals(TEXT_NOWIKI_TEXT, $this->getText(TEXT_NOWIKI_VALIDATE)); |
129 | 129 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
130 | 130 | parent::doCreateScreenShot(__FUNCTION__); |
131 | 131 | array_push($this->verificationErrors, $e->toString()); |
— | — | @@ -134,12 +134,12 @@ |
135 | 135 | // Create a line break and verify output |
136 | 136 | function verifyLineBreak(){ |
137 | 137 | parent::doExpandAdvanceSection(); |
138 | | - $this->type("wpTextbox1", ""); |
139 | | - $this->type("wpTextbox1", "this is a test text to check the line\n break."); |
140 | | - $this->click("wpPreview"); |
141 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 138 | + $this->type(TEXT_EDITOR, ""); |
| 139 | + $this->type(TEXT_EDITOR, TEXT_LINEBREAK); |
| 140 | + $this->click(BUTTON_PREVIEW); |
| 141 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
142 | 142 | try { |
143 | | - $this->assertEquals("this is a test text to check the line\n break.", $this->getText("//div[@id='wikiPreview']/p")); |
| 143 | + $this->assertEquals(TEXT_LINEBREAK_TEXT, $this->getText(TEXT_LINEBREAK_VALIDATE)); |
144 | 144 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
145 | 145 | parent::doCreateScreenShot(__FUNCTION__); |
146 | 146 | array_push($this->verificationErrors, $e->toString()); |
— | — | @@ -149,13 +149,13 @@ |
150 | 150 | // Mark text as Big and verify output |
151 | 151 | function verifyTextBig(){ |
152 | 152 | parent::doExpandAdvanceSection(); |
153 | | - $this->type("wpTextbox1", ""); |
154 | | - $this->click("link=Big"); |
155 | | - $this->type("wpTextbox1", "<big>This</big> text"); |
156 | | - $this->click("wpPreview"); |
157 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 153 | + $this->type(TEXT_EDITOR, ""); |
| 154 | + $this->click(LINK_TEXTBIG); |
| 155 | + $this->type(TEXT_EDITOR, TEXT_TEXTBIG); |
| 156 | + $this->click(BUTTON_PREVIEW); |
| 157 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
158 | 158 | try { |
159 | | - $this->assertEquals("This", $this->getText("//div[@id='wikiPreview']/p/big")); |
| 159 | + $this->assertEquals(TEXT_TEXTBIG_TEXT, $this->getText(TEXT_TEXTBIG_VALIDATE)); |
160 | 160 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
161 | 161 | parent::doCreateScreenShot(__FUNCTION__); |
162 | 162 | array_push($this->verificationErrors, $e->toString()); |
— | — | @@ -165,13 +165,13 @@ |
166 | 166 | // Mark text as Small and verify output |
167 | 167 | function verifyTextSmall(){ |
168 | 168 | parent::doExpandAdvanceSection(); |
169 | | - $this->type("wpTextbox1", ""); |
170 | | - $this->click("link=Small"); |
171 | | - $this->type("wpTextbox1", "<small>This</small> text\n"); |
172 | | - $this->click("wpPreview"); |
173 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 169 | + $this->type(TEXT_EDITOR, ""); |
| 170 | + $this->click(LINK_TEXTSMALL); |
| 171 | + $this->type(TEXT_EDITOR, TEXT_TEXTSMALL); |
| 172 | + $this->click(BUTTON_PREVIEW); |
| 173 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
174 | 174 | try { |
175 | | - $this->assertEquals("This", $this->getText("//div[@id='wikiPreview']/p/small")); |
| 175 | + $this->assertEquals(TEXT_TEXTSMALL_TEXT, $this->getText(TEXT_TEXTSMALL_VALIDATE)); |
176 | 176 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
177 | 177 | parent::doCreateScreenShot(__FUNCTION__); |
178 | 178 | array_push($this->verificationErrors, $e->toString()); |
— | — | @@ -181,13 +181,13 @@ |
182 | 182 | // Mark text as Super Script and verify output |
183 | 183 | function verifyTextSuperscript(){ |
184 | 184 | parent::doExpandAdvanceSection(); |
185 | | - $this->type("wpTextbox1", ""); |
186 | | - $this->click("link=Superscript"); |
187 | | - $this->type("wpTextbox1", "<sup>This</sup> text\n"); |
188 | | - $this->click("wpPreview"); |
189 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 185 | + $this->type(TEXT_EDITOR, ""); |
| 186 | + $this->click(LINK_TEXTSUPER); |
| 187 | + $this->type(TEXT_EDITOR,TEXT_TEXTSUPER ); |
| 188 | + $this->click(BUTTON_PREVIEW); |
| 189 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
190 | 190 | try { |
191 | | - $this->assertEquals("This", $this->getText("//div[@id='wikiPreview']/p/sup")); |
| 191 | + $this->assertEquals(TEXT_TEXTSUPER_TEXT, $this->getText(TEXT_TEXTSUPER_VALIDATE)); |
192 | 192 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
193 | 193 | parent::doCreateScreenShot(__FUNCTION__); |
194 | 194 | array_push($this->verificationErrors, $e->toString()); |
— | — | @@ -197,13 +197,13 @@ |
198 | 198 | // Mark text as Sub Script and verify output |
199 | 199 | function verifyTextSubscript(){ |
200 | 200 | parent::doExpandAdvanceSection(); |
201 | | - $this->type("wpTextbox1", ""); |
202 | | - $this->click("link=Subscript"); |
203 | | - $this->type("wpTextbox1", "<sub>This</sub> text\n"); |
204 | | - $this->click("wpPreview"); |
205 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 201 | + $this->type(TEXT_EDITOR, ""); |
| 202 | + $this->click(LINK_TEXTSUB); |
| 203 | + $this->type(TEXT_EDITOR,TEXT_TEXTSUB); |
| 204 | + $this->click(BUTTON_PREVIEW); |
| 205 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
206 | 206 | try { |
207 | | - $this->assertEquals("This", $this->getText("//div[@id='wikiPreview']/p/sub")); |
| 207 | + $this->assertEquals(TEXT_TEXTSUB_TEXT, $this->getText(TEXT_TEXTSUB_VALIDATE)); |
208 | 208 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
209 | 209 | parent::doCreateScreenShot(__FUNCTION__); |
210 | 210 | array_push($this->verificationErrors, $e->toString()); |
Index: trunk/testing/selenium/UsabilityInitiative/WikiAutomationTC/testCases/WikiCommonFunction_TC.php |
— | — | @@ -1,7 +1,8 @@ |
2 | 2 | <?php |
3 | 3 | session_start(); |
4 | 4 | require_once 'PHPUnit/Extensions/SeleniumTestCase.php'; |
5 | | -require_once 'Config.php'; |
| 5 | +include 'Config.php'; |
| 6 | + |
6 | 7 | /** |
7 | 8 | * This test case will be handling the common functions on test. |
8 | 9 | * Date : Apr - 2010 |
— | — | @@ -19,90 +20,101 @@ |
20 | 21 | 'port' => 4444, |
21 | 22 | 'timeout' => 30000, |
22 | 23 | ) |
23 | | - ); **/ |
| 24 | + ); */ |
24 | 25 | |
25 | 26 | // Setup the browser URL and local browser |
26 | 27 | function setUp() { |
27 | 28 | // Setting the local browser. this should be disabled if the test run in Wiki environment. |
28 | 29 | $this->setBrowser("*firefox"); |
| 30 | + //$this->setBrowser("*iexplore"); |
| 31 | + //$this->setBrowser("*safari"); |
| 32 | + //$this->setBrowser("*opera"); |
| 33 | + //$this->setBrowser("*googlechrome"); |
29 | 34 | // Main link to be connected |
30 | | - $this->setBrowserUrl($_SESSION["WIKI_WEB_URL"]); |
31 | | - |
| 35 | + $this->setBrowserUrl(WIKI_WEB_URL); |
32 | 36 | } |
33 | 37 | |
34 | 38 | // Open the page. |
35 | 39 | function doOpenLink(){ |
36 | | - $this->open($_SESSION["WIKI_OPEN_PAGE"]); |
37 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 40 | + $this->open(WIKI_OPEN_PAGE); |
| 41 | + /*try { |
| 42 | + $this->assertTrue($this->isTextPresent("Welcome to Wikipedia")); |
| 43 | + } catch (PHPUnit_Framework_AssertionFailedError $e) { |
| 44 | + array_push($this->verificationErrors, $e->toString()); |
| 45 | + }*/ |
| 46 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
38 | 47 | } |
39 | 48 | |
40 | 49 | // Login to the application |
41 | 50 | function doLogin() { |
42 | | - if (!$this->isTextPresent("Log out")) { |
43 | | - $this->click("link=Log in / create account"); |
44 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
45 | | - $this->type("wpName1", $_SESSION["WIKI_USER_NAME"]); |
46 | | - $this->type("wpPassword1", $_SESSION["WIKI_USER_PASSWORD"]); |
47 | | - $this->click("wpLoginAttempt"); |
48 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 51 | + if (!$this->isTextPresent(TEXT_LOGOUT)) { |
| 52 | + $this->click(LINK_LOGIN); |
| 53 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
| 54 | + $this->type(INPUT_USER_NAME, WIKI_USER_NAME); |
| 55 | + $this->type(INPUT_PASSWD,WIKI_USER_PASSWORD); |
| 56 | + $this->click(BUTTON_LOGIN); |
| 57 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
49 | 58 | try { |
50 | | - $this->assertEquals($_SESSION["WIKI_USER_DISPLAY_NAME"], $this->getText("link=" . $_SESSION["WIKI_USER_DISPLAY_NAME"])); |
| 59 | + $this->assertEquals(WIKI_USER_DISPLAY_NAME, $this->getText(LINK_START . WIKI_USER_DISPLAY_NAME)); |
51 | 60 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
| 61 | + parent::doCreateScreenShot(__FUNCTION__); |
52 | 62 | array_push($this->verificationErrors, $e->toString()); |
53 | 63 | } |
54 | | - $this->open($_SESSION["WIKI_OPEN_PAGE"]); |
55 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 64 | + $this->click(LINK_MAIN_PAGE); |
| 65 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
56 | 66 | } |
57 | 67 | } |
58 | 68 | |
59 | 69 | // Log out from the application |
60 | 70 | function doLogout() { |
61 | | - $this->open($_SESSION["WIKI_OPEN_PAGE"]); |
62 | | - if ($this->isTextPresent("Log out")) { |
63 | | - $this->click("link=Log out"); |
64 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 71 | + $this->open(WIKI_OPEN_PAGE); |
| 72 | + if ($this->isTextPresent(TEXT_LOGOUT)) { |
| 73 | + $this->click(LINK_LOGOUT); |
| 74 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
65 | 75 | try { |
66 | | - $this->assertEquals("Log in / create account", $this->getText("link=Log in / create account")); |
| 76 | + $this->assertEquals(TEXT_LOGOUT_CONFIRM, $this->getText(LINK_LOGIN)); |
67 | 77 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
| 78 | + parent::doCreateScreenShot(__FUNCTION__); |
68 | 79 | array_push($this->verificationErrors, $e->toString()); |
69 | 80 | } |
70 | | - $this->open($_SESSION["WIKI_OPEN_PAGE"]); |
71 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 81 | + $this->open(WIKI_OPEN_PAGE); |
| 82 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
72 | 83 | } |
73 | 84 | } |
74 | 85 | |
75 | 86 | //Expand advance tool bar section if its not |
76 | 87 | function doExpandAdvanceSection() { |
77 | | - if (!$this->isTextPresent("Heading")){ |
78 | | - $this->click("link=Advanced"); |
| 88 | + if (!$this->isTextPresent(TEXT_HEADING)){ |
| 89 | + $this->click(LINK_ADVANCED); |
79 | 90 | } |
80 | 91 | } |
81 | 92 | |
82 | 93 | //Create a temporary new page |
83 | 94 | function doCreateNewPageTemporary() { |
84 | | - $this->type("//*[@id='searchInput']", "TestWikiPaget"); |
85 | | - $this->click("//*[@id='searchButton']"); |
86 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
87 | | - $this->click("link=TestWikiPaget"); |
88 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 95 | + $this->type(INPUT_SEARCH_BOX, WIKI_TEMP_NEWPAGE); |
| 96 | + $this->click(BUTTON_SEARCH); |
| 97 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
| 98 | + $this->click(LINK_START . WIKI_TEMP_NEWPAGE); |
| 99 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
89 | 100 | } |
90 | 101 | |
91 | 102 | //Access a random page |
92 | 103 | function doAccessRandomPage() { |
93 | | - $this->click("link=Random article"); |
94 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 104 | + $this->click(LINK_RANDOM_PAGE); |
| 105 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
95 | 106 | } |
96 | 107 | |
97 | 108 | //Access a random page |
98 | 109 | function doEditPage() { |
99 | | - $this->click("//li[@id='ca-edit']/a/span"); |
100 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 110 | + $this->click(LINK_EDITPAGE); |
| 111 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
101 | 112 | } |
102 | 113 | |
103 | 114 | //Screenshot create on error |
104 | 115 | function doCreateScreenShot($file_name){ |
105 | | - $this->captureEntirePageScreenshot($_SESSION["WIKI_CODE_PATH"] . "\/". $_SESSION["WIKI_SCREENSHOTS_PATH"] ."\/". $file_name . "_error" . date("Y_m_d") . "." . $_SESSION["WIKI_SCREENSHOTS_TYPE"] , ""); |
| 116 | + $this->windowFocus(); |
| 117 | + $this->windowMaximize(); |
| 118 | + $this->captureEntirePageScreenshot(WIKI_CODE_PATH . "//". WIKI_SCREENSHOTS_PATH ."//". $file_name . "_error" . date("Y_m_d") . "." . WIKI_SCREENSHOTS_TYPE , ""); |
106 | 119 | } |
107 | | - |
108 | 120 | } |
109 | 121 | ?> |
\ No newline at end of file |
Index: trunk/testing/selenium/UsabilityInitiative/WikiAutomationTC/testCases/WikiWatchUnWatch_TC.php |
— | — | @@ -1,7 +1,6 @@ |
2 | 2 | <?php |
3 | | -session_start(); |
4 | 3 | require_once 'WikiCommonFunction_TC.php'; |
5 | | -require_once 'Config.php'; |
| 4 | +include 'Config.php'; |
6 | 5 | /** |
7 | 6 | * This test case will be handling the page watch functions. |
8 | 7 | * Date : Apr - 2010 |
— | — | @@ -17,14 +16,13 @@ |
18 | 17 | function testWatch(){ |
19 | 18 | parent::doOpenLink(); |
20 | 19 | parent::doLogin(); |
21 | | - $this->click("link=Random article"); |
22 | | - $this->waitForPageToLoad("30000"); |
23 | | - $randompage = $this->getText("firstHeading"); |
24 | | - $this->click("link=Watch"); |
25 | | - $this->click("link=My watchlist"); |
26 | | - $this->waitForPageToLoad("30000"); |
27 | | - $this->click("link=View and edit watchlist"); |
28 | | - $this->waitForPageToLoad("30000"); |
| 20 | + parent::doAccessRandomPage(); |
| 21 | + $randompage = $this->getText(TEXT_PAGE_HEADING); |
| 22 | + $this->click(LINK_WATCH_PAGE); |
| 23 | + $this->click(LINK_WATCH_LIST); |
| 24 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
| 25 | + $this->click(LINK_WATCH_EDIT); |
| 26 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
29 | 27 | try { |
30 | 28 | $this->assertTrue($this->isTextPresent($randompage)); |
31 | 29 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
— | — | @@ -38,25 +36,23 @@ |
39 | 37 | |
40 | 38 | // Mark a page as watch and mark the same page as unwatch and verify the My Watch list |
41 | 39 | function testUnWatch(){ |
42 | | - |
43 | | - parent::doOpenLink(); |
| 40 | + parent::doOpenLink(); |
44 | 41 | parent::doLogin(); |
45 | | - $this->click("link=Random article"); |
46 | | - $this->waitForPageToLoad("30000"); |
47 | | - $randompage = $this->getText("firstHeading"); |
48 | | - $this->click("link=Watch"); |
49 | | - $this->click("link=My watchlist"); |
50 | | - $this->waitForPageToLoad("30000"); |
51 | | - $this->click("link=View and edit watchlist"); |
52 | | - $this->waitForPageToLoad("30000"); |
| 42 | + parent::doAccessRandomPage(); |
| 43 | + $randompage = $this->getText(TEXT_PAGE_HEADING); |
| 44 | + $this->click(LINK_WATCH_PAGE); |
| 45 | + $this->click(LINK_WATCH_LIST); |
| 46 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
| 47 | + $this->click(LINK_WATCH_EDIT); |
| 48 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
53 | 49 | $this->assertTrue($this->isTextPresent($randompage)); |
54 | | - $this->click("link=" . $randompage); |
55 | | - $this->waitForPageToLoad("30000"); |
56 | | - $this->click("link=Unwatch"); |
57 | | - $this->click("link=My watchlist"); |
58 | | - $this->waitForPageToLoad("30000"); |
59 | | - $this->click("link=View and edit watchlist"); |
60 | | - $this->waitForPageToLoad("30000"); |
| 50 | + $this->click(LINK_START . $randompage); |
| 51 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
| 52 | + $this->click(LINK_UNWATCH); |
| 53 | + $this->click(LINK_WATCH_LIST); |
| 54 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
| 55 | + $this->click(LINK_WATCH_EDIT); |
| 56 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
61 | 57 | try { |
62 | 58 | $this->assertFalse($this->isTextPresent($randompage)); |
63 | 59 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
— | — | @@ -72,26 +68,27 @@ |
73 | 69 | parent::doOpenLink(); |
74 | 70 | parent::doLogin(); |
75 | 71 | parent::doAccessRandomPage(); |
76 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
77 | | - $randompage = $this->getText("firstHeading"); |
| 72 | + $randompage = $this->getText(TEXT_PAGE_HEADING); |
78 | 73 | parent::doEditPage(); |
79 | 74 | try { |
80 | | - $this->assertEquals("Watch", $this->getText("link=Watch")); |
| 75 | + $this->assertEquals(TEXT_WATCH, $this->getText(LINK_WATCH_PAGE)); |
81 | 76 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
| 77 | + parent::doCreateScreenShot(__FUNCTION__); |
82 | 78 | array_push($this->verificationErrors, $e->toString()); |
83 | 79 | } |
84 | | - $this->click("wpWatchthis"); |
85 | | - $this->click("wpSave"); |
86 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 80 | + $this->click(BUTTON_WATCH); |
| 81 | + $this->click(BUTTON_SAVE_WATCH); |
| 82 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
87 | 83 | try { |
88 | | - $this->assertEquals("Unwatch", $this->getText("link=Unwatch")); |
| 84 | + $this->assertEquals(TEXT_UNWATCH, $this->getText(LINK_UNWATCH)); |
89 | 85 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
| 86 | + parent::doCreateScreenShot(__FUNCTION__); |
90 | 87 | array_push($this->verificationErrors, $e->toString()); |
91 | 88 | } |
92 | | - $this->click("link=My watchlist"); |
93 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
94 | | - $this->click("link=View and edit watchlist"); |
95 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 89 | + $this->click(LINK_WATCH_LIST); |
| 90 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
| 91 | + $this->click(LINK_WATCH_EDIT); |
| 92 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
96 | 93 | $this->assertTrue($this->isTextPresent($randompage)); |
97 | 94 | |
98 | 95 | parent::doLogout(); |
Index: trunk/testing/selenium/UsabilityInitiative/WikiAutomationTC/testCases/WikiDialogs_NewPage.php |
— | — | @@ -60,7 +60,7 @@ |
61 | 61 | parent::doLogout(); |
62 | 62 | } |
63 | 63 | |
64 | | - // Add a table and verify |
| 64 | + // Add a table and verify |
65 | 65 | function testCreateTable(){ |
66 | 66 | $this->createNewPage(); |
67 | 67 | parent::verifyCreateTable(); |
— | — | @@ -95,6 +95,13 @@ |
96 | 96 | parent::doLogout(); |
97 | 97 | } |
98 | 98 | |
| 99 | + // Add a table with headers,borders and sort rows |
| 100 | + function testCreateTableWithAllSpecialEffects(){ |
| 101 | + $this->createNewPage(); |
| 102 | + parent::verifyCreateTableWithAllSpecialEffects(); |
| 103 | + parent::doLogout(); |
| 104 | + } |
| 105 | + |
99 | 106 | // Verify the replace all function on Search and Replace |
100 | 107 | function testTextSearchReplaceAll(){ |
101 | 108 | $this->createNewPage(); |
— | — | @@ -107,13 +114,28 @@ |
108 | 115 | $this->createNewPage(); |
109 | 116 | parent::verifyTextSearchReplaceNext(); |
110 | 117 | parent::doLogout(); |
111 | | - } |
| 118 | + } |
112 | 119 | |
113 | | - // When user click on find, text highlight on back which is not captured in Selenium directly. */ |
| 120 | + /*// When user click on find, text highlight on back which is not captured in Selenium directly. |
114 | 121 | function testTextSearchFindNext(){ |
115 | 122 | $this->createNewPage(); |
116 | 123 | parent::verifyTextSearchFindNext(); |
117 | 124 | parent::doLogout(); |
| 125 | + }*/ |
| 126 | + |
| 127 | + // Verify the Match Case option with Replace All on Search and Replace |
| 128 | + function testTextMatchCase(){ |
| 129 | + $this->createNewPage(); |
| 130 | + parent::verifyTextMatchCase(); |
| 131 | + parent::doLogout(); |
118 | 132 | } |
| 133 | + |
| 134 | + //Verify Regular expression option with Replace All on Search and Replace |
| 135 | + function testRegEx(){ |
| 136 | + $this->createNewPage(); |
| 137 | + parent::verifyRegEx(); |
| 138 | + parent::doLogout(); |
| 139 | + } |
| 140 | + |
119 | 141 | } |
120 | 142 | ?> |
Index: trunk/testing/selenium/UsabilityInitiative/WikiAutomationTC/testCases/WikiTestSuite.php |
— | — | @@ -1,7 +1,9 @@ |
2 | 2 | <?php |
3 | 3 | require_once 'PHPUnit/Framework.php'; |
4 | | -require_once 'PHPUnit/TextUI/TestRunner.php'; |
| 4 | +require_once 'PHPUnit/Framework/TestSuite.php'; |
5 | 5 | |
| 6 | +require_once 'WikiListener.php'; |
| 7 | + |
6 | 8 | require_once 'WikSearch_TC.php'; |
7 | 9 | require_once 'WikiWatchUnWatch_TC.php'; |
8 | 10 | |
— | — | @@ -15,18 +17,16 @@ |
16 | 18 | require_once 'WikiToolBarOther_NewPage.php'; |
17 | 19 | require_once 'WikiTextFormat_NewPage.php'; |
18 | 20 | |
| 21 | +$suite = new PHPUnit_Framework_TestSuite('ArrayTest'); |
19 | 22 | |
20 | | -$suite = new PHPUnit_Framework_TestSuite('Wiki Tests'); |
| 23 | +$result = new PHPUnit_Framework_TestResult; |
| 24 | +$result->addListener(new WikiListener); |
21 | 25 | |
22 | | -require_once('WikiListener.php'); |
23 | | -$wLis = new WikiListener(); |
24 | | -$result = new PHPUnit_Framework_TestResult(); |
25 | | -//Add test case to the test suite |
26 | | -$suite->addTestSuite("WikSearch_TC"); |
27 | | -$suite->addTestSuite("WikiWatchUnWatch_TC"); |
| 26 | +$suite->addTestSuite('WikiSearch_TC'); // Working in Chrome |
| 27 | +$suite->addTestSuite('WikiWatchUnWatch_TC'); // Working in Chrome |
28 | 28 | |
29 | | -$suite->addTestSuite("WikiNTOC_ ExistingPage"); |
30 | | -$suite->addTestSuite("WikiDialogs_ExsistingPage"); |
| 29 | +$suite->addTestSuite("WikiNTOC_ExistingPage"); // Working in Chrome |
| 30 | +$suite->addTestSuite("WikiDialogs_ExsistingPage"); |
31 | 31 | $suite->addTestSuite("WikiToolBarOther_ExistingPage"); |
32 | 32 | $suite->addTestSuite("WikiTextFormat_ExistingPage"); |
33 | 33 | |
— | — | @@ -35,7 +35,5 @@ |
36 | 36 | $suite->addTestSuite("WikiToolBarOther_NewPage"); |
37 | 37 | $suite->addTestSuite("WikiTextFormat_NewPage"); |
38 | 38 | |
39 | | -//$result->addListener($wLis); //Define your listener which the test result will use to give output |
40 | | -$suite->run($result); //And of course run this tests |
41 | | - |
42 | | -?> |
| 39 | +$suite->run($result); |
| 40 | +?> |
\ No newline at end of file |
Index: trunk/testing/selenium/UsabilityInitiative/WikiAutomationTC/testCases/WikiNTOC_TC.php |
— | — | @@ -1,7 +1,6 @@ |
2 | 2 | <?php |
3 | | -session_start(); |
4 | 3 | require_once 'WikiCommonFunction_TC.php'; |
5 | | -require_once 'Config.php'; |
| 4 | +include 'Config.php'; |
6 | 5 | /* |
7 | 6 | * This test case will be handling the NTOC related functions. |
8 | 7 | * Adding different header levels via tool bar and verify the output |
— | — | @@ -14,14 +13,13 @@ |
15 | 14 | // Add header level 2 and verify Header output |
16 | 15 | function verifyHeaderLevel2(){ |
17 | 16 | parent::doExpandAdvanceSection(); |
18 | | - $this->click("link=Heading"); |
19 | | - $this->click("link=Heading"); |
20 | | - $this->click("link=Level 2"); |
21 | | - $this->type("wpTextbox1", "==Heading text=="); |
22 | | - $this->click("wpPreview"); |
23 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 17 | + $this->click(LINK_HEADER); |
| 18 | + $this->click(LINK_LEVEL2HEADER); |
| 19 | + $this->type(TEXT_EDITOR, TEXT_LEVEL2HEADER); |
| 20 | + $this->click(BUTTON_PREVIEW); |
| 21 | + $this->waitForPageToLoad((WIKI_TEST_WAIT_TIME)); |
24 | 22 | try { |
25 | | - $this->assertEquals("Heading text", $this->getText("//*[@id='wikiPreview']/h2")); |
| 23 | + $this->assertEquals(TEXT_HEADER, $this->getText(TEXT_LEVEL2HEADER_SIZE)); |
26 | 24 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
27 | 25 | parent::doCreateScreenShot(__FUNCTION__); |
28 | 26 | array_push($this->verificationErrors, $e->toString()); |
— | — | @@ -32,14 +30,13 @@ |
33 | 31 | // Add header level 3 and verify Header output |
34 | 32 | function verifyHeaderLevel3(){ |
35 | 33 | parent::doExpandAdvanceSection(); |
36 | | - $this->click("link=Heading"); |
37 | | - $this->click("link=Heading"); |
38 | | - $this->click("link=Level 3"); |
39 | | - $this->type("wpTextbox1", "===Heading text==="); |
40 | | - $this->click("wpPreview"); |
41 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 34 | + $this->click(LINK_HEADER); |
| 35 | + $this->click(LINK_LEVEL3HEADER); |
| 36 | + $this->type(TEXT_EDITOR, TEXT_LEVEL3HEADER); |
| 37 | + $this->click(BUTTON_PREVIEW); |
| 38 | + $this->waitForPageToLoad((WIKI_TEST_WAIT_TIME)); |
42 | 39 | try { |
43 | | - $this->assertEquals("Heading text", $this->getText("//*[@id='wikiPreview']/h3")); |
| 40 | + $this->assertEquals(TEXT_HEADER, $this->getText(TEXT_LEVEL3HEADER_SIZE)); |
44 | 41 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
45 | 42 | parent::doCreateScreenShot(__FUNCTION__); |
46 | 43 | array_push($this->verificationErrors, $e->toString()); |
— | — | @@ -49,14 +46,13 @@ |
50 | 47 | // Add header level 4 and verify Header output |
51 | 48 | function verifyHeaderLevel4(){ |
52 | 49 | parent::doExpandAdvanceSection(); |
53 | | - $this->click("link=Heading"); |
54 | | - $this->click("link=Heading"); |
55 | | - $this->click("link=Level 4"); |
56 | | - $this->type("wpTextbox1", "====Heading text===="); |
57 | | - $this->click("wpPreview"); |
58 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 50 | + $this->click(LINK_HEADER); |
| 51 | + $this->click(LINK_LEVEL4HEADER); |
| 52 | + $this->type(TEXT_EDITOR, TEXT_LEVEL4HEADER); |
| 53 | + $this->click(BUTTON_PREVIEW); |
| 54 | + $this->waitForPageToLoad((WIKI_TEST_WAIT_TIME)); |
59 | 55 | try { |
60 | | - $this->assertEquals("Heading text", $this->getText("//*[@id='wikiPreview']/h4")); |
| 56 | + $this->assertEquals(TEXT_HEADER, $this->getText(TEXT_LEVEL4HEADER_SIZE)); |
61 | 57 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
62 | 58 | parent::doCreateScreenShot(__FUNCTION__); |
63 | 59 | array_push($this->verificationErrors, $e->toString()); |
— | — | @@ -66,14 +62,13 @@ |
67 | 63 | // Add header level 5 and verify Header output |
68 | 64 | function verifyHeaderLevel5(){ |
69 | 65 | parent::doExpandAdvanceSection(); |
70 | | - $this->click("link=Heading"); |
71 | | - $this->click("link=Heading"); |
72 | | - $this->click("link=Level 5"); |
73 | | - $this->type("wpTextbox1", "=====Heading text====="); |
74 | | - $this->click("wpPreview"); |
75 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 66 | + $this->click(LINK_HEADER); |
| 67 | + $this->click(LINK_LEVEL5HEADER); |
| 68 | + $this->type(TEXT_EDITOR, TEXT_LEVEL5HEADER); |
| 69 | + $this->click(BUTTON_PREVIEW); |
| 70 | + $this->waitForPageToLoad((WIKI_TEST_WAIT_TIME)); |
76 | 71 | try { |
77 | | - $this->assertEquals("Heading text", $this->getText("//*[@id='wikiPreview']/h5")); |
| 72 | + $this->assertEquals(TEXT_HEADER, $this->getText(TEXT_LEVEL5HEADER_SIZE)); |
78 | 73 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
79 | 74 | parent::doCreateScreenShot(__FUNCTION__); |
80 | 75 | array_push($this->verificationErrors, $e->toString()); |
— | — | @@ -83,20 +78,21 @@ |
84 | 79 | // Add header level 2 & 3 and verify Header output |
85 | 80 | function verifyHeaderLevel2and3(){ |
86 | 81 | parent::doExpandAdvanceSection(); |
87 | | - $this->click("link=Heading"); |
88 | | - $this->click("link=Level 2"); |
89 | | - $this->click("link=Heading"); |
90 | | - $this->click("link=Level 3"); |
91 | | - $this->type("wpTextbox1", "==Heading text==\n===Heading text==="); |
92 | | - $this->click("wpPreview"); |
93 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 82 | + $this->click(LINK_HEADER); |
| 83 | + $this->click(LINK_LEVEL2HEADER); |
| 84 | + $this->click(LINK_HEADER); |
| 85 | + $this->click(LINK_LEVEL3HEADER); |
| 86 | + $this->type(TEXT_EDITOR, TEXT_LEVEL2HEADER ."\n". TEXT_LEVEL3HEADER ); |
| 87 | + $this->click(BUTTON_PREVIEW); |
| 88 | + $this->waitForPageToLoad((WIKI_TEST_WAIT_TIME)); |
94 | 89 | try { |
95 | | - $this->assertEquals("Heading text", $this->getText("//*[@id='wikiPreview']/h2")); |
| 90 | + $this->assertEquals(TEXT_HEADER, $this->getText(TEXT_LEVEL2HEADER_SIZE)); |
96 | 91 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
| 92 | + parent::doCreateScreenShot(__FUNCTION__); |
97 | 93 | array_push($this->verificationErrors, $e->toString()); |
98 | 94 | } |
99 | 95 | try { |
100 | | - $this->assertEquals("Heading text", $this->getText("//*[@id='wikiPreview']/h3")); |
| 96 | + $this->assertEquals(TEXT_HEADER, $this->getText(TEXT_LEVEL3HEADER_SIZE)); |
101 | 97 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
102 | 98 | parent::doCreateScreenShot(__FUNCTION__); |
103 | 99 | array_push($this->verificationErrors, $e->toString()); |
— | — | @@ -106,29 +102,29 @@ |
107 | 103 | // Add header level 2 , 3 & 4 and verify Header output |
108 | 104 | function verifyHeaderLevel23and4(){ |
109 | 105 | parent::doExpandAdvanceSection(); |
110 | | - $this->click("link=Heading"); |
111 | | - $this->click("link=Level 2"); |
112 | | - $this->click("link=Heading"); |
113 | | - $this->click("link=Level 3"); |
114 | | - $this->click("link=Heading"); |
115 | | - $this->click("link=Level 4"); |
116 | | - $this->type("wpTextbox1", "==Heading text==\n===Heading text===\n====Heading text===="); |
117 | | - $this->click("wpPreview"); |
118 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 106 | + $this->click(LINK_HEADER); |
| 107 | + $this->click(LINK_LEVEL2HEADER); |
| 108 | + $this->click(LINK_HEADER); |
| 109 | + $this->click(LINK_LEVEL3HEADER); |
| 110 | + $this->click(LINK_HEADER); |
| 111 | + $this->click(LINK_LEVEL4HEADER); |
| 112 | + $this->type(TEXT_EDITOR, TEXT_LEVEL2HEADER ."\n". TEXT_LEVEL3HEADER ."\n". TEXT_LEVEL4HEADER ); |
| 113 | + $this->click(BUTTON_PREVIEW); |
| 114 | + $this->waitForPageToLoad((WIKI_TEST_WAIT_TIME)); |
119 | 115 | try { |
120 | | - $this->assertEquals("Heading text", $this->getText("//*[@id='wikiPreview']/h2")); |
| 116 | + $this->assertEquals(TEXT_HEADER, $this->getText(TEXT_LEVEL2HEADER_SIZE)); |
121 | 117 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
122 | 118 | parent::doCreateScreenShot(__FUNCTION__); |
123 | 119 | array_push($this->verificationErrors, $e->toString()); |
124 | 120 | } |
125 | 121 | try { |
126 | | - $this->assertEquals("Heading text", $this->getText("//*[@id='wikiPreview']/h3")); |
| 122 | + $this->assertEquals(TEXT_HEADER, $this->getText(TEXT_LEVEL3HEADER_SIZE)); |
127 | 123 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
128 | 124 | parent::doCreateScreenShot(__FUNCTION__); |
129 | 125 | array_push($this->verificationErrors, $e->toString()); |
130 | 126 | } |
131 | 127 | try { |
132 | | - $this->assertEquals("Heading text", $this->getText("//*[@id='wikiPreview']/h4")); |
| 128 | + $this->assertEquals(TEXT_HEADER, $this->getText(TEXT_LEVEL4HEADER_SIZE)); |
133 | 129 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
134 | 130 | parent::doCreateScreenShot(__FUNCTION__); |
135 | 131 | array_push($this->verificationErrors, $e->toString()); |
— | — | @@ -138,37 +134,37 @@ |
139 | 135 | // Add header level 2 , 3 , 4 & 5 and verify Header output |
140 | 136 | function verifyHeaderLevel234and5(){ |
141 | 137 | parent::doExpandAdvanceSection(); |
142 | | - $this->click("link=Heading"); |
143 | | - $this->click("link=Level 2"); |
144 | | - $this->click("link=Heading"); |
145 | | - $this->click("link=Level 3"); |
146 | | - $this->click("link=Heading"); |
147 | | - $this->click("link=Level 4"); |
148 | | - $this->click("link=Heading"); |
149 | | - $this->click("link=Level 5"); |
150 | | - $this->type("wpTextbox1", "==Heading text==\n===Heading text===\n====Heading text====\n=====Heading text====="); |
151 | | - $this->click("wpPreview"); |
152 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 138 | + $this->click(LINK_HEADER); |
| 139 | + $this->click(LINK_LEVEL2HEADER); |
| 140 | + $this->click(LINK_HEADER); |
| 141 | + $this->click(LINK_LEVEL3HEADER); |
| 142 | + $this->click(LINK_HEADER); |
| 143 | + $this->click(LINK_LEVEL4HEADER); |
| 144 | + $this->click(LINK_HEADER); |
| 145 | + $this->click(LINK_LEVEL5HEADER); |
| 146 | + $this->type(TEXT_EDITOR, TEXT_LEVEL2HEADER ."\n". TEXT_LEVEL3HEADER ."\n". TEXT_LEVEL4HEADER ."\n". TEXT_LEVEL5HEADER); |
| 147 | + $this->click(BUTTON_PREVIEW); |
| 148 | + $this->waitForPageToLoad((WIKI_TEST_WAIT_TIME)); |
153 | 149 | try { |
154 | | - $this->assertEquals("Heading text", $this->getText("//*[@id='wikiPreview']/h2")); |
| 150 | + $this->assertEquals(TEXT_HEADER, $this->getText(TEXT_LEVEL2HEADER_SIZE)); |
155 | 151 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
156 | 152 | parent::doCreateScreenShot(__FUNCTION__); |
157 | 153 | array_push($this->verificationErrors, $e->toString()); |
158 | 154 | } |
159 | 155 | try { |
160 | | - $this->assertEquals("Heading text", $this->getText("//*[@id='wikiPreview']/h3")); |
| 156 | + $this->assertEquals(TEXT_HEADER, $this->getText(TEXT_LEVEL3HEADER_SIZE)); |
161 | 157 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
162 | 158 | parent::doCreateScreenShot(__FUNCTION__); |
163 | 159 | array_push($this->verificationErrors, $e->toString()); |
164 | 160 | } |
165 | 161 | try { |
166 | | - $this->assertEquals("Heading text", $this->getText("//*[@id='wikiPreview']/h4")); |
| 162 | + $this->assertEquals(TEXT_HEADER, $this->getText(TEXT_LEVEL4HEADER_SIZE)); |
167 | 163 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
168 | 164 | parent::doCreateScreenShot(__FUNCTION__); |
169 | 165 | array_push($this->verificationErrors, $e->toString()); |
170 | 166 | } |
171 | 167 | try { |
172 | | - $this->assertEquals("Heading text", $this->getText("//*[@id='wikiPreview']/h5")); |
| 168 | + $this->assertEquals(TEXT_HEADER, $this->getText(TEXT_LEVEL5HEADER_SIZE)); |
173 | 169 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
174 | 170 | parent::doCreateScreenShot(__FUNCTION__); |
175 | 171 | array_push($this->verificationErrors, $e->toString()); |
Index: trunk/testing/selenium/UsabilityInitiative/WikiAutomationTC/testCases/WikiToolBarOther_TC.php |
— | — | @@ -1,5 +1,4 @@ |
2 | 2 | <?php |
3 | | -session_start(); |
4 | 3 | require_once 'WikiCommonFunction_TC.php'; |
5 | 4 | require_once 'Config.php'; |
6 | 5 | /** |
— | — | @@ -8,54 +7,66 @@ |
9 | 8 | * @author : BhagyaG - Calcey |
10 | 9 | */ |
11 | 10 | class WikiToolBarOther_TC extends WikiCommonFunction_TC { |
12 | | - // Click on Embedded file function and verify the output |
| 11 | + |
| 12 | + // Add Embedded file function and verify the output |
13 | 13 | function verifyEmbeddedFile(){ |
14 | | - $this->click("link=Embedded file"); |
15 | | - $this->type("wpTextbox1", "\" \""); |
16 | | - $this->type("wpTextbox1", "[[File:Example.jpg]]"); |
17 | | - $this->click("wpPreview"); |
18 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 14 | + $this->type(TEXT_EDITOR, ""); |
| 15 | + $this->click(LINK_TEXTEMBEDDED); |
| 16 | + $this->type(TEXT_EDITOR, TEXT_TEXTEMBEDDED); |
| 17 | + $this->click(BUTTON_PREVIEW); |
| 18 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
19 | 19 | try { |
20 | | - $this->assertEquals("", $this->getText("//img[@alt='Example.jpg']")); |
| 20 | + $this->assertTrue($this->isElementPresent(TEXT_TEXTEMBEDDED_VALIDATE)); |
21 | 21 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
22 | 22 | parent::doCreateScreenShot(__FUNCTION__); |
23 | 23 | array_push($this->verificationErrors, $e->toString()); |
24 | 24 | } |
25 | | - } |
| 25 | + } |
26 | 26 | |
27 | | - /** Reference link is not directing to the given link. |
28 | | - * For example if I add www.google.com as the reference link, |
29 | | - * on preview the link is not directing to google site. |
| 27 | + //Add Reference file function and verify the output |
30 | 28 | function verifyReference(){ |
31 | | - parent::doOpenLink(); |
32 | | - parent::doLogin(); |
| 29 | + $this->type(TEXT_EDITOR, ""); |
| 30 | + $this->click(LINK_TEXTREFERENCE); |
| 31 | + $this->type(INPUT_TEXTREFERENCE,TEXT_TEXTREFERENCE); |
| 32 | + $this->click(BUTTON_REFERENCE); |
| 33 | + $this->type(TEXT_EDITOR, TEXT_TEXTREFERENCE_EDITOR); |
| 34 | + $this->click(BUTTON_PREVIEW); |
| 35 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
| 36 | + try { |
| 37 | + $this->assertEquals(TEXT_REFERENCEID, $this->getText(TEXT_REFERENCELINK)); |
| 38 | + } catch (PHPUnit_Framework_AssertionFailedError $e) { |
| 39 | + parent::doCreateScreenShot(__FUNCTION__); |
| 40 | + array_push($this->verificationErrors, $e->toString()); |
| 41 | + } |
| 42 | + try { |
| 43 | + $this->assertTrue($this->isTextPresent(TEXT_REFERENCE)); |
| 44 | + } catch (PHPUnit_Framework_AssertionFailedError $e) { |
| 45 | + parent::doCreateScreenShot(__FUNCTION__); |
| 46 | + array_push($this->verificationErrors, $e->toString()); |
| 47 | + } |
33 | 48 | |
34 | | - $this->open("/deployment-en/Main_Page"); |
35 | | - $this->click("link=Random article"); |
36 | | - $this->waitForPageToLoad("30000"); |
37 | | - $this->click("//li[@id='ca-edit']/a/span"); |
38 | | - $this->waitForPageToLoad("30000"); |
39 | | - $this->type("wpTextbox1", ""); |
40 | | - $this->click("link=Reference"); |
41 | | - $this->type("wpTextbox1", ""); |
42 | | - $this->type("wikieditor-toolbar-reference-text", "www.google.com"); |
43 | | - $this->click("//div[13]/div[11]/button[1]"); |
44 | | - $this->click("wpPreview"); |
45 | | - |
46 | 49 | parent::doLogout(); |
47 | | - }**/ |
| 50 | + } |
48 | 51 | |
49 | | - // Click on Picture Gallery function and verify the output |
| 52 | + // Add Picture Gallery function and verify the output |
50 | 53 | function verifyPictureGallery(){ |
51 | 54 | parent::doExpandAdvanceSection(); |
52 | | - $this->type("wpTextbox1", ""); |
53 | | - $this->click("link=Picture gallery"); |
54 | | - $this->click("wpPreview"); |
55 | | - $this->waitForPageToLoad($_SESSION["WIKI_TEST_WAIT_TIME"]); |
| 55 | + $this->type(TEXT_EDITOR, ""); |
| 56 | + $this->click(TEXT_PICTURELINK); |
| 57 | + $this->click(BUTTON_PREVIEW); |
| 58 | + $this->waitForPageToLoad(WIKI_TEST_WAIT_TIME); |
| 59 | + $this->assertTrue($this->isElementPresent(IMAGE_EXAMPLE1)); |
56 | 60 | try { |
| 61 | + $this->assertEquals(TEXT_IMG1CAPTION, $this->getTable(TABLE_CAPTION1)); |
| 62 | + } catch (PHPUnit_Framework_AssertionFailedError $e) { |
57 | 63 | parent::doCreateScreenShot(__FUNCTION__); |
58 | | - $this->assertEquals("", $this->getText("//div[@id='wikiPreview']/table/tbody/tr/td[1]/div/div[1]/div")); |
| 64 | + array_push($this->verificationErrors, $e->toString()); |
| 65 | + } |
| 66 | + $this->assertTrue($this->isElementPresent(IMAGE_EXAMPLE2)); |
| 67 | + try { |
| 68 | + $this->assertEquals(TEXT_IMG2CAPTION, $this->getTable(TABLE_CAPTION2)); |
59 | 69 | } catch (PHPUnit_Framework_AssertionFailedError $e) { |
| 70 | + parent::doCreateScreenShot(__FUNCTION__); |
60 | 71 | array_push($this->verificationErrors, $e->toString()); |
61 | 72 | } |
62 | 73 | } |