-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathtest_index_small_screen.js
63 lines (56 loc) · 2.65 KB
/
test_index_small_screen.js
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
// functional testing for the basic functionality of opentaba home page on small screens (without specific plan displaying)
var url = '../index.html';
casper.options.logLevel = "debug";
casper.options.verbose = true;
casper.options.viewportSize = {width:252, height:800}; // this produces a 480x800 resolution like my phone. why? who the fuck knows
//Starting the tests
casper.test.begin('Mobile index.html elements test',27, function suite(test){
casper.start(url, function(){
test.assertTitle('תב"ע פתוחה: ירושלים',"The title is what we expected");
test.assertExists('form[id="search-form"]', 'The search form exists');
test.assertExists('#right-bar','The right bar exists');
test.assertVisible('#right-bar');
test.assertExists('#header', 'The header div exists');
test.assertVisible('#header');
test.assertExists('#info', 'The info div exists');
test.assertVisible('#info');
test.assertExists('#map.leaflet-container.leaflet-fade-anim','The map div exists with leaflet class');
test.assertExists('.icon-twitter', 'The twitter icon exists');
test.assertVisible('.icon-twitter');
test.assertExists('.icon-facebook', 'The facebook icon exists');
test.assertVisible('.icon-facebook');
test.assertExists('.icon-rss', 'The rss icon exists');
test.assertVisible('.icon-rss');
//very tied to implentation should think about this
//test.assertResourceExists('lib/pdfobject.js');
test.assertResourceExists('lib/path.js');
test.assertResourceExists('munis.js');
test.assertResourceExists('jerusalem.topojson');
test.assertResourceExists('app.js');
test.assertResourceExists('lib/bootstrap/js/bootstrap.min.js');
test.assertResourceExists('handlebars.min.js');
test.assertResourceExists('lib/template-renderer.js');
// make sure the toggle button exists and is visible
test.assertExists('#toggle-button', 'The toggle button exists');
test.assertVisible('#toggle-button', 'The toggle button is visible');
test.assertDoesntExist('.row-offcanvas-right.active', 'Sidebar is not active');
});
// expand sidebar
casper.thenClick('#toggle-button',function(){
this.echo('clicked toggle-button. info div should be on screen now');
this.wait(1000, function () {
test.assertExists('.row-offcanvas-right.active', 'Sidebar is active');
});
});
// collapse sidebar again
casper.thenClick('#toggle-button',function(){
this.echo('clicked toggle-button. info div should be back off-screen');
this.wait(1000, function () {
test.assertDoesntExist('.row-offcanvas-right.active', 'Sidebar is active');
});
});
casper.run(function(){
this.echo(phantom.casperEngine,'debug');
test.done();
});
});