-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
73 lines (59 loc) · 1.71 KB
/
index.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
64
65
66
67
68
69
70
71
72
73
//include jquery
var fs = require("fs");
var jQuery_path = fs.absolute(fs.workingDirectory + "/jquery.js")
casper.options.clientScripts = [jQuery_path];
//settings
var BASE_URL = "http://"+casper.cli.get('url');
var personal_email = '[email protected]';
var my_password = 'johndoe123';
var viewportSizes = [
[1500,900],
[1280,800],
[1024,768],
[600,1024],
[320,568]
]
//take screenshots? true or false
var get_screenshots = true;
//take responsive screenshots? true or false
var responsive = true;
var screenshots = require("screenshots");
var home = require("homepage");
var login = require("login");
var register = require("register");
var account = require("account");
var log_me = require("log_me_in");
var category = require("category");
var category_add_product = require("category_add_product");
var cart = require("cart");
var checkout = require("checkout");
var success = require("success");
var taking_screenshots = function(page){
if(get_screenshots){
if(responsive){
screenshots.responsive_screenshots(page);
}
else{
screenshots.fixed_width_screenshots(page);
}
}
}
casper.start().thenOpen(BASE_URL, function() {
casper.test.comment('\nSTART TEST.' );
home.go_to_homepage();
login.go_to_login();
register.go_to_register("me"); //options randon or me for email
account.go_to_account();
log_me.log_me_in(personal_email,my_password);
category.go_to_category();
category_add_product.add_product();
cart.go_to_cart();
checkout.go_to_checkout();
checkout.order_user_logged("money"); //options money or sagepay
//checkout.order_user_guest("money");
success.go_to_success();
});
casper.run(function() {
console.log( '\nTHE END.' );
this.test.done();
});