Overview
Comment:Tests JS
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 92cffd491bbcdd55a97857af0369bf324c20e35a
User & Date: bohwaz on 2014-04-01 16:16:33
Other Links: manifest | tags
Context
2014-04-01
16:39
Plus de tests check-in: ceaf3d311a user: bohwaz tags: trunk
16:16
Tests JS check-in: 92cffd491b user: bohwaz tags: trunk
16:14
Erreur de syntaxe, const = est un peu trop restreint check-in: f0de8cc942 user: bohwaz tags: trunk
Changes

Added tests/01-installation.js version [042769244d].







































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
/*jshint strict:false*/
/*global CasperError, casper, console, phantom, require*/

casper.test.begin('Installation', 3, function suite(test) {
    casper.start("http://localhost:8080/", function() {
        test.assertTitle("Garradin - Installation", "Page installation");
        test.assertExists('form', "Formulaire présent");
        this.fillSelectors('form', {
            '#f_nom_asso':          "Garradin",
            '#f_email_asso':        "asso@demo.garradin.eu",
            '#f_adresse_asso':      "15 rue du Logiciel Libre\n21000 DIJON",
            '#f_nom_membre':        "Ada Lovelace",
            '#f_cat_membre':        "Bureau",
            '#f_email_membre':      "ada@demo.garradin.eu",
            '#f_passe_membre':      "Garradin c'est chouette",
            '#f_repasse_membre':    "Garradin c'est chouette"
        }, false);
        this.click('form input[type=submit]');
    });

    casper.then(function() {
        if (this.getCurrentUrl().match(/login\.php/))
        {
            test.pass("Installation réussie.");
        }
        else
        {
            test.error(this.fetchText('p.error'));
        }
    });

    casper.run(function () {
        test.done();
    });
});

Added tests/README version [00c8746857].































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
Les tests de Garradin sont écrits en Javascript à l'aide de CasperJS.

CasperJS peut utiliser Phantom.js pour émuler un navigateur webkit ou SlimeJS pour un navigateur Gecko.

=== Installer l'environnement de test ===

1. Installer Phantom.js
    - apt-get install phantomjs/unstable
    - ou depuis http://phantomjs.org/download.html
2. (si installation manuelle) mettre Phantom.js dans le $PATH
3. Installer CasperJS:
    $ git clone git://github.com/n1k0/casperjs.git
4. Mettre CasperJS dans le $PATH

=== Lancer un test ===

1. Lancer un serveur php sur localhost:8080 qui pointe sur le www/ de Garradin
2. Lancer le test avec par exemple :
    $ phantomjs test 02-login.js

=== Lancer tous les tests ===

 $ ./run-all.sh

Cela va :
- télécharger le trunk de Garradin dans /tmp/garradin
- télécharger les dépendances
- lancer chacun des tests JS avec CasperJS dans l'ordre indiqué par le numéro

Pour utiliser une version locale de Garradin plutôt que de laisser télécharger le trunk 
il suffit de faire un lien symbolique de /tmp/garradin vers le code local.

Added tests/run.sh version [a9d9725c51].



































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#!/bin/sh

SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"

if [ -f $SCRIPTPATH/config.sh ]
then
    . $SCRIPTPATH/config.sh
fi

if [ "$1" = "--reset" ]
then
    rm -rf $TESTDIR
fi

if [ ! -d $TESTDIR ]
then
    mkdir -p $TESTDIR
    cd $TESTDIR
    fossil clone https://fossil.kd2.org/garradin/ garradin.fossil
    fossil open garradin.fossil
    sh tools/setup_dependencies.sh
    cd $SCRIPTPATH
fi

rm -rf $TESTDIR/src/cache
rm -rf $TESTDIR/src/*.sqlite

php -S localhost:8080 -t $TESTDIR/src/www &
PHP_PID=$!

$CASPERJS test *.js

kill $!