Index: trunk/extensions/WikiEditor/tests/selenium/WikiEditorSeleniumConfig.php |
— | — | @@ -0,0 +1,27 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +class WikiEditorSeleniumConfig { |
| 5 | + |
| 6 | + public static function getSettings(&$includeFiles, &$globalConfigs) { |
| 7 | + $includes = array( |
| 8 | + 'extensions/Vector/Vector.php', |
| 9 | + 'extensions/WikiEditor/WikiEditor.php' |
| 10 | + ); |
| 11 | + $configs = array( |
| 12 | + 'wgDefaultSkin' => 'vector', |
| 13 | + 'wgWikiEditorFeatures' => array( |
| 14 | + 'toolbar' => array( 'global' => true, 'user' => true ), |
| 15 | + 'toc' => array( 'global' => false, 'user' => false ), |
| 16 | + 'highlight' => array( 'global' => false, 'user' => false ), |
| 17 | + 'templateEditor' => array( 'global' => false, 'user' => false ), |
| 18 | + 'dialogs' => array( 'global' => true, 'user' => true ) |
| 19 | + ), |
| 20 | + 'wgVectorFeatures' => array( |
| 21 | + 'editwarning' => array( 'global' => false, 'user' => false ) |
| 22 | + ) |
| 23 | + ); |
| 24 | + $includeFiles = array_merge( $includeFiles, $includes ); |
| 25 | + $globalConfigs = array_merge( $globalConfigs, $configs); |
| 26 | + return true; |
| 27 | + } |
| 28 | +} |
\ No newline at end of file |
Index: trunk/extensions/WikiEditor/tests/selenium/WikiEditorTestSuite.php |
— | — | @@ -0,0 +1,35 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/* |
| 5 | + * To configure MW for these tests |
| 6 | + * 1) If you are running multiple test suites, add the following in LocalSettings.php |
| 7 | + * require_once("extensions/WikiEditor/tests/selenium/WikiEditorSeleniumConfig.php"); |
| 8 | + * $wgSeleniumTestConfigs['WikiEditorTestSuite'] = 'WikiEditorSeleniumConfig::getSettings'; |
| 9 | + * OR |
| 10 | + * 2) Add the following to your Localsettings.php |
| 11 | + * require_once( "$IP/extensions/Vector/Vector.php" ); |
| 12 | + * require_once( "$IP/extensions/WikiEditor/WikiEditor.php" ); |
| 13 | + * $wgDefaultSkin = 'vector'; |
| 14 | + * $wgVectorFeatures['editwarning'] = array( 'global' => false, 'user' => false ); |
| 15 | + * $wgWikiEditorFeatures['templateEditor'] = array( 'global' => false, 'user' => false ); |
| 16 | + * $wgWikiEditorFeatures['toolbar'] = array( 'global' => true, 'user' => true ); |
| 17 | + * $wgWikiEditorFeatures['toc'] = array( 'global' => false, 'user' => false ); |
| 18 | + * $wgWikiEditorFeatures['highlight'] = array( 'global' => false, 'user' => false ); |
| 19 | + * $wgWikiEditorFeatures['dialogs'] = array( 'global' => true, 'user' => true ); |
| 20 | + * |
| 21 | + */ |
| 22 | +class WikiEditorTestSuite extends SeleniumTestSuite |
| 23 | +{ |
| 24 | + public function setUp() { |
| 25 | + $this->setLoginBeforeTests( false ); |
| 26 | + parent::setUp(); |
| 27 | + } |
| 28 | + public function addTests() { |
| 29 | + $testFiles = array( |
| 30 | + 'extensions/WikiEditor/tests/selenium/WikiDialogs_Links.php' |
| 31 | + ); |
| 32 | + parent::addTestFiles( $testFiles ); |
| 33 | + } |
| 34 | + |
| 35 | + |
| 36 | +} |
Index: trunk/extensions/WikiEditor/tests/selenium/WikiDialogs_Links.php |
— | — | @@ -0,0 +1,68 @@ |
| 2 | +<?php |
| 3 | +require_once 'WikiDialogs_Links_Setup.php'; |
| 4 | +/** |
| 5 | + * Description of WikiNewPageDialogs |
| 6 | + * |
| 7 | + * @author bhagyag, pdhanda |
| 8 | + * |
| 9 | + * This test case is part of the WikiEditorTestSuite. |
| 10 | + * Configuration for these tests are dosumented as part of extensions/WikiEditor/tests/selenium/WikiEditorTestSuite.php |
| 11 | + * |
| 12 | + */ |
| 13 | +class WikiDialogs_Links extends WikiDialogs_Links_Setup { |
| 14 | + // Set up the testing environment |
| 15 | + function setup() { |
| 16 | + parent::setUp(); |
| 17 | + parent::doCreateInternalTestPageIfMissing(); |
| 18 | + } |
| 19 | + |
| 20 | + function tearDown() { |
| 21 | + parent::doLogout(); |
| 22 | + parent::tearDown(); |
| 23 | + } |
| 24 | + |
| 25 | + //Create a new page temporary |
| 26 | + function createNewPage() { |
| 27 | + parent::doOpenLink(); |
| 28 | + parent::login(); |
| 29 | + parent::doCreateNewPageTemporary(); |
| 30 | + } |
| 31 | + |
| 32 | + // Add a internal link and verify |
| 33 | + function testInternalLink() { |
| 34 | + $this->createNewPage(); |
| 35 | + parent::verifyInternalLink(); |
| 36 | + } |
| 37 | + |
| 38 | + // Add a internal link with different display text and verify |
| 39 | + function testInternalLinkWithDisplayText() { |
| 40 | + $this->createNewPage(); |
| 41 | + parent::verifyInternalLinkWithDisplayText(); |
| 42 | + } |
| 43 | + |
| 44 | + // Add a internal link with blank display text and verify |
| 45 | + function testInternalLinkWithBlankDisplayText() { |
| 46 | + $this->createNewPage(); |
| 47 | + parent::verifyInternalLinkWithBlankDisplayText(); |
| 48 | + } |
| 49 | + |
| 50 | + // Add external link and verify |
| 51 | + function testExternalLink() { |
| 52 | + $this->createNewPage(); |
| 53 | + parent::verifyExternalLink(); |
| 54 | + } |
| 55 | + |
| 56 | + // Add external link with different display text and verify |
| 57 | + function testExternalLinkWithDisplayText( ) { |
| 58 | + $this->createNewPage(); |
| 59 | + parent::verifyExternalLinkWithDisplayText(); |
| 60 | + } |
| 61 | + |
| 62 | + // Add external link with Blank display text and verify |
| 63 | + function testExternalLinkWithBlankDisplayText() { |
| 64 | + $this->createNewPage(); |
| 65 | + parent::verifyExternalLinkWithBlankDisplayText(); |
| 66 | + } |
| 67 | + |
| 68 | +} |
| 69 | +?> |
Index: trunk/extensions/WikiEditor/tests/selenium/WikiDialogs_Links_Setup.php |
— | — | @@ -0,0 +1,296 @@ |
| 2 | +<?php |
| 3 | +include("WikiEditorConstants.php"); |
| 4 | +/** |
| 5 | + * This test case will be handling the Wiki Tool bar Dialog functions |
| 6 | + * Date : Apr - 2010 |
| 7 | + * @author : BhagyaG - Calcey |
| 8 | + */ |
| 9 | +class WikiDialogs_Links_Setup extends SeleniumTestCase { |
| 10 | + |
| 11 | + // Open the page. |
| 12 | + function doOpenLink() { |
| 13 | + $this->open( $this->getUrl() . '/index.php' ); |
| 14 | + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
| 15 | + } |
| 16 | + |
| 17 | + //Expand advance tool bar section if its not |
| 18 | + function doExpandAdvanceSection() { |
| 19 | + if ( !$this->isTextPresent( TEXT_HEADING ) ){ |
| 20 | + $this->click( LINK_ADVANCED ); |
| 21 | + } |
| 22 | + } |
| 23 | + |
| 24 | + // Log out from the application |
| 25 | + function doLogout() { |
| 26 | + $this->open( $this->getUrl() . '/index.php' ); |
| 27 | + if ($this->isTextPresent( TEXT_LOGOUT ) ) { |
| 28 | + $this->click( LINK_LOGOUT ); |
| 29 | + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
| 30 | + $this->assertEquals(TEXT_LOGOUT_CONFIRM, $this->getText( LINK_LOGIN )); |
| 31 | + $this->open( $this->getUrl() . '/index.php' ); |
| 32 | + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
| 33 | + } |
| 34 | + } |
| 35 | + |
| 36 | + //Create a temporary fixture page |
| 37 | + function doCreateInternalTestPageIfMissing() { |
| 38 | + $this->type( INPUT_SEARCH_BOX, WIKI_INTERNAL_LINK ); |
| 39 | + $this->click( BUTTON_SEARCH ); |
| 40 | + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
| 41 | + $this->click( LINK_START . WIKI_INTERNAL_LINK ); |
| 42 | + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
| 43 | + $location = $this->getLocation() . "\n"; |
| 44 | + if ( strpos( $location, '&redlink=1') !== false ) { |
| 45 | + $this->type( TEXT_EDITOR, "Test fixture page. No real content here" ); |
| 46 | + $this->click( BUTTON_SAVE_WATCH ); |
| 47 | + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
| 48 | + $this->assertTrue( $this->isTextPresent( WIKI_INTERNAL_LINK ), |
| 49 | + $this->getText( TEXT_PAGE_HEADING ) ); |
| 50 | + } |
| 51 | + } |
| 52 | + |
| 53 | + //Create a temporary new page |
| 54 | + function doCreateNewPageTemporary() { |
| 55 | + $this->type( INPUT_SEARCH_BOX, WIKI_TEMP_NEWPAGE ); |
| 56 | + $this->click( BUTTON_SEARCH ); |
| 57 | + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
| 58 | + $this->click( LINK_START . WIKI_TEMP_NEWPAGE ); |
| 59 | + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
| 60 | + } |
| 61 | + |
| 62 | + // Add a internal link and verify |
| 63 | + function verifyInternalLink(){ |
| 64 | + $this->type( TEXT_EDITOR, "" ); |
| 65 | + $this->click( LINK_ADDLINK ); |
| 66 | + $this->waitForPopup( 'addLink', WIKI_TEST_WAIT_TIME ); |
| 67 | + $this->type( TEXT_LINKNAME, ( WIKI_INTERNAL_LINK ) ); |
| 68 | + $this->assertTrue( $this->isElementPresent( ICON_PAGEEXISTS ), 'Element ' . ICON_PAGEEXISTS . 'Not found' ); |
| 69 | + $this->assertEquals( "on", $this->getValue( OPT_INTERNAL ) ); |
| 70 | + $this->click( BUTTON_INSERTLINK ); |
| 71 | + $this->click( LINK_PREVIEW ); |
| 72 | + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
| 73 | + $this->assertEquals( ( WIKI_INTERNAL_LINK ), $this->getText( LINK_START . WIKI_INTERNAL_LINK ) ); |
| 74 | + $this->click( LINK_START. WIKI_INTERNAL_LINK ); |
| 75 | + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
| 76 | + $this->assertTrue( $this->isTextPresent( WIKI_INTERNAL_LINK ), $this->getText(TEXT_PAGE_HEADING ) ); |
| 77 | + } |
| 78 | + |
| 79 | + // Add a internal link with different display text and verify |
| 80 | + function verifyInternalLinkWithDisplayText(){ |
| 81 | + $this->type( TEXT_EDITOR, "" ); |
| 82 | + $this->click( LINK_ADDLINK ); |
| 83 | + $this->waitForPopup('addLink', WIKI_TEST_WAIT_TIME); |
| 84 | + $this->type( TEXT_LINKNAME, WIKI_INTERNAL_LINK ); |
| 85 | + $this->type ( TEXT_LINKDISPLAYNAME, WIKI_INTERNAL_LINK . TEXT_LINKDISPLAYNAME_APPENDTEXT ); |
| 86 | + $this->assertTrue( $this->isElementPresent( ICON_PAGEEXISTS ) ); |
| 87 | + $this->assertEquals( "on", $this->getValue( OPT_INTERNAL ) ); |
| 88 | + $this->click( BUTTON_INSERTLINK ); |
| 89 | + $this->click( LINK_PREVIEW ); |
| 90 | + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
| 91 | + $this->assertEquals( WIKI_INTERNAL_LINK . TEXT_LINKDISPLAYNAME_APPENDTEXT, |
| 92 | + $this->getText( LINK_START . WIKI_INTERNAL_LINK . TEXT_LINKDISPLAYNAME_APPENDTEXT ) ); |
| 93 | + $this->click( LINK_START . WIKI_INTERNAL_LINK . TEXT_LINKDISPLAYNAME_APPENDTEXT ); |
| 94 | + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
| 95 | + $this->assertTrue( $this->isTextPresent( WIKI_INTERNAL_LINK ), $this->getText( TEXT_PAGE_HEADING ) ); |
| 96 | + |
| 97 | + } |
| 98 | + |
| 99 | + // Add a internal link with blank display text and verify |
| 100 | + function verifyInternalLinkWithBlankDisplayText(){ |
| 101 | + $this->type( TEXT_EDITOR, "" ); |
| 102 | + $this->click( LINK_ADDLINK ); |
| 103 | + $this->waitForPopup( 'addLink', WIKI_TEST_WAIT_TIME ); |
| 104 | + $this->type( TEXT_LINKNAME, WIKI_INTERNAL_LINK ); |
| 105 | + $this->type( TEXT_LINKDISPLAYNAME, "" ); |
| 106 | + $this->assertTrue( $this->isElementPresent( ICON_PAGEEXISTS ) ); |
| 107 | + $this->assertEquals("on", $this->getValue(OPT_INTERNAL)); |
| 108 | + $this->click( BUTTON_INSERTLINK ); |
| 109 | + $this->click( LINK_PREVIEW ); |
| 110 | + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
| 111 | + $this->assertEquals( WIKI_INTERNAL_LINK, $this->getText( LINK_START. WIKI_INTERNAL_LINK ) ); |
| 112 | + $this->click( LINK_START . WIKI_INTERNAL_LINK ); |
| 113 | + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
| 114 | + $this->assertEquals( WIKI_INTERNAL_LINK, $this->getText( TEXT_PAGE_HEADING ) ); |
| 115 | + |
| 116 | + } |
| 117 | + |
| 118 | + // Add external link and verify |
| 119 | + function verifyExternalLink(){ |
| 120 | + $this->type( LINK_PREVIEW, "" ); |
| 121 | + $this->click( LINK_ADDLINK ); |
| 122 | + $this->type( TEXT_LINKNAME, WIKI_EXTERNAL_LINK ); |
| 123 | + $this->assertTrue( $this->isElementPresent( ICON_PAGEEXTERNAL ) ); |
| 124 | + $this->assertEquals( "on", $this->getValue( OPT_EXTERNAL ) ); |
| 125 | + $this->click( BUTTON_INSERTLINK ); |
| 126 | + $this->click( LINK_PREVIEW ); |
| 127 | + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
| 128 | + $this->assertEquals( WIKI_EXTERNAL_LINK, $this->getText( LINK_START . WIKI_EXTERNAL_LINK ) ); |
| 129 | + |
| 130 | + $this->click( LINK_START . WIKI_EXTERNAL_LINK ); |
| 131 | + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
| 132 | + $this->assertEquals( WIKI_EXTERNAL_LINK_TITLE, $this->getTitle() ); |
| 133 | + } |
| 134 | + |
| 135 | + // Add external link with different display text and verify |
| 136 | + function verifyExternalLinkWithDisplayText(){ |
| 137 | + $this->type( TEXT_EDITOR, "" ); |
| 138 | + $this->click( LINK_ADDLINK ); |
| 139 | + $this->type( TEXT_LINKNAME, WIKI_EXTERNAL_LINK ); |
| 140 | + $this->type( TEXT_LINKDISPLAYNAME, WIKI_EXTERNAL_LINK_TITLE ); |
| 141 | + $this->assertTrue( $this->isElementPresent( ICON_PAGEEXTERNAL ) ); |
| 142 | + $this->assertEquals( "on", $this->getValue( OPT_EXTERNAL ) ); |
| 143 | + $this->click( BUTTON_INSERTLINK ); |
| 144 | + $this->click( LINK_PREVIEW ); |
| 145 | + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
| 146 | + $this->assertEquals( WIKI_EXTERNAL_LINK_TITLE, $this->getText( LINK_START . WIKI_EXTERNAL_LINK_TITLE ) ); |
| 147 | + $this->click(LINK_START.(WIKI_EXTERNAL_LINK_TITLE)); |
| 148 | + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
| 149 | + $this->assertEquals( WIKI_EXTERNAL_LINK_TITLE , $this->getTitle() ); |
| 150 | + } |
| 151 | + |
| 152 | + // Add external link with Blank display text and verify |
| 153 | + function verifyExternalLinkWithBlankDisplayText(){ |
| 154 | + $this->type( TEXT_EDITOR, "" ); |
| 155 | + $this->click( LINK_ADDLINK ); |
| 156 | + $this->type( TEXT_LINKNAME, WIKI_EXTERNAL_LINK ); |
| 157 | + $this->type( TEXT_LINKDISPLAYNAME, "" ); |
| 158 | + $this->assertTrue( $this->isElementPresent( ICON_PAGEEXTERNAL ) ); |
| 159 | + $this->assertEquals( "on", $this->getValue( OPT_EXTERNAL ) ); |
| 160 | + $this->click( BUTTON_INSERTLINK ); |
| 161 | + $this->click( LINK_PREVIEW ); |
| 162 | + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
| 163 | + $this->assertEquals( "[1]", $this->getText(LINK_START . "[1]" ) ); |
| 164 | + $this->click( LINK_START . "[1]" ); |
| 165 | + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
| 166 | + $this->assertEquals( WIKI_EXTERNAL_LINK_TITLE, $this->getTitle() ); |
| 167 | + } |
| 168 | + |
| 169 | + // Add a table and verify |
| 170 | + function verifyCreateTable(){ |
| 171 | + $WIKI_TABLE_ROW = 2; |
| 172 | + $WIKI_TABLE_COL = "5"; |
| 173 | + $this->doExpandAdvanceSection(); |
| 174 | + $this->type( TEXT_EDITOR, "" ); |
| 175 | + $this->click( LINK_ADDTABLE ); |
| 176 | + $this->click( CHK_SORT ); |
| 177 | + $this->type( TEXT_ROW, $WIKI_TABLE_ROW ); |
| 178 | + $this->type( TEXT_COL, $WIKI_TABLE_COL ); |
| 179 | + $this->click( BUTTON_INSERTABLE ); |
| 180 | + $this->click( CHK_SORT ); |
| 181 | + $this->click( LINK_PREVIEW ); |
| 182 | + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
| 183 | + $WIKI_TABLE_ROW = $WIKI_TABLE_ROW + 1; |
| 184 | + $this->assertTrue( $this->isElementPresent( TEXT_TABLEID_OTHER . |
| 185 | + TEXT_VALIDATE_TABLE_PART1 . $WIKI_TABLE_ROW . |
| 186 | + TEXT_VALIDATE_TABLE_PART2 . $WIKI_TABLE_COL . |
| 187 | + TEXT_VALIDATE_TABLE_PART3 ) ); |
| 188 | + } |
| 189 | + |
| 190 | + // Add a table and verify only with head row |
| 191 | + function verifyCreateTableWithHeadRow(){ |
| 192 | + $WIKI_TABLE_ROW = 3; |
| 193 | + $WIKI_TABLE_COL = "4"; |
| 194 | + $this->doExpandAdvanceSection(); |
| 195 | + $this->type( TEXT_EDITOR, "" ); |
| 196 | + $this->click( LINK_ADDTABLE ); |
| 197 | + $this->click( CHK_BOARDER); |
| 198 | + $this->type( TEXT_ROW, $WIKI_TABLE_ROW ); |
| 199 | + $this->type( TEXT_COL, $WIKI_TABLE_COL ); |
| 200 | + $this->click( BUTTON_INSERTABLE ); |
| 201 | + $this->click( LINK_PREVIEW ); |
| 202 | + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
| 203 | + $WIKI_TABLE_ROW = $WIKI_TABLE_ROW+1; |
| 204 | + $this->assertTrue( $this->isElementPresent( TEXT_TABLEID_OTHER . |
| 205 | + TEXT_VALIDATE_TABLE_PART1 . $WIKI_TABLE_ROW . |
| 206 | + TEXT_VALIDATE_TABLE_PART2 . $WIKI_TABLE_COL . |
| 207 | + TEXT_VALIDATE_TABLE_PART3 ) ); |
| 208 | + } |
| 209 | + |
| 210 | + // Add a table and verify only with borders |
| 211 | + function verifyCreateTableWithBorders(){ |
| 212 | + $WIKI_TABLE_ROW = "4"; |
| 213 | + $WIKI_TABLE_COL = "6"; |
| 214 | + $this->type( TEXT_EDITOR, "" ); |
| 215 | + $this->click( LINK_ADDTABLE ); |
| 216 | + $this->click( CHK_HEADER ); |
| 217 | + $this->type( TEXT_ROW, $WIKI_TABLE_ROW ); |
| 218 | + $this->type( TEXT_COL, $WIKI_TABLE_COL ); |
| 219 | + $this->click( BUTTON_INSERTABLE ); |
| 220 | + $this->click( CHK_HEADER ); |
| 221 | + $this->click( LINK_PREVIEW ); |
| 222 | + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
| 223 | + $this->assertTrue( $this->isElementPresent( TEXT_TABLEID_OTHER . |
| 224 | + TEXT_VALIDATE_TABLE_PART1 . $WIKI_TABLE_ROW . |
| 225 | + TEXT_VALIDATE_TABLE_PART2 . $WIKI_TABLE_COL . |
| 226 | + TEXT_VALIDATE_TABLE_PART3 ) ); |
| 227 | + } |
| 228 | + |
| 229 | + // Add a table and verify only with sort row |
| 230 | + function verifyCreateTableWithSortRow(){ |
| 231 | + $WIKI_TABLE_ROW = "2"; |
| 232 | + $WIKI_TABLE_COL = "5"; |
| 233 | + $this->type( TEXT_EDITOR, "" ); |
| 234 | + $this->click( LINK_ADDTABLE ); |
| 235 | + $this->click( CHK_HEADER ); |
| 236 | + $this->click( CHK_BOARDER ); |
| 237 | + $this->click( CHK_SORT ); |
| 238 | + $this->type( TEXT_ROW, $WIKI_TABLE_ROW ); |
| 239 | + $this->type( TEXT_COL, $WIKI_TABLE_COL ); |
| 240 | + $this->click( BUTTON_INSERTABLE ); |
| 241 | + $this->click( CHK_HEADER ); |
| 242 | + $this->click( CHK_BOARDER ); |
| 243 | + $this->click( CHK_SORT ); |
| 244 | + $this->click( LINK_PREVIEW ); |
| 245 | + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
| 246 | + $this->assertTrue( $this->isElementPresent(TEXT_TABLEID_WITHALLFEATURES . |
| 247 | + TEXT_VALIDATE_TABLE_PART1 . $WIKI_TABLE_ROW . |
| 248 | + TEXT_VALIDATE_TABLE_PART2 . $WIKI_TABLE_COL . |
| 249 | + TEXT_VALIDATE_TABLE_PART3 ) ); |
| 250 | + } |
| 251 | + |
| 252 | + // Add a table without headers,borders and sort rows |
| 253 | + function verifyCreateTableWithNoSpecialEffects(){ |
| 254 | + $WIKI_TABLE_ROW = "6"; |
| 255 | + $WIKI_TABLE_COL = "2"; |
| 256 | + $this-> |
| 257 | + $this->doExpandAdvanceSection(); |
| 258 | + $this->type( TEXT_EDITOR, "" ); |
| 259 | + $this->click( LINK_ADDTABLE ); |
| 260 | + $this->click( CHK_BOARDER ); |
| 261 | + $this->click( CHK_HEADER ); |
| 262 | + $this->type( TEXT_ROW, $WIKI_TABLE_ROW ); |
| 263 | + $this->type( TEXT_COL, $WIKI_TABLE_COL ); |
| 264 | + $this->click( BUTTON_INSERTABLE ); |
| 265 | + $this->click( CHK_BOARDER ); |
| 266 | + $this->click( CHK_HEADER ); |
| 267 | + $this->click( INK_PREVIEW ); |
| 268 | + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
| 269 | + $this->assertTrue( $this->isElementPresent( TEXT_TABLEID_OTHER . |
| 270 | + TEXT_VALIDATE_TABLE_PART1 . $WIKI_TABLE_ROW . |
| 271 | + TEXT_VALIDATE_TABLE_PART2 . $WIKI_TABLE_COL . |
| 272 | + TEXT_VALIDATE_TABLE_PART3 ) ); |
| 273 | + } |
| 274 | + |
| 275 | + // Add a table with headers,borders and sort rows |
| 276 | + function verifyCreateTableWithAllSpecialEffects(){ |
| 277 | + $WIKI_TABLE_ROW = 6; |
| 278 | + $WIKI_TABLE_COL = "2"; |
| 279 | + $this->doExpandAdvanceSection(); |
| 280 | + $this->type( TEXT_EDITOR, "" ); |
| 281 | + $this->click( LINK_ADDTABLE ); |
| 282 | + $this->click( CHK_SORT ); |
| 283 | + $this->type( TEXT_ROW, $WIKI_TABLE_ROW ); |
| 284 | + $this->type( TEXT_COL, $WIKI_TABLE_COL ); |
| 285 | + $this->click( BUTTON_INSERTABLE ); |
| 286 | + $this->click( CHK_SORT ); |
| 287 | + $this->click( LINK_PREVIEW ); |
| 288 | + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); |
| 289 | + $WIKI_TABLE_ROW = $WIKI_TABLE_ROW+1; |
| 290 | + $this->assertTrue( $this->isElementPresent(TEXT_TABLEID_WITHALLFEATURES . |
| 291 | + TEXT_VALIDATE_TABLE_PART1 . $WIKI_TABLE_ROW . |
| 292 | + TEXT_VALIDATE_TABLE_PART2 . $WIKI_TABLE_COL . |
| 293 | + TEXT_VALIDATE_TABLE_PART3)); |
| 294 | + } |
| 295 | + |
| 296 | +} |
| 297 | +?> |
\ No newline at end of file |
Index: trunk/extensions/WikiEditor/tests/selenium/WikiEditorConstants.php |
— | — | @@ -0,0 +1,84 @@ |
| 2 | +<?php |
| 3 | +define ('WIKI_TEST_WAIT_TIME', "3000"); // Waiting time |
| 4 | + |
| 5 | +// tool bar, buttons , links |
| 6 | +// commonly using links |
| 7 | +define ('LINK_MAIN_PAGE',"link=Main page"); |
| 8 | +define ('LINK_RANDOM_PAGE',"link=Random article"); |
| 9 | +define ('TEXT_PAGE_HEADING',"firstHeading"); |
| 10 | +define ('LINK_START',"link="); |
| 11 | +define ('LINK_EDITPAGE',"//li[@id='ca-edit']/a/span"); |
| 12 | +define ('TEXT_EDITOR',"wpTextbox1"); |
| 13 | +define ('LINK_PREVIEW',"wpPreview"); |
| 14 | + |
| 15 | +define ('WIKI_SEARCH_PAGE',"Hair (musical)"); // Page name to search |
| 16 | +define ('WIKI_TEXT_SEARCH',"TV"); // Text to search |
| 17 | +define ('WIKI_INTERNAL_LINK',"Wikieditor-Fixture-Page"); // Exisiting page name to add as an internal tag |
| 18 | +define ('WIKI_EXTERNAL_LINK',"www.google.com"); // External web site name |
| 19 | +define ('WIKI_EXTERNAL_LINK_TITLE',"Google"); // Page title of the external web site name |
| 20 | +define ('WIKI_CODE_PATH',getcwd()); // get the current path of the program |
| 21 | +define ('WIKI_SCREENSHOTS_PATH',"screenshots"); // the folder the error screen shots will be saved |
| 22 | +define ('WIKI_SCREENSHOTS_TYPE',"png"); // screen print type |
| 23 | +define ('WIKI_TEMP_NEWPAGE',"TestWikiPage"); // temporary creating new page name |
| 24 | +// for WikiCommonFunction_TC |
| 25 | + |
| 26 | +// for WikiSearch_TC |
| 27 | +define ('INPUT_SEARCH_BOX', "searchInput"); |
| 28 | +define ('BUTTON_SEARCH',"mw-searchButton"); |
| 29 | +define ('TEXT_SEARCH_RESULT_HEADING'," - Search results - Wikipedia, the free encyclopedia"); |
| 30 | + |
| 31 | +// for WikiWatchUnWatch_TC |
| 32 | +define ('LINK_WATCH_PAGE',"link=Watch"); |
| 33 | +define ('LINK_WATCH_LIST',"link=My watchlist"); |
| 34 | +define ('LINK_WATCH_EDIT',"link=View and edit watchlist"); |
| 35 | +define ('LINK_UNWATCH',"link=Unwatch"); |
| 36 | +define ('BUTTON_WATCH',"wpWatchthis"); |
| 37 | +define ('BUTTON_SAVE_WATCH',"wpSave"); |
| 38 | +define ('TEXT_WATCH',"Watch"); |
| 39 | +define ('TEXT_UNWATCH',"Unwatch"); |
| 40 | + |
| 41 | +// for WikiCommonFunction_TC |
| 42 | +define ('TEXT_LOGOUT',"Log out"); |
| 43 | +define ('LINK_LOGOUT',"link=Log out"); |
| 44 | +define ('LINK_LOGIN',"link=Log in / create account"); |
| 45 | +define ('TEXT_LOGOUT_CONFIRM',"Log in / create account"); |
| 46 | +define ('INPUT_USER_NAME', "wpName1"); |
| 47 | +define ('INPUT_PASSWD', "wpPassword1"); |
| 48 | +define ('BUTTON_LOGIN',"wpLoginAttempt"); |
| 49 | +define ('TEXT_HEADING',"Heading"); |
| 50 | +define ('LINK_ADVANCED',"link=Advanced"); |
| 51 | + |
| 52 | +// for WikiDialogs_TC |
| 53 | +define ('LINK_ADDLINK',"//div[@id='wikiEditor-ui-toolbar']/div[1]/div[2]/span[2 ]"); |
| 54 | +define ('TEXT_LINKNAME',"wikieditor-toolbar-link-int-target"); |
| 55 | +define ('TEXT_LINKDISPLAYNAME',"wikieditor-toolbar-link-int-text"); |
| 56 | +define ('TEXT_LINKDISPLAYNAME_APPENDTEXT'," Test"); |
| 57 | +define ('ICON_PAGEEXISTS',"wikieditor-toolbar-link-int-target-status-exists"); |
| 58 | +define ('ICON_PAGEEXTERNAL',"wikieditor-toolbar-link-int-target-status-external"); |
| 59 | +define ('OPT_INTERNAL',"wikieditor-toolbar-link-type-int"); |
| 60 | +define ('OPT_EXTERNAL',"wikieditor-toolbar-link-type-ext"); |
| 61 | +define ('BUTTON_INSERTLINK',"//div[10]/div[11]/button[1]"); |
| 62 | +define ('LINK_ADDTABLE',"//div[@id='wikiEditor-ui-toolbar']/div[3]/div[1]/div[4]/span[2]"); |
| 63 | +define ('CHK_HEADER',"wikieditor-toolbar-table-dimensions-header"); |
| 64 | +define ('CHK_BOARDER',"wikieditor-toolbar-table-wikitable"); |
| 65 | +define ('CHK_SORT',"wikieditor-toolbar-table-sortable"); |
| 66 | +define ('TEXT_ROW',"wikieditor-toolbar-table-dimensions-rows"); |
| 67 | +define ('TEXT_COL',"wikieditor-toolbar-table-dimensions-columns"); |
| 68 | +define ('BUTTON_INSERTABLE',"//div[3]/button[1]"); |
| 69 | +define ('TEXT_HEADTABLE_TEXT',"Header text"); |
| 70 | +define ('TEXT_TABLEID_WITHALLFEATURES', "//table[@id='sortable_table_id_0']/tbody/" ); |
| 71 | +define ('TEXT_TABLEID_OTHER', "//div[@id='wikiPreview']/table/tbody/" ); |
| 72 | +define ('TEXT_VALIDATE_TABLE_PART1', "tr["); |
| 73 | +define ('TEXT_VALIDATE_TABLE_PART2',"]/td["); |
| 74 | +define ('TEXT_VALIDATE_TABLE_PART3',"]"); |
| 75 | +define ('LINK_SEARCH',"//div[@id='wikiEditor-ui-toolbar']/div[3]/div[1]/div[5]/span"); |
| 76 | +define ('INPUT_SEARCH',"wikieditor-toolbar-replace-search"); |
| 77 | +define ('INPUT_REPLACE',"wikieditor-toolbar-replace-replace"); |
| 78 | +define ('BUTTON_REPLACEALL',"//button[3]"); |
| 79 | +define ('BUTTON_REPLACENEXT',"//button[2]"); |
| 80 | +define ('BUTTON_CANCEL',"//button[4]"); |
| 81 | +define ('TEXT_PREVIEW_TEXT1',"//div[@id='wikiPreview']/p[1]"); |
| 82 | +define ('TEXT_PREVIEW_TEXT2',"//div[@id='wikiPreview']/p[2]"); |
| 83 | +define ('TEXT_PREVIEW_TEXT3',"//div[@id='wikiPreview']/p[3]"); |
| 84 | + |
| 85 | + |