2 class SeleniumTestCase
extends PHPUnit_Framework_TestCase
{ // PHPUnit_Extensions_SeleniumTestCase
5 public function setUp() {
7 $this->selenium
= Selenium
::getInstance();
10 public function tearDown() {
14 public function __call( $method, $args ) {
15 return call_user_func_array( array( $this->selenium
, $method ), $args );
18 public function assertSeleniumAttributeEquals( $attribute, $value ) {
19 $attr = $this->getAttribute( $attribute );
20 $this->assertEquals( $attr, $value );
23 public function assertSeleniumHTMLContains( $element, $text ) {
24 $innerHTML = $this->getText( $element );
26 $this->assertRegExp( "/$text/", $innerHTML );
29 //Common Funtions Added for Selenium Tests
31 public function getExistingPage(){
32 $this->open( $this->getUrl() .
33 '/index.php?title=Main_Page&action=edit' );
34 $this->type("searchInput", "new" );
35 $this->click("searchGoButton");
36 $this->waitForPageToLoad("30000");
39 public function getNewPage($pageName){
41 $this->open( $this->getUrl() .
42 '/index.php?title=Main_Page&action=edit' );
43 $this->type("searchInput", $pageName );
44 $this->click("searchGoButton");
45 $this->waitForPageToLoad("30000");
46 $this->click("link=".$pageName);
47 $this->waitForPageToLoad("600000");
51 // Loading the mediawiki editor
52 public function loadWikiEditor(){
53 $this->open( $this->getUrl() .
54 '/index.php?title=Main_Page&action=edit' );
57 // Clear the content of the mediawiki editor
58 public function clearWikiEditor(){
59 $this->type("wpTextbox1", "");
62 // Click on the 'Show preview' button of the mediawiki editor
63 public function clickShowPreviewBtn(){
64 $this->click("wpPreview");
67 // Click on the 'Save Page' button of the mediawiki editor
68 public function clickSavePageBtn(){
69 $this->click("wpSave");
72 // Click on the 'Edit' link
73 public function clickEditLink(){
74 $this->click("link=Edit");
75 $this->waitForPageToLoad("30000");
78 public function deletePage($pageName){
79 $isLinkPresent = False;
80 $this->open( $this->getUrl() .
81 '/index.php?title=Main_Page&action=edit' );
82 $this->click("link=Log out");
83 $this->waitForPageToLoad( "30000" );
84 $this->click( "link=Log in / create account" );
85 $this->waitForPageToLoad( "30000" );
86 $this->type( "wpName1", "nadeesha" );
87 $this->type( "wpPassword1", "12345" );
88 $this->click( "wpLoginAttempt" );
89 $this->waitForPageToLoad( "30000" );
90 $this->type( "searchInput", $pageName );
91 $this->click( "searchGoButton");
92 $this->waitForPageToLoad( "30000" );
94 $this->click( "link=Delete" );
95 $this->waitForPageToLoad( "30000" );
96 $this->click( "wpConfirmB" );
97 $this->waitForPageToLoad( "30000" );