summaryrefslogtreecommitdiff
path: root/tests/selenium/README
blob: db6fc8abfc6fad71acf38f057e805e16886b1bb7 (plain)
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
HowTo run the tests
~~~~~~~~~~~~~~~~~~~

1. Create & configure your ./tests/selenium/config.test.php (See sample one in ./tests/selenium/config.test.php-dist)
2. Make sure "$conf['show_system']" is set to "true" in your "./conf/config.inc.php"
3. Open your browser and go to http://$webUrl/
Where $webUrl is the value set in your ./tests/selenium/config.inc.php
4. Click on "Selenium tests" on the PPA intro page & run the tests using the "Selenium TestRunner" buttons in the top-right frame.

Enjoy the tests.


HowTo write new tests
~~~~~~~~~~~~~~~~~~~~~

Normally, the selenium's static HTML tests files cannot behave differently in regard to the PG backend where the tests are run on. In order to address
this issue we are using PHP scripts that connect to each backends using the PPA database classes and allow you to use their methods,
and especially the $data->has*() ones,  through the $data variable like in any other ppa script.

TestSuite.php is the test suite script that builds the list of tests groups (top left frame).

1. How TestSuite.php is working and why
TestSuite.php script is processing the test-builders scripts from ./tests/selenium/src in alphanumeric order. That's why each
test-builder's name should follow these rules: begin with 2numeric number, then -, then the script name (ex. 01-test1.php or 46-test46.php).

It allows to enforce the order the scripts will be run during the testSuite. This way, column's tests could be run *after* the table's tests
in the test suite and use the previous created tables.

2. how test-builder are working

These scripts are included and executed in TestSuite.php in alphanumeric order. See comments in file ./tests/selenium/src/skeleton.php-dist
which is a template of test-builder.
When executed from TestSuite.php, test-builders should:
- create a "TestBuilder" instance which gonna helps write HTML tests quickly. 
	The constructor takes the following arguments:
	- HTML title of the page
	- Test description (appears on top of the tests table)

	$t = new TestBuilder('Index tests',
		'Create/Drop an unique Index'
	);

- once the TestBuilder instance is created, you can use it to write our tests.
	- You should use the login($username, $pass) and logout() methods to create appropriate steps to login/logout to the current
	server.
	- Each selenium actions are mapped (or should be) as methods. As instance, if you want to use the clickAndWait action, you should call the
	clickAndWait($locator) method. For the assertText, assertText($selector, $value), etc...
	- Use the addComment method to show comments anywhere in the tests page. Useful to explain what the next tests are going to do.