~fabiocbalbuquerque/sahana-agasti/web-services

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php

require_once dirname(__FILE__) . '/../functional/frontend/AgSeleniumTestCase.php';

/**
 * SmokeTest is a collection of the most basic functional tests, which
 * are executed only in a subset of all browsers as a QUICK sanity check.
 *
 * PHP Version 5
 *
 * LICENSE: This source file is subject to LGPLv3.0 license
 * that is available through the world-wide-web at the following URI:
 * http://www.gnu.org/copyleft/lesser.html
 *
 * @author Usman Akeju, CUNY SPS
 *
 * @todo make this a test suite that points to other tests cases.
 *
 *  Copyright of the Sahana Software Foundation, sahanafoundation.org
 */
class SmokeTest extends AgSeleniumTestCase
{

  /**
   * Attempts a login with correct credentials, and logout.
   *
   * @todo verify expected text at each page/action
   */
  public function testLoginLogoutSucceeds()
  {
    $this
        // opens the main URI
        ->open()//;$this
        // tries to login with correct credentials
        ->doLogin()
        // clicks around to each menu item
        //TODO: verify expected text is there
        ->navigateToHome()
        ->navigateToStaff()
        ->navigateToGis()
        ->navigateToFacility()
        ->navigateToOrganization()
        ->navigateToScenario()
        ->navigateToEvent()
        ->navigateToAdmin()
        ->navigateToHome()
        // and logs out
        ->doLogout();
  }

  /**
   * Attempts a login attempt with bad credentials,
   * verifies that it fails.
   */
  public function testLoginWithBadCredentialsFails()
  {
    $this
        // opens the main URI
        ->open()//;$this
        // tries to login with bad password
        ->tryLogin(self::$_appUsername, self::$_appPassword . '...NOT!')
        // verifies login failed
        ->assertTextNotPresent('Logged in as:');
  }

}