Browse Source

Add acceptance tests structure

Adam Bukowski 2 years ago
parent
commit
e0bb25e42d

+ 2
- 0
.gitignore View File

@@ -25,3 +25,5 @@ Thumbs.db
25 25
 # Composer packages directory
26 26
 vendor
27 27
 !modules/CRM/Roundcube/RC/vendor
28
+
29
+tests/config.yml

+ 1
- 0
codeception.yml View File

@@ -14,6 +14,7 @@ extensions:
14 14
         - Codeception\Extension\RunFailed
15 15
 params:
16 16
     - env
17
+    - tests/config.yml
17 18
 modules:
18 19
     config:
19 20
         Db:

+ 10
- 0
tests/_support/AcceptanceTester.php View File

@@ -23,4 +23,14 @@ class AcceptanceTester extends \Codeception\Actor
23 23
    /**
24 24
     * Define custom actions here
25 25
     */
26
+
27
+    /**
28
+     * Wait for EPESI to finish request
29
+     *
30
+     * @param int $time
31
+     */
32
+    public function waitForEpesi($time = 60)
33
+    {
34
+        $this->waitForJS('return Epesi.procOn == 0;', $time);
35
+    }
26 36
 }

+ 3
- 2
tests/acceptance.suite.yml View File

@@ -7,6 +7,7 @@
7 7
 class_name: AcceptanceTester
8 8
 modules:
9 9
     enabled:
10
-        - PhpBrowser:
11
-            url: http://localhost/myapp
10
+        - WebDriver:
11
+            url: %URL%
12
+            browser: phantomjs
12 13
         - \Helper\Acceptance

+ 11
- 0
tests/acceptance/LoginCept.php View File

@@ -0,0 +1,11 @@
1
+<?php 
2
+$I = new AcceptanceTester($scenario);
3
+$I->wantTo('Login');
4
+$I->amOnPage('/');
5
+$I->waitForEpesi();
6
+$I->see('username');
7
+$I->fillField('username', 'admin');
8
+$I->fillField('password', 'admin1');
9
+$I->click('submit_button');
10
+$I->waitForEpesi();
11
+$I->seeElement('.logged_as');

+ 3
- 0
tests/config.example.yml View File

@@ -0,0 +1,3 @@
1
+# Example config file. Copy to config.yml
2
+
3
+URL: "http://localhost/epesi/"

Loading…
Cancel
Save