summaryrefslogtreecommitdiff
path: root/extensions/WikiEditor/tests
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/WikiEditor/tests')
-rw-r--r--extensions/WikiEditor/tests/qunit/ext.wikiEditor.toolbar.test.js274
-rw-r--r--extensions/WikiEditor/tests/selenium/WikiDialogs_Links.php67
-rw-r--r--extensions/WikiEditor/tests/selenium/WikiDialogs_Links_Setup.php295
-rw-r--r--extensions/WikiEditor/tests/selenium/WikiEditorConstants.php84
-rw-r--r--extensions/WikiEditor/tests/selenium/WikiEditorSeleniumConfig.php24
-rw-r--r--extensions/WikiEditor/tests/selenium/WikiEditorTestSuite.php32
6 files changed, 274 insertions, 502 deletions
diff --git a/extensions/WikiEditor/tests/qunit/ext.wikiEditor.toolbar.test.js b/extensions/WikiEditor/tests/qunit/ext.wikiEditor.toolbar.test.js
new file mode 100644
index 00000000..674b5e16
--- /dev/null
+++ b/extensions/WikiEditor/tests/qunit/ext.wikiEditor.toolbar.test.js
@@ -0,0 +1,274 @@
+( function ( $ ) {
+ QUnit.module( 'ext.wikiEditor.toolbar', QUnit.newMwEnvironment( {
+ setup: function () {
+ var $fixture = $( '#qunit-fixture' );
+ var $target = $( '<textarea id="wpTextBox1">' );
+ this.$target = $target;
+ $fixture.append( $target );
+ $target.wikiEditor( 'addModule', 'toolbar' );
+ this.$ui = $target.data( 'wikiEditor-context' ).$ui;
+ }
+ } ) );
+
+ QUnit.test( 'Toolbars', 16, function ( assert ) {
+ // Add toolbar section
+ var data = {
+ sections: {
+ emoticons: {
+ type: 'toolbar',
+ label: 'Emoticons'
+ }
+ }
+ };
+ assert.equal( this.$ui.find( '*[rel="emoticons"].section' ).length, 0, 'Before adding toolbar section' );
+ this.$target.wikiEditor( 'addToToolbar', data );
+ assert.equal( this.$ui.find( '*[rel="emoticons"].section' ).length, 1, 'After adding toolbar section' );
+
+ // Add toolbar group
+ data = {
+ section: 'emoticons',
+ groups: {
+ faces: {
+ label: 'Faces'
+ }
+ }
+ };
+ assert.equal( this.$ui.find( '*[rel="emoticons"].section *[rel="faces"].group' ).length, 0, 'Before adding toolbar group' );
+ this.$target.wikiEditor( 'addToToolbar', data );
+ assert.equal( this.$ui.find( '*[rel="emoticons"].section *[rel="faces"].group' ).length, 1, 'After adding toolbar group' );
+
+ // Add button tool
+ data = {
+ section: 'emoticons',
+ group: 'faces',
+ tools: {
+ smile: {
+ label: 'Smile!',
+ type: 'button',
+ icon: 'http://upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
+ action: {
+ type: 'encapsulate',
+ options: {
+ pre: ':)'
+ }
+ }
+ }
+ }
+ };
+ assert.equal( this.$ui.find( '*[rel="emoticons"].section *[rel="faces"].group *[rel="smile"].tool' ).length, 0, 'Before adding button' );
+ this.$target.wikiEditor( 'addToToolbar', data );
+ assert.equal( this.$ui.find( '*[rel="emoticons"].section *[rel="faces"].group *[rel="smile"].tool' ).length, 1, 'After adding button' );
+
+ // Remove button tool
+ data = {
+ section: 'emoticons',
+ group: 'faces',
+ tool: 'smile'
+ };
+ assert.equal( this.$ui.find( '*[rel="emoticons"].section *[rel="faces"].group *[rel="smile"].tool' ).length, 1, 'Before removing button' );
+ this.$target.wikiEditor( 'removeFromToolbar', data );
+ assert.equal( this.$ui.find( '*[rel="emoticons"].section *[rel="faces"].group *[rel="smile"].tool' ).length, 0, 'After removing button' );
+
+ // Add select tool
+ data = {
+ section: 'emoticons',
+ group: 'faces',
+ tools: {
+ icons: {
+ label: 'Icons',
+ type: 'select',
+ list: {
+ wink : {
+ label: 'Wink',
+ action: {
+ type: 'encapsulate',
+ options: {
+ pre: ';)'
+ }
+ }
+ },
+ frown : {
+ label: 'Frown',
+ action: {
+ type: 'encapsulate',
+ options: {
+ pre: ':('
+ }
+ }
+ },
+ bigSmile : {
+ label: 'Big smile',
+ action: {
+ type: 'encapsulate',
+ options: {
+ pre: ':D'
+ }
+ }
+ }
+ }
+ }
+ }
+ };
+ assert.equal( this.$ui.find( '*[rel="emoticons"].section *[rel="faces"].group *[rel="icons"].tool' ).length, 0, 'Before adding select' );
+ this.$target.wikiEditor( 'addToToolbar', data );
+ assert.equal( this.$ui.find( '*[rel="emoticons"].section *[rel="faces"].group *[rel="icons"].tool' ).length, 1, 'After adding select' );
+
+ // Remove select tool
+ data = {
+ section: 'emoticons',
+ group: 'faces',
+ tool: 'icons'
+ };
+ assert.equal( this.$ui.find( '*[rel="emoticons"].section *[rel="faces"].group *[rel="icons"].tool' ).length, 1, 'Before removing select' );
+ this.$target.wikiEditor( 'removeFromToolbar', data );
+ assert.equal( this.$ui.find( '*[rel="emoticons"].section *[rel="faces"].group *[rel="icons"].tool' ).length, 0, 'After removing select' );
+
+ // Remove toolbar group
+ data = {
+ section: 'emoticons',
+ group: 'faces'
+ };
+ assert.equal( this.$ui.find( '*[rel="emoticons"].section *[rel="faces"].group' ).length, 1, 'Before removing toolbar group' );
+ this.$target.wikiEditor( 'removeFromToolbar', data );
+ assert.equal( this.$ui.find( '*[rel="emoticons"].section *[rel="faces"].group' ).length, 0, 'After removing toolbar group' );
+
+ // Remove toolbar section
+ data = {
+ section: 'emoticons'
+ };
+ assert.equal( this.$ui.find( '*[rel="emoticons"].section' ).length, 1, 'Before removing toolbar section' );
+ this.$target.wikiEditor( 'removeFromToolbar', data );
+ assert.equal( this.$ui.find( '*[rel="emoticons"].section' ).length, 0, 'After removing toolbar section' );
+ } );
+
+ QUnit.test( 'Booklets', 20, function ( assert ) {
+ // Add booklet section
+ var data = {
+ sections: {
+ info: {
+ type: 'booklet',
+ label: 'Info'
+ }
+ }
+ };
+ assert.equal( this.$ui.find( '*[rel="info"].section' ).length, 0, 'Before adding booklet section' );
+ this.$target.wikiEditor( 'addToToolbar', data );
+ assert.equal( this.$ui.find( '*[rel="info"].section' ).length, 1, 'After adding booklet section' );
+
+ // Add table page
+ data = {
+ section: 'info',
+ pages: {
+ colors: {
+ layout: 'table',
+ label: 'Colors',
+ headings: [
+ { text: 'Name' },
+ { text: 'Temperature' },
+ { text: 'Swatch' }
+ ]
+ }
+ }
+ };
+ assert.equal( this.$ui.find( '*[rel="info"].section *[rel="colors"].page' ).length, 0, 'Before adding table page' );
+ this.$target.wikiEditor( 'addToToolbar', data );
+ assert.equal( this.$ui.find( '*[rel="info"].section *[rel="colors"].page' ).length, 1, 'After adding table page' );
+
+ // Add table rows
+ data = {
+ section: 'info',
+ page: 'colors',
+ rows: [
+ {
+ name: { text: 'Red' },
+ temp: { text: 'Warm' },
+ swatch: { html: '<div style="width: 10px; height: 10px; background-color: red;">' }
+ },
+ {
+ name: { text: 'Blue' },
+ temp: { text: 'Cold' },
+ swatch: { html: '<div style="width: 10px; height: 10px; background-color: blue;">' }
+ },
+ {
+ name: { text: 'Silver' },
+ temp: { text: 'Neutral' },
+ swatch: { html: '<div style="width: 10px; height: 10px; background-color: silver;">' }
+ }
+ ]
+ };
+ assert.equal( this.$ui.find( '*[rel="info"].section *[rel="colors"].page tr td' ).length, 0, 'Before adding table rows' );
+ this.$target.wikiEditor( 'addToToolbar', data );
+ assert.equal( this.$ui.find( '*[rel="info"].section *[rel="colors"].page tr td' ).length, 9, 'After adding table rows' );
+
+ // Remove table row
+ data = {
+ section: 'info',
+ page: 'colors',
+ row: 0
+ };
+ assert.equal( this.$ui.find( '*[rel="info"].section *[rel="colors"].page tr td' ).length, 9, 'Before removing table row' );
+ this.$target.wikiEditor( 'removeFromToolbar', data );
+ assert.equal( this.$ui.find( '*[rel="info"].section *[rel="colors"].page tr td' ).length, 6, 'After removing table row' );
+
+ // Remove table page
+ data = {
+ section: 'info',
+ page: 'colors'
+ };
+ assert.equal( this.$ui.find( '*[rel="info"].section *[rel="colors"].page' ).length, 1, 'Before removing table page' );
+ this.$target.wikiEditor( 'removeFromToolbar', data );
+ assert.equal( this.$ui.find( '*[rel="info"].section *[rel="colors"].page' ).length, 0, 'After removing table page' );
+
+ // Add character page
+ data = {
+ section: 'info',
+ pages: {
+ emoticons: {
+ layout: 'characters',
+ label: 'Emoticons'
+ }
+ }
+ };
+ assert.equal( this.$ui.find( '*[rel="info"].section *[rel="emoticons"].page' ).length, 0, 'Before adding character page' );
+ this.$target.wikiEditor( 'addToToolbar', data );
+ assert.equal( this.$ui.find( '*[rel="info"].section *[rel="emoticons"].page' ).length, 1, 'After adding character page' );
+
+ // Add characters
+ data = {
+ section: 'info',
+ page: 'emoticons',
+ characters: [ ':)', ':))', ':(', '<3', ';)' ]
+ };
+ assert.equal( this.$ui.find( '*[rel="info"].section *[rel="emoticons"].page *[rel=":))"]' ).length, 0, 'Before adding characters' );
+ this.$target.wikiEditor( 'addToToolbar', data );
+ assert.equal( this.$ui.find( '*[rel="info"].section *[rel="emoticons"].page *[rel=":))"]' ).length, 1, 'After adding characters' );
+
+ // Remove character
+ data = {
+ section: 'info',
+ page: 'emoticons',
+ character: ':))'
+ };
+ assert.equal( this.$ui.find( '*[rel="info"].section *[rel="emoticons"].page *[rel=":))"]' ).length, 1, 'Before removing character' );
+ this.$target.wikiEditor( 'removeFromToolbar', data );
+ assert.equal( this.$ui.find( '*[rel="info"].section *[rel="emoticons"].page *[rel=":))"]' ).length, 0, 'After removing character' );
+
+ // Remove character page
+ data = {
+ section: 'info',
+ page: 'emoticons'
+ };
+ assert.equal( this.$ui.find( '*[rel="info"].section *[rel="emoticons"].page' ).length, 1, 'Before removing character page' );
+ this.$target.wikiEditor( 'removeFromToolbar', data );
+ assert.equal( this.$ui.find( '*[rel="info"].section *[rel="emoticons"].page' ).length, 0, 'After removing character page' );
+
+ // Remove booklet section
+ data = {
+ section: 'info'
+ };
+ assert.equal( this.$ui.find( '*[rel="info"].section' ).length, 1, 'Before removing booklet section' );
+ this.$target.wikiEditor( 'removeFromToolbar', data );
+ assert.equal( this.$ui.find( '*[rel="info"].section' ).length, 0, 'After removing booklet section' );
+ } );
+
+}( jQuery ) );
diff --git a/extensions/WikiEditor/tests/selenium/WikiDialogs_Links.php b/extensions/WikiEditor/tests/selenium/WikiDialogs_Links.php
deleted file mode 100644
index 7153f49f..00000000
--- a/extensions/WikiEditor/tests/selenium/WikiDialogs_Links.php
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-require_once 'WikiDialogs_Links_Setup.php';
-/**
- * Description of WikiNewPageDialogs
- *
- * @author bhagyag, pdhanda
- *
- * This test case is part of the WikiEditorTestSuite.
- * Configuration for these tests are dosumented as part of extensions/WikiEditor/tests/selenium/WikiEditorTestSuite.php
- *
- */
-class WikiDialogs_Links extends WikiDialogs_Links_Setup {
- // Set up the testing environment
- function setup() {
- parent::setUp();
- parent::doCreateInternalTestPageIfMissing();
- }
-
- function tearDown() {
- parent::doLogout();
- parent::tearDown();
- }
-
- // Create a new page temporary
- function createNewPage() {
- parent::doOpenLink();
- parent::login();
- parent::doCreateNewPageTemporary();
- }
-
- // Add a internal link and verify
- function testInternalLink() {
- $this->createNewPage();
- parent::verifyInternalLink();
- }
-
- // Add a internal link with different display text and verify
- function testInternalLinkWithDisplayText() {
- $this->createNewPage();
- parent::verifyInternalLinkWithDisplayText();
- }
-
- // Add a internal link with blank display text and verify
- function testInternalLinkWithBlankDisplayText() {
- $this->createNewPage();
- parent::verifyInternalLinkWithBlankDisplayText();
- }
-
- // Add external link and verify
- function testExternalLink() {
- $this->createNewPage();
- parent::verifyExternalLink();
- }
-
- // Add external link with different display text and verify
- function testExternalLinkWithDisplayText( ) {
- $this->createNewPage();
- parent::verifyExternalLinkWithDisplayText();
- }
-
- // Add external link with Blank display text and verify
- function testExternalLinkWithBlankDisplayText() {
- $this->createNewPage();
- parent::verifyExternalLinkWithBlankDisplayText();
- }
-
-}
diff --git a/extensions/WikiEditor/tests/selenium/WikiDialogs_Links_Setup.php b/extensions/WikiEditor/tests/selenium/WikiDialogs_Links_Setup.php
deleted file mode 100644
index 352ebec0..00000000
--- a/extensions/WikiEditor/tests/selenium/WikiDialogs_Links_Setup.php
+++ /dev/null
@@ -1,295 +0,0 @@
-<?php
-include( "WikiEditorConstants.php" );
-/**
- * This test case will be handling the Wiki Tool bar Dialog functions
- * Date : Apr - 2010
- * @author : BhagyaG - Calcey
- */
-class WikiDialogs_Links_Setup extends SeleniumTestCase {
-
- // Open the page.
- function doOpenLink() {
- $this->open( $this->getUrl() . '/index.php' );
- $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
- }
-
- // Expand advance tool bar section if its not
- function doExpandAdvanceSection() {
- if ( !$this->isTextPresent( TEXT_HEADING ) ) {
- $this->click( LINK_ADVANCED );
- }
- }
-
- // Log out from the application
- function doLogout() {
- $this->open( $this->getUrl() . '/index.php' );
- if ( $this->isTextPresent( TEXT_LOGOUT ) ) {
- $this->click( LINK_LOGOUT );
- $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
- $this->assertEquals( TEXT_LOGOUT_CONFIRM, $this->getText( LINK_LOGIN ) );
- $this->open( $this->getUrl() . '/index.php' );
- $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
- }
- }
-
- // Create a temporary fixture page
- function doCreateInternalTestPageIfMissing() {
- $this->type( INPUT_SEARCH_BOX, WIKI_INTERNAL_LINK );
- $this->click( BUTTON_SEARCH );
- $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
- $this->click( LINK_START . WIKI_INTERNAL_LINK );
- $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
- $location = $this->getLocation() . "\n";
- if ( strpos( $location, '&redlink=1' ) !== false ) {
- $this->type( TEXT_EDITOR, "Test fixture page. No real content here" );
- $this->click( BUTTON_SAVE_WATCH );
- $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
- $this->assertTrue( $this->isTextPresent( WIKI_INTERNAL_LINK ),
- $this->getText( TEXT_PAGE_HEADING ) );
- }
- }
-
- // Create a temporary new page
- function doCreateNewPageTemporary() {
- $this->type( INPUT_SEARCH_BOX, WIKI_TEMP_NEWPAGE );
- $this->click( BUTTON_SEARCH );
- $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
- $this->click( LINK_START . WIKI_TEMP_NEWPAGE );
- $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
- }
-
- // Add a internal link and verify
- function verifyInternalLink() {
- $this->type( TEXT_EDITOR, "" );
- $this->click( LINK_ADDLINK );
- $this->waitForPopup( 'addLink', WIKI_TEST_WAIT_TIME );
- $this->type( TEXT_LINKNAME, ( WIKI_INTERNAL_LINK ) );
- $this->assertTrue( $this->isElementPresent( ICON_PAGEEXISTS ), 'Element ' . ICON_PAGEEXISTS . 'Not found' );
- $this->assertEquals( "on", $this->getValue( OPT_INTERNAL ) );
- $this->click( BUTTON_INSERTLINK );
- $this->click( LINK_PREVIEW );
- $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
- $this->assertEquals( ( WIKI_INTERNAL_LINK ), $this->getText( LINK_START . WIKI_INTERNAL_LINK ) );
- $this->click( LINK_START . WIKI_INTERNAL_LINK );
- $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
- $this->assertTrue( $this->isTextPresent( WIKI_INTERNAL_LINK ), $this->getText( TEXT_PAGE_HEADING ) );
- }
-
- // Add a internal link with different display text and verify
- function verifyInternalLinkWithDisplayText() {
- $this->type( TEXT_EDITOR, "" );
- $this->click( LINK_ADDLINK );
- $this->waitForPopup( 'addLink', WIKI_TEST_WAIT_TIME );
- $this->type( TEXT_LINKNAME, WIKI_INTERNAL_LINK );
- $this->type ( TEXT_LINKDISPLAYNAME, WIKI_INTERNAL_LINK . TEXT_LINKDISPLAYNAME_APPENDTEXT );
- $this->assertTrue( $this->isElementPresent( ICON_PAGEEXISTS ) );
- $this->assertEquals( "on", $this->getValue( OPT_INTERNAL ) );
- $this->click( BUTTON_INSERTLINK );
- $this->click( LINK_PREVIEW );
- $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
- $this->assertEquals( WIKI_INTERNAL_LINK . TEXT_LINKDISPLAYNAME_APPENDTEXT,
- $this->getText( LINK_START . WIKI_INTERNAL_LINK . TEXT_LINKDISPLAYNAME_APPENDTEXT ) );
- $this->click( LINK_START . WIKI_INTERNAL_LINK . TEXT_LINKDISPLAYNAME_APPENDTEXT );
- $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
- $this->assertTrue( $this->isTextPresent( WIKI_INTERNAL_LINK ), $this->getText( TEXT_PAGE_HEADING ) );
-
- }
-
- // Add a internal link with blank display text and verify
- function verifyInternalLinkWithBlankDisplayText() {
- $this->type( TEXT_EDITOR, "" );
- $this->click( LINK_ADDLINK );
- $this->waitForPopup( 'addLink', WIKI_TEST_WAIT_TIME );
- $this->type( TEXT_LINKNAME, WIKI_INTERNAL_LINK );
- $this->type( TEXT_LINKDISPLAYNAME, "" );
- $this->assertTrue( $this->isElementPresent( ICON_PAGEEXISTS ) );
- $this->assertEquals( "on", $this->getValue( OPT_INTERNAL ) );
- $this->click( BUTTON_INSERTLINK );
- $this->click( LINK_PREVIEW );
- $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
- $this->assertEquals( WIKI_INTERNAL_LINK, $this->getText( LINK_START . WIKI_INTERNAL_LINK ) );
- $this->click( LINK_START . WIKI_INTERNAL_LINK );
- $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
- $this->assertEquals( WIKI_INTERNAL_LINK, $this->getText( TEXT_PAGE_HEADING ) );
-
- }
-
- // Add external link and verify
- function verifyExternalLink() {
- $this->type( LINK_PREVIEW, "" );
- $this->click( LINK_ADDLINK );
- $this->type( TEXT_LINKNAME, WIKI_EXTERNAL_LINK );
- $this->assertTrue( $this->isElementPresent( ICON_PAGEEXTERNAL ) );
- $this->assertEquals( "on", $this->getValue( OPT_EXTERNAL ) );
- $this->click( BUTTON_INSERTLINK );
- $this->click( LINK_PREVIEW );
- $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
- $this->assertEquals( WIKI_EXTERNAL_LINK, $this->getText( LINK_START . WIKI_EXTERNAL_LINK ) );
-
- $this->click( LINK_START . WIKI_EXTERNAL_LINK );
- $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
- $this->assertEquals( WIKI_EXTERNAL_LINK_TITLE, $this->getTitle() );
- }
-
- // Add external link with different display text and verify
- function verifyExternalLinkWithDisplayText() {
- $this->type( TEXT_EDITOR, "" );
- $this->click( LINK_ADDLINK );
- $this->type( TEXT_LINKNAME, WIKI_EXTERNAL_LINK );
- $this->type( TEXT_LINKDISPLAYNAME, WIKI_EXTERNAL_LINK_TITLE );
- $this->assertTrue( $this->isElementPresent( ICON_PAGEEXTERNAL ) );
- $this->assertEquals( "on", $this->getValue( OPT_EXTERNAL ) );
- $this->click( BUTTON_INSERTLINK );
- $this->click( LINK_PREVIEW );
- $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
- $this->assertEquals( WIKI_EXTERNAL_LINK_TITLE, $this->getText( LINK_START . WIKI_EXTERNAL_LINK_TITLE ) );
- $this->click( LINK_START . ( WIKI_EXTERNAL_LINK_TITLE ) );
- $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
- $this->assertEquals( WIKI_EXTERNAL_LINK_TITLE , $this->getTitle() );
- }
-
- // Add external link with Blank display text and verify
- function verifyExternalLinkWithBlankDisplayText() {
- $this->type( TEXT_EDITOR, "" );
- $this->click( LINK_ADDLINK );
- $this->type( TEXT_LINKNAME, WIKI_EXTERNAL_LINK );
- $this->type( TEXT_LINKDISPLAYNAME, "" );
- $this->assertTrue( $this->isElementPresent( ICON_PAGEEXTERNAL ) );
- $this->assertEquals( "on", $this->getValue( OPT_EXTERNAL ) );
- $this->click( BUTTON_INSERTLINK );
- $this->click( LINK_PREVIEW );
- $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
- $this->assertEquals( "[1]", $this->getText( LINK_START . "[1]" ) );
- $this->click( LINK_START . "[1]" );
- $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
- $this->assertEquals( WIKI_EXTERNAL_LINK_TITLE, $this->getTitle() );
- }
-
- // Add a table and verify
- function verifyCreateTable() {
- $WIKI_TABLE_ROW = 2;
- $WIKI_TABLE_COL = "5";
- $this->doExpandAdvanceSection();
- $this->type( TEXT_EDITOR, "" );
- $this->click( LINK_ADDTABLE );
- $this->click( CHK_SORT );
- $this->type( TEXT_ROW, $WIKI_TABLE_ROW );
- $this->type( TEXT_COL, $WIKI_TABLE_COL );
- $this->click( BUTTON_INSERTABLE );
- $this->click( CHK_SORT );
- $this->click( LINK_PREVIEW );
- $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
- $WIKI_TABLE_ROW = $WIKI_TABLE_ROW + 1;
- $this->assertTrue( $this->isElementPresent( TEXT_TABLEID_OTHER .
- TEXT_VALIDATE_TABLE_PART1 . $WIKI_TABLE_ROW .
- TEXT_VALIDATE_TABLE_PART2 . $WIKI_TABLE_COL .
- TEXT_VALIDATE_TABLE_PART3 ) );
- }
-
- // Add a table and verify only with head row
- function verifyCreateTableWithHeadRow() {
- $WIKI_TABLE_ROW = 3;
- $WIKI_TABLE_COL = "4";
- $this->doExpandAdvanceSection();
- $this->type( TEXT_EDITOR, "" );
- $this->click( LINK_ADDTABLE );
- $this->click( CHK_BOARDER );
- $this->type( TEXT_ROW, $WIKI_TABLE_ROW );
- $this->type( TEXT_COL, $WIKI_TABLE_COL );
- $this->click( BUTTON_INSERTABLE );
- $this->click( LINK_PREVIEW );
- $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
- $WIKI_TABLE_ROW = $WIKI_TABLE_ROW + 1;
- $this->assertTrue( $this->isElementPresent( TEXT_TABLEID_OTHER .
- TEXT_VALIDATE_TABLE_PART1 . $WIKI_TABLE_ROW .
- TEXT_VALIDATE_TABLE_PART2 . $WIKI_TABLE_COL .
- TEXT_VALIDATE_TABLE_PART3 ) );
- }
-
- // Add a table and verify only with borders
- function verifyCreateTableWithBorders() {
- $WIKI_TABLE_ROW = "4";
- $WIKI_TABLE_COL = "6";
- $this->type( TEXT_EDITOR, "" );
- $this->click( LINK_ADDTABLE );
- $this->click( CHK_HEADER );
- $this->type( TEXT_ROW, $WIKI_TABLE_ROW );
- $this->type( TEXT_COL, $WIKI_TABLE_COL );
- $this->click( BUTTON_INSERTABLE );
- $this->click( CHK_HEADER );
- $this->click( LINK_PREVIEW );
- $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
- $this->assertTrue( $this->isElementPresent( TEXT_TABLEID_OTHER .
- TEXT_VALIDATE_TABLE_PART1 . $WIKI_TABLE_ROW .
- TEXT_VALIDATE_TABLE_PART2 . $WIKI_TABLE_COL .
- TEXT_VALIDATE_TABLE_PART3 ) );
- }
-
- // Add a table and verify only with sort row
- function verifyCreateTableWithSortRow() {
- $WIKI_TABLE_ROW = "2";
- $WIKI_TABLE_COL = "5";
- $this->type( TEXT_EDITOR, "" );
- $this->click( LINK_ADDTABLE );
- $this->click( CHK_HEADER );
- $this->click( CHK_BOARDER );
- $this->click( CHK_SORT );
- $this->type( TEXT_ROW, $WIKI_TABLE_ROW );
- $this->type( TEXT_COL, $WIKI_TABLE_COL );
- $this->click( BUTTON_INSERTABLE );
- $this->click( CHK_HEADER );
- $this->click( CHK_BOARDER );
- $this->click( CHK_SORT );
- $this->click( LINK_PREVIEW );
- $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
- $this->assertTrue( $this->isElementPresent( TEXT_TABLEID_WITHALLFEATURES .
- TEXT_VALIDATE_TABLE_PART1 . $WIKI_TABLE_ROW .
- TEXT_VALIDATE_TABLE_PART2 . $WIKI_TABLE_COL .
- TEXT_VALIDATE_TABLE_PART3 ) );
- }
-
- // Add a table without headers,borders and sort rows
- function verifyCreateTableWithNoSpecialEffects() {
- $WIKI_TABLE_ROW = "6";
- $WIKI_TABLE_COL = "2";
- $this->
- $this->doExpandAdvanceSection();
- $this->type( TEXT_EDITOR, "" );
- $this->click( LINK_ADDTABLE );
- $this->click( CHK_BOARDER );
- $this->click( CHK_HEADER );
- $this->type( TEXT_ROW, $WIKI_TABLE_ROW );
- $this->type( TEXT_COL, $WIKI_TABLE_COL );
- $this->click( BUTTON_INSERTABLE );
- $this->click( CHK_BOARDER );
- $this->click( CHK_HEADER );
- $this->click( INK_PREVIEW );
- $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
- $this->assertTrue( $this->isElementPresent( TEXT_TABLEID_OTHER .
- TEXT_VALIDATE_TABLE_PART1 . $WIKI_TABLE_ROW .
- TEXT_VALIDATE_TABLE_PART2 . $WIKI_TABLE_COL .
- TEXT_VALIDATE_TABLE_PART3 ) );
- }
-
- // Add a table with headers,borders and sort rows
- function verifyCreateTableWithAllSpecialEffects() {
- $WIKI_TABLE_ROW = 6;
- $WIKI_TABLE_COL = "2";
- $this->doExpandAdvanceSection();
- $this->type( TEXT_EDITOR, "" );
- $this->click( LINK_ADDTABLE );
- $this->click( CHK_SORT );
- $this->type( TEXT_ROW, $WIKI_TABLE_ROW );
- $this->type( TEXT_COL, $WIKI_TABLE_COL );
- $this->click( BUTTON_INSERTABLE );
- $this->click( CHK_SORT );
- $this->click( LINK_PREVIEW );
- $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME );
- $WIKI_TABLE_ROW = $WIKI_TABLE_ROW + 1;
- $this->assertTrue( $this->isElementPresent( TEXT_TABLEID_WITHALLFEATURES .
- TEXT_VALIDATE_TABLE_PART1 . $WIKI_TABLE_ROW .
- TEXT_VALIDATE_TABLE_PART2 . $WIKI_TABLE_COL .
- TEXT_VALIDATE_TABLE_PART3 ) );
- }
-
-}
diff --git a/extensions/WikiEditor/tests/selenium/WikiEditorConstants.php b/extensions/WikiEditor/tests/selenium/WikiEditorConstants.php
deleted file mode 100644
index 090f96bf..00000000
--- a/extensions/WikiEditor/tests/selenium/WikiEditorConstants.php
+++ /dev/null
@@ -1,84 +0,0 @@
-<?php
-define ( 'WIKI_TEST_WAIT_TIME', "3000" ); // Waiting time
-
-// tool bar, buttons , links
-// commonly using links
-define ( 'LINK_MAIN_PAGE', "link=Main page" );
-define ( 'LINK_RANDOM_PAGE', "link=Random article" );
-define ( 'TEXT_PAGE_HEADING', "firstHeading" );
-define ( 'LINK_START', "link=" );
-define ( 'LINK_EDITPAGE', "//li[@id='ca-edit']/a/span" );
-define ( 'TEXT_EDITOR', "wpTextbox1" );
-define ( 'LINK_PREVIEW', "wpPreview" );
-
-define ( 'WIKI_SEARCH_PAGE', "Hair (musical)" ); // Page name to search
-define ( 'WIKI_TEXT_SEARCH', "TV" ); // Text to search
-define ( 'WIKI_INTERNAL_LINK', "Wikieditor-Fixture-Page" ); // Exisiting page name to add as an internal tag
-define ( 'WIKI_EXTERNAL_LINK', "www.google.com" ); // External web site name
-define ( 'WIKI_EXTERNAL_LINK_TITLE', "Google" ); // Page title of the external web site name
-define ( 'WIKI_CODE_PATH', getcwd() ); // get the current path of the program
-define ( 'WIKI_SCREENSHOTS_PATH', "screenshots" ); // the folder the error screen shots will be saved
-define ( 'WIKI_SCREENSHOTS_TYPE', "png" ); // screen print type
-define ( 'WIKI_TEMP_NEWPAGE', "TestWikiPage" ); // temporary creating new page name
-// for WikiCommonFunction_TC
-
-// for WikiSearch_TC
-define ( 'INPUT_SEARCH_BOX', "searchInput" );
-define ( 'BUTTON_SEARCH', "mw-searchButton" );
-define ( 'TEXT_SEARCH_RESULT_HEADING', " - Search results - Wikipedia, the free encyclopedia" );
-
-// for WikiWatchUnWatch_TC
-define ( 'LINK_WATCH_PAGE', "link=Watch" );
-define ( 'LINK_WATCH_LIST', "link=My watchlist" );
-define ( 'LINK_WATCH_EDIT', "link=View and edit watchlist" );
-define ( 'LINK_UNWATCH', "link=Unwatch" );
-define ( 'BUTTON_WATCH', "wpWatchthis" );
-define ( 'BUTTON_SAVE_WATCH', "wpSave" );
-define ( 'TEXT_WATCH', "Watch" );
-define ( 'TEXT_UNWATCH', "Unwatch" );
-
-// for WikiCommonFunction_TC
-define ( 'TEXT_LOGOUT', "Log out" );
-define ( 'LINK_LOGOUT', "link=Log out" );
-define ( 'LINK_LOGIN', "link=Log in / create account" );
-define ( 'TEXT_LOGOUT_CONFIRM', "Log in / create account" );
-define ( 'INPUT_USER_NAME', "wpName1" );
-define ( 'INPUT_PASSWD', "wpPassword1" );
-define ( 'BUTTON_LOGIN', "wpLoginAttempt" );
-define ( 'TEXT_HEADING', "Heading" );
-define ( 'LINK_ADVANCED', "link=Advanced" );
-
-// for WikiDialogs_TC
-define ( 'LINK_ADDLINK', "//div[@id='wikiEditor-ui-toolbar']/div[1]/div[2]/span[2 ]" );
-define ( 'TEXT_LINKNAME', "wikieditor-toolbar-link-int-target" );
-define ( 'TEXT_LINKDISPLAYNAME', "wikieditor-toolbar-link-int-text" );
-define ( 'TEXT_LINKDISPLAYNAME_APPENDTEXT', " Test" );
-define ( 'ICON_PAGEEXISTS', "wikieditor-toolbar-link-int-target-status-exists" );
-define ( 'ICON_PAGEEXTERNAL', "wikieditor-toolbar-link-int-target-status-external" );
-define ( 'OPT_INTERNAL', "wikieditor-toolbar-link-type-int" );
-define ( 'OPT_EXTERNAL', "wikieditor-toolbar-link-type-ext" );
-define ( 'BUTTON_INSERTLINK', "//div[10]/div[11]/button[1]" );
-define ( 'LINK_ADDTABLE', "//div[@id='wikiEditor-ui-toolbar']/div[3]/div[1]/div[4]/span[2]" );
-define ( 'CHK_HEADER', "wikieditor-toolbar-table-dimensions-header" );
-define ( 'CHK_BOARDER', "wikieditor-toolbar-table-wikitable" );
-define ( 'CHK_SORT', "wikieditor-toolbar-table-sortable" );
-define ( 'TEXT_ROW', "wikieditor-toolbar-table-dimensions-rows" );
-define ( 'TEXT_COL', "wikieditor-toolbar-table-dimensions-columns" );
-define ( 'BUTTON_INSERTABLE', "//div[3]/button[1]" );
-define ( 'TEXT_HEADTABLE_TEXT', "Header text" );
-define ( 'TEXT_TABLEID_WITHALLFEATURES', "//table[@id='sortable_table_id_0']/tbody/" );
-define ( 'TEXT_TABLEID_OTHER', "//div[@id='wikiPreview']/table/tbody/" );
-define ( 'TEXT_VALIDATE_TABLE_PART1', "tr[" );
-define ( 'TEXT_VALIDATE_TABLE_PART2', "]/td[" );
-define ( 'TEXT_VALIDATE_TABLE_PART3', "]" );
-define ( 'LINK_SEARCH', "//div[@id='wikiEditor-ui-toolbar']/div[3]/div[1]/div[5]/span" );
-define ( 'INPUT_SEARCH', "wikieditor-toolbar-replace-search" );
-define ( 'INPUT_REPLACE', "wikieditor-toolbar-replace-replace" );
-define ( 'BUTTON_REPLACEALL', "//button[3]" );
-define ( 'BUTTON_REPLACENEXT', "//button[2]" );
-define ( 'BUTTON_CANCEL', "//button[4]" );
-define ( 'TEXT_PREVIEW_TEXT1', "//div[@id='wikiPreview']/p[1]" );
-define ( 'TEXT_PREVIEW_TEXT2', "//div[@id='wikiPreview']/p[2]" );
-define ( 'TEXT_PREVIEW_TEXT3', "//div[@id='wikiPreview']/p[3]" );
-
-
diff --git a/extensions/WikiEditor/tests/selenium/WikiEditorSeleniumConfig.php b/extensions/WikiEditor/tests/selenium/WikiEditorSeleniumConfig.php
deleted file mode 100644
index 137e67b0..00000000
--- a/extensions/WikiEditor/tests/selenium/WikiEditorSeleniumConfig.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-class WikiEditorSeleniumConfig {
-
- public static function getSettings( &$includeFiles, &$globalConfigs ) {
- $includes = array(
- 'extensions/Vector/Vector.php',
- 'extensions/WikiEditor/WikiEditor.php'
- );
- $configs = array(
- 'wgDefaultSkin' => 'vector',
- 'wgWikiEditorFeatures' => array(
- 'toolbar' => array( 'global' => true, 'user' => true ),
- 'dialogs' => array( 'global' => true, 'user' => true )
- ),
- 'wgVectorFeatures' => array(
- 'editwarning' => array( 'global' => false, 'user' => false )
- )
- );
- $includeFiles = array_merge( $includeFiles, $includes );
- $globalConfigs = array_merge( $globalConfigs, $configs );
- return true;
- }
-}
diff --git a/extensions/WikiEditor/tests/selenium/WikiEditorTestSuite.php b/extensions/WikiEditor/tests/selenium/WikiEditorTestSuite.php
deleted file mode 100644
index 14a8bf20..00000000
--- a/extensions/WikiEditor/tests/selenium/WikiEditorTestSuite.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-
-/**
- * To configure MW for these tests
- * 1) If you are running multiple test suites, add the following in LocalSettings.php
- * require_once("extensions/WikiEditor/tests/selenium/WikiEditorSeleniumConfig.php");
- * $wgSeleniumTestConfigs['WikiEditorTestSuite'] = 'WikiEditorSeleniumConfig::getSettings';
- * OR
- * 2) Add the following to your Localsettings.php
- * require_once( "$IP/extensions/Vector/Vector.php" );
- * require_once( "$IP/extensions/WikiEditor/WikiEditor.php" );
- * $wgDefaultSkin = 'vector';
- * $wgVectorFeatures['editwarning'] = array( 'global' => false, 'user' => false );
- * $wgWikiEditorFeatures['toolbar'] = array( 'global' => true, 'user' => true );
- * $wgWikiEditorFeatures['dialogs'] = array( 'global' => true, 'user' => true );
- *
- */
-class WikiEditorTestSuite extends SeleniumTestSuite
-{
- public function setUp() {
- $this->setLoginBeforeTests( false );
- parent::setUp();
- }
- public function addTests() {
- $testFiles = array(
- 'extensions/WikiEditor/tests/selenium/WikiDialogs_Links.php'
- );
- parent::addTestFiles( $testFiles );
- }
-
-
-}