Improved www.ttss.krakow.pl
Jacek Kowalski
2018-06-03 fc8d60517033c7de6115d9d56bb43a8a7b279a3f
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
casper.test.begin('Stop name autocompletion', 4, function(test) {
    casper.start('http://127.0.0.1:8080/', function() {
        test.assertTitleMatches(/^TTSS\s/, 'Page title: TTSS...');
    });
    
    var autocomplete_pairs = [
        ['bag', 'Teatr Bagatela'],
        ['d g', 'Dworzec Główny'],
        ['świę', 'Plac Wszystkich Świętych'],
    ];
    
    autocomplete_pairs.forEach(function(value) {
        casper.then(function() {
            this.sendKeys('#stop-name', value[0], {reset: true});
        }).wait(200, function() {
            test.assertSelectorHasText(
                '#stop-name-autocomplete > option',
                value[1],
                'Autocomplete: ' + value[1]
            );
        });
    });
    
    casper.run(function() {
        test.done();
    });
});
 
casper.test.begin('Translation engine', 2, function(test) {
    casper.start('http://127.0.0.1:8080/#!en', function() {
        test.assertTitleMatches(/departures/i, 'Page title: ...departures...');
    });
    
    casper.wait(200, function() {
        test.assertSelectorHasText(
            '[data-translate=header_line]',
            'Line',
            'Translation: Linia -> Line'
        );
    });
    
    casper.run(function() {
        test.done();
    });
});