4 * Selenium server manager
8 * Copyright (C) 2010 Nadeesha Weerasinghe <nadeesha@calcey.com>
9 * http://www.calcey.com/
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 * http://www.gnu.org/copyleft/gpl.html
31 class DeletePageAdminTestCase
extends SeleniumTestCase
{
33 // Verify adding a new page
34 public function testDeletePage() {
40 $this->open( $this->getUrl().'/index.php?title=Main_Page' );
42 $this->type( "searchInput", $newPage );
43 $this->click( "searchGoButton" );
44 $this->waitForPageToLoad( SeleniumTestConstants
::WIKI_TEST_WAIT_TIME
);
45 $this->click( SeleniumTestConstants
::LINK_START
.$displayName );
46 $this->waitForPageToLoad( SeleniumTestConstants
::WIKI_TEST_WAIT_TIME
);
47 $this->type( SeleniumTestConstants
::TEXT_EDITOR
, $newPage." text" );
48 $this->click( SeleniumTestConstants
::BUTTON_SAVE
);
50 $this->open( $this->getUrl() .
51 '/index.php?title=Main_Page&action=edit' );
52 $this->click( SeleniumTestConstants
::LINK_START
."Log out" );
53 $this->waitForPageToLoad( SeleniumTestConstants
::WIKI_TEST_WAIT_TIME
);
54 $this->click( SeleniumTestConstants
::LINK_START
."Log in / create account" );
55 $this->waitForPageToLoad( SeleniumTestConstants
::WIKI_TEST_WAIT_TIME
);
57 $this->type( "wpName1", $this->selenium
->getUser() );
58 $this->type( "wpPassword1", $this->selenium
->getPass() );
59 $this->click( "wpLoginAttempt" );
60 $this->waitForPageToLoad( SeleniumTestConstants
::WIKI_TEST_WAIT_TIME
);
61 $this->type( "searchInput", "new" );
62 $this->click( "searchGoButton");
63 $this->waitForPageToLoad( SeleniumTestConstants
::WIKI_TEST_WAIT_TIME
);
65 // Verify 'Delete' link displayed
66 $source = $this->gettext( SeleniumTestConstants
::LINK_START
."Delete" );
67 $correct = strstr ( $source, "Delete" );
68 $this->assertEquals($correct, true );
70 $this->click( SeleniumTestConstants
::LINK_START
."Delete" );
71 $this->waitForPageToLoad( SeleniumTestConstants
::WIKI_TEST_WAIT_TIME
);
73 // Verify 'Delete' button available
74 $this->assertTrue($this->isElementPresent( "wpConfirmB" ));
76 $this->click( "wpConfirmB" );
77 $this->waitForPageToLoad( SeleniumTestConstants
::WIKI_TEST_WAIT_TIME
);
79 // Verify 'Action complete' text displayed
80 $source = $this->gettext( "firstHeading" );
81 $correct = strstr ( $source, "Action complete" );
82 $this->assertEquals( $correct, true );
84 // Verify '<Page Name> has been deleted. See deletion log for a record of recent deletions.' text displayed
85 $source = $this->gettext( "//div[@id='bodyContent']/p[1]" );
86 $correct = strstr ( $source, "\"New\" has been deleted. See deletion log for a record of recent deletions." );
87 $this->assertEquals( $correct, true );