Test file deleted from Calcey
[lhc/web/wiklou.git] / maintenance / tests / selenium / suites / DeletePageAdminTestCase.php
1 <?php
2 /*
3 * This test case is part of the SimpleSeleniumTestSuite.
4 * Configuration for these tests are dosumented as part of SimpleSeleniumTestSuite.php
5 */
6 class DeletePageAdminTestCase extends SeleniumTestCase{
7
8 // Verify adding a new page
9 public function testDeletePage() {
10 $this->open( $this->getUrl() .
11 '/index.php?title=Main_Page&action=edit' );
12 $this->click("link=Log out");
13 $this->waitForPageToLoad( "30000" );
14 $this->click( "link=Log in / create account" );
15 $this->waitForPageToLoad( "30000" );
16 $this->type( "wpName1", "nadeesha" );
17 $this->type( "wpPassword1", "12345" );
18 $this->click( "wpLoginAttempt" );
19 $this->waitForPageToLoad( "30000" );
20 $this->type( "searchInput", "new" );
21 $this->click( "searchGoButton");
22 $this->waitForPageToLoad( "30000" );
23
24 // Verify 'Delete' link displayed
25 $source = $this->gettext( "link=Delete" );
26 $correct = strstr ( $source, "Delete" );
27 try{
28 $this->assertEquals( $correct, true);
29 echo "\n Pass : 'Delete' link displayed \n";
30 } catch (PHPUnit_Framework_AssertionFailedError $e){
31 echo "\n Fail : 'Delete' link displayed \n";
32 }
33 $this->click( "link=Delete" );
34 $this->waitForPageToLoad( "30000" );
35
36 // Verify 'Delete' button available
37 $this->assertTrue($this->isElementPresent( "wpConfirmB" ));
38
39 try{
40 $this->assertTrue($this->isElementPresent( "wpConfirmB" ));
41 echo "\n Pass : 'Delete' button available \n";
42 } catch ( PHPUnit_Framework_AssertionFailedError $e ){
43 echo "\n Fail : 'Delete' button available \n";
44 }
45 $this->click( "wpConfirmB" );
46 $this->waitForPageToLoad( "30000" );
47
48 // Verify 'Action complete' text displayed
49 $source = $this->gettext( "firstHeading" );
50 $correct = strstr ( $source, "Action complete" );
51 try{
52 $this->assertEquals( $correct, true );
53 echo "\n Pass : 'Action complete' text displayed \n";
54 }catch ( PHPUnit_Framework_AssertionFailedError $e ){
55 echo "\n Fail : 'Action complete' text displayed \n";
56 }
57
58 // Verify '<Page Name> has been deleted. See deletion log for a record of recent deletions.' text displayed
59 $source = $this->gettext( "//div[@id='bodyContent']/p[1]" );
60 $correct = strstr ( $source, "\"New\" has been deleted. See deletion log for a record of recent deletions." );
61 try{
62 $this->assertEquals( $correct, true );
63 echo "\n Pass : Page deleted successfully \n";
64 } catch ( PHPUnit_Framework_AssertionFailedError $e ){
65 echo "\n Fail : Page deleted successfully \n";
66 }
67 }
68 }