calliper 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,26 @@
1
+ function Notification($http) {
2
+ return {
3
+ index: function (success, error) {
4
+ var request = $http.get('/notifications.json');
5
+ if (success) request.success(success);
6
+ if (error) request.error(error);
7
+ return request;
8
+ }
9
+ };
10
+ }
11
+
12
+ function NotificationListCtrl($scope, Notification) {
13
+ $scope.toggleNotifications = function () {
14
+ if ($scope.notifications) {
15
+ $scope.notifications = null;
16
+ } else {
17
+ Notification.index(function (notifications) {
18
+ $scope.notifications = notifications;
19
+ });
20
+ }
21
+ };
22
+ }
23
+
24
+ angular.module('sample', [])
25
+ .service('Notification', Notification)
26
+ .controller('NotificationListCtrl', NotificationListCtrl);
@@ -0,0 +1,27 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en" ng-app="sample">
3
+ <head>
4
+ <meta charset="utf-8"/>
5
+ <title>Calliper Sample Application</title>
6
+ <script src="/javascripts/angular.js"></script>
7
+ <script src="/javascripts/application.js"></script>
8
+ </head>
9
+ <body>
10
+
11
+ <div ng-controller="NotificationListCtrl">
12
+ <h1>Notifications:</h1>
13
+
14
+ <button class="toggle-notifications" ng-click="toggleNotifications()">
15
+ Toggle Notifications
16
+ </button>
17
+
18
+ <ul ng-if="notifications" class="notification-list">
19
+ <li ng-repeat="notification in notifications" class="notification">
20
+ <span class="notification-id">{{notification.id}}</span>:
21
+ <span class="notification-message">{{notification.message}}</span>
22
+ </li>
23
+ </ul>
24
+ </div>
25
+
26
+ </body>
27
+ </html>
@@ -0,0 +1,48 @@
1
+ require 'test_helper'
2
+
3
+ class NotificationsPage < Calliper::Page
4
+ def get
5
+ super "/"
6
+ end
7
+
8
+ def toggle
9
+ find_element(:css, '.toggle-notifications').click
10
+ end
11
+
12
+ def list
13
+ find_element(:css, '.notification-list')
14
+ end
15
+
16
+ def notifications
17
+ list.find_elements(:repeater, 'notification in notifications')
18
+ end
19
+ end
20
+
21
+ class NotificationsTest < Minitest::Test
22
+ def setup
23
+ @page = NotificationsPage.get
24
+ end
25
+
26
+ def test_toggle_button
27
+ refute @page.list.is_visible?, "it should be hidden by default"
28
+
29
+ @page.toggle
30
+ assert @page.list.is_visible?, "it should be visible now"
31
+
32
+ @page.toggle
33
+ refute @page.list.is_visible?, "it should be hidden now"
34
+ end
35
+
36
+ def test_toggle_button
37
+ @page.toggle
38
+ assert_equal 20, @page.notifications.count
39
+
40
+ assert_equal "20",
41
+ @page.notifications.first.find_element(:css, '.notification-id').text
42
+ assert_equal "1",
43
+ @page.notifications.last.find_element(:css, '.notification-id').text
44
+
45
+ assert_equal "this is notification #1",
46
+ @page.notifications.last.find_element(:css, '.notification-message').text
47
+ end
48
+ end
@@ -0,0 +1,24 @@
1
+ require 'bundler'
2
+ Bundler.require(:default, :test)
3
+
4
+ require_relative 'sample/application'
5
+
6
+ Calliper.setup do |config|
7
+ config.application = SampleApplication
8
+ config.port = 3002
9
+
10
+ if ENV['CI']
11
+ config.driver = :remote
12
+ config.remote_url = "http://#{ENV['SAUCE_USERNAME']}:#{ENV['SAUCE_ACCESS_KEY']}@ondemand.saucelabs.com/wd/hub"
13
+ config.capabilities = {
14
+ 'name' => 'Calliper',
15
+ 'build' => ENV['TRAVIS_BUILD_NUMBER'],
16
+ 'tunnel-identifier' => ENV['TRAVIS_JOB_NUMBER'],
17
+ 'browserName' => ENV['BROWSER'] || 'firefox',
18
+ }
19
+ else
20
+ config.driver = (ENV['BROWSER'] || :firefox).to_sym
21
+ end
22
+ end
23
+
24
+ Calliper.enable!
metadata ADDED
@@ -0,0 +1,139 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: calliper
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Julien Portalier
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDeDCCAmCgAwIBAgIBATANBgkqhkiG9w0BAQUFADBBMQ8wDQYDVQQDDAZqdWxp
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ir/AQC7U0NalnKLNdwY9gkEdNwiTf5Ga/lZVDQ607bow
30
+ KVqCN//9bevjMk5OiMi9X3Wu/GtVWDwC6OTWFWKd54KgbuWlakO8LC1SMmStnCIF
31
+ W4qpyMWMZMcB4ZN/0mUVzY5xwrislBtsmQVUSw==
32
+ -----END CERTIFICATE-----
33
+ date: 2014-02-07 00:00:00.000000000 Z
34
+ dependencies:
35
+ - !ruby/object:Gem::Dependency
36
+ name: selenium-webdriver
37
+ requirement: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ type: :runtime
43
+ prerelease: false
44
+ version_requirements: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ - !ruby/object:Gem::Dependency
50
+ name: rack
51
+ requirement: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ type: :development
57
+ prerelease: false
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ - !ruby/object:Gem::Dependency
64
+ name: minitest
65
+ requirement: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ description: Protractor for Ruby, or testing your Angular application with elegance.
78
+ email:
79
+ - julien@portalier.com
80
+ executables: []
81
+ extensions: []
82
+ extra_rdoc_files: []
83
+ files:
84
+ - .gitignore
85
+ - .travis.yml
86
+ - LICENSE
87
+ - README.md
88
+ - Rakefile
89
+ - VERSION
90
+ - calliper.gemspec
91
+ - certs/ysbaddaden.pem
92
+ - lib/calliper.rb
93
+ - lib/calliper/config.rb
94
+ - lib/calliper/minitest.rb
95
+ - lib/calliper/page.rb
96
+ - lib/calliper/rack.rb
97
+ - lib/calliper/rails.rb
98
+ - lib/calliper/server.rb
99
+ - lib/calliper/version.rb
100
+ - lib/calliper/webdriver.rb
101
+ - test/sample/application.rb
102
+ - test/sample/config.ru
103
+ - test/sample/public/javascripts/angular.js
104
+ - test/sample/public/javascripts/application.js
105
+ - test/sample/views/index.erb
106
+ - test/sample_test.rb
107
+ - test/test_helper.rb
108
+ homepage: http://github.com/ysbaddaden/calliper
109
+ licenses:
110
+ - MIT
111
+ metadata: {}
112
+ post_install_message:
113
+ rdoc_options: []
114
+ require_paths:
115
+ - lib
116
+ required_ruby_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - '>='
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ required_rubygems_version: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ requirements: []
127
+ rubyforge_project:
128
+ rubygems_version: 2.0.14
129
+ signing_key:
130
+ specification_version: 4
131
+ summary: Protractor for Ruby, or testing your Angular application with elegance.
132
+ test_files:
133
+ - test/sample/application.rb
134
+ - test/sample/config.ru
135
+ - test/sample/public/javascripts/angular.js
136
+ - test/sample/public/javascripts/application.js
137
+ - test/sample/views/index.erb
138
+ - test/sample_test.rb
139
+ - test/test_helper.rb
Binary file