cello 0.0.21 → 0.0.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +1 -0
- data/README.md +4 -4
- data/lib/cello/commands/debug.rb +11 -0
- data/lib/cello/commands/main.rb +8 -2
- data/lib/cello/commands/new_page.rb +8 -0
- data/lib/cello/commands/new_project.rb +8 -0
- data/lib/cello/pageobjects/recorder.rb +27 -24
- data/lib/cello/structure/new_page.rb +0 -0
- data/lib/cello/structure/new_project.rb +11 -0
- data/lib/cello/structure.rb +2 -0
- data/lib/cello/version.rb +1 -1
- data/lib/cello.rb +2 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ee74dd13759682a982129f1148123829312454d
|
4
|
+
data.tar.gz: c90e11fccc3055ce2f6113f47305ce251c07ff7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 442a3e7209fc3d967ce2413453b242e518dde6b831379c4cdfedc7b54adc15e22db41bf8c55522ca70e60535d7f496e678c964cd91386938aa51b51863683655
|
7
|
+
data.tar.gz: 0f03315a9c011398fd53e6faa2561ec568e97b702b9f89b69681553c17329dd9856525aaac057ddd0a09d511f6c50ca4631e83cf2d49a381246629185d4b70b5
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
CELLO
|
2
2
|
=====
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/cello.png)](http://badge.fury.io/rb/cello)
|
4
|
-
[![Build Status](https://
|
4
|
+
[![Build Status](https://travis-ci.org/camiloribeiro/cello.png?branch=master)](https://travis-ci.org/camiloribeiro/cello)
|
5
5
|
[![Code Climate](https://codeclimate.com/github/camiloribeiro/cello.png)](https://codeclimate.com/github/camiloribeiro/cello)
|
6
6
|
[![Dependency Status](https://gemnasium.com/camiloribeiro/cello.png)](https://gemnasium.com/camiloribeiro/cello)
|
7
7
|
[![Coverage Status](https://coveralls.io/repos/camiloribeiro/cello/badge.png)](https://coveralls.io/r/camiloribeiro/cello)
|
@@ -25,9 +25,9 @@ CELLO
|
|
25
25
|
| / /|| | It uses metaprog, so it doesn't rely in bad generated code from the rec feature.
|
26
26
|
| / /~~~/ | It merges the power of selenium, the page object model and gherkin documentation.
|
27
27
|
\/ / \ / /
|
28
|
-
/`/.__Y__.-'
|
29
|
-
/#/ |
|
30
|
-
|
|
28
|
+
/`/.__Y__.-' It also has a record option, that allows you to create a new page object in a sec.
|
29
|
+
/#/ |
|
30
|
+
| have fun :)
|
31
31
|
!
|
32
32
|
|
33
33
|
What is the idea?
|
data/lib/cello/commands/main.rb
CHANGED
@@ -12,8 +12,14 @@ class Cello::Commands::Main
|
|
12
12
|
when "-v", "--version", "version"
|
13
13
|
Cello::Commands::Version.run
|
14
14
|
exit 0
|
15
|
-
when "-np", "--
|
16
|
-
Cello::Commands::
|
15
|
+
when "-np", "--new-project", "newproject"
|
16
|
+
Cello::Commands::NewProject.run
|
17
|
+
exit 0
|
18
|
+
when "-nP", "--new-page", "newpage"
|
19
|
+
Cello::Commands::NewPage.run
|
20
|
+
exit 0
|
21
|
+
when "-d", "--debug", "debug"
|
22
|
+
Cello::Commands::Debug.run
|
17
23
|
exit 0
|
18
24
|
end
|
19
25
|
|
@@ -1,32 +1,35 @@
|
|
1
1
|
require "rest-client"
|
2
2
|
|
3
3
|
class Elem < Struct.new(:element_id, :element_name, :element_type); end
|
4
|
-
class Recorder
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
4
|
+
class Cello::PageObjects::Recorder
|
5
|
+
class << self
|
6
|
+
def record args
|
7
|
+
page_url = args.shift
|
8
|
+
page_source = RestClient.get page_url
|
9
|
+
title = page_source.scan(/\<title\>(.*?)\<\/title\>/)[0].to_s.gsub!(/\W+/, ' ').strip!.split(" ").each { |w| w.capitalize! }.join("")
|
10
|
+
page = "require 'cello'\n\n"
|
11
|
+
page += "class #{title} < Cello::PageObjects::Page\n\n"
|
12
|
+
ary = Array.new()
|
13
|
+
page_source.scan(/\<input(.*?)\>/).each do |raw_element|
|
14
|
+
element_object = Elem.new nil, nil, nil
|
15
|
+
raw_element.to_s.split(" ").each do |element|
|
16
|
+
element_object.element_type = element.split("=")[1].gsub!(/\W+/, '') if !element.scan(/type/).empty?
|
17
|
+
element_object.element_name = element.split("=")[1].gsub!(/\W+/, '') if !element.scan(/name/).empty?
|
18
|
+
element_object.element_id = element.split("=")[1].gsub!(/\W+/, '') if !element.scan(/id/).empty?
|
19
|
+
end
|
20
|
+
ary.push element_object if (!element_object.element_type.nil? && (!element_object.element_id.nil? || !element_object.element_name.nil?))
|
17
21
|
end
|
18
|
-
ary.push bar if (!bar.element_type.nil? && (!bar.element_id.nil? || !bar.element_name.nil?))
|
19
|
-
end
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
ary.each do |yup|
|
24
|
+
key = ":id"
|
25
|
+
yup.element_name = yup.element_id if yup.element_name.nil?
|
26
|
+
key = ":name" if yup.element_id.nil?
|
27
|
+
yup.element_id = yup.element_name if yup.element_id.nil?
|
28
|
+
page += " element :#{yup.element_name}, :#{yup.element_type}, #{key} => '#{yup.element_id }'\n" if !yup.element_type.empty? && !yup.element_type != "hidden"
|
29
|
+
end
|
30
|
+
page += "\n url(\"#{page_url}\")\n\n"
|
31
|
+
page += "end\n"
|
32
|
+
File.open("./features/pages/#{title}.rb", 'w') {|f| f.write( page ) }
|
27
33
|
end
|
28
|
-
page += "\n url(\"#{page_url}\")\n\n"
|
29
|
-
page += "end\n"
|
30
|
-
page
|
31
34
|
end
|
32
35
|
end
|
File without changes
|
data/lib/cello/version.rb
CHANGED
data/lib/cello.rb
CHANGED
@@ -7,7 +7,6 @@ require 'watir-webdriver'
|
|
7
7
|
require 'cucumber'
|
8
8
|
|
9
9
|
#Modules
|
10
|
-
require File.join(File.dirname(__FILE__), './cello/pageobjects')
|
11
10
|
require File.join(File.dirname(__FILE__), './cello/structure')
|
12
11
|
require File.join(File.dirname(__FILE__), './cello/commands')
|
13
12
|
|
@@ -25,6 +24,8 @@ require File.join(File.dirname(__FILE__), './cello/commands/main')
|
|
25
24
|
require File.join(File.dirname(__FILE__), './cello/commands/help')
|
26
25
|
require File.join(File.dirname(__FILE__), './cello/commands/version')
|
27
26
|
require File.join(File.dirname(__FILE__), './cello/commands/new_project')
|
27
|
+
require File.join(File.dirname(__FILE__), './cello/commands/new_page')
|
28
|
+
require File.join(File.dirname(__FILE__), './cello/commands/debug')
|
28
29
|
|
29
30
|
module Cello
|
30
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cello
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Camilo Ribeiro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simplecov
|
@@ -243,8 +243,11 @@ files:
|
|
243
243
|
- lib/cello.rb
|
244
244
|
- lib/cello/Elem.rb
|
245
245
|
- lib/cello/commands.rb
|
246
|
+
- lib/cello/commands/debug.rb
|
246
247
|
- lib/cello/commands/help.rb
|
247
248
|
- lib/cello/commands/main.rb
|
249
|
+
- lib/cello/commands/new_page.rb
|
250
|
+
- lib/cello/commands/new_project.rb
|
248
251
|
- lib/cello/commands/version.rb
|
249
252
|
- lib/cello/pageobjects/browser.rb
|
250
253
|
- lib/cello/pageobjects/html_elements/button_helper.rb
|
@@ -262,6 +265,9 @@ files:
|
|
262
265
|
- lib/cello/pageobjects/html_elements/textfield_helper.rb
|
263
266
|
- lib/cello/pageobjects/page.rb
|
264
267
|
- lib/cello/pageobjects/recorder.rb
|
268
|
+
- lib/cello/structure.rb
|
269
|
+
- lib/cello/structure/new_page.rb
|
270
|
+
- lib/cello/structure/new_project.rb
|
265
271
|
- lib/cello/version.rb
|
266
272
|
- spec/button_spec.rb
|
267
273
|
- spec/checkbox_spec.rb
|