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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 385bfdd2bf71d6f2f4cadac48705f8fd8a329e33
4
- data.tar.gz: a2c108a775c8006f4e9bffba6ef09624d6af3533
3
+ metadata.gz: 3ee74dd13759682a982129f1148123829312454d
4
+ data.tar.gz: c90e11fccc3055ce2f6113f47305ce251c07ff7c
5
5
  SHA512:
6
- metadata.gz: a00f9bf782f16486ad9f7a07df92b2edc1f04f648567e844f7b492b1a470ea39c5302f1688c63040d3cad97e601d6074c80a445c4899ae9c78a2a8ff7ddcbe16
7
- data.tar.gz: 155fd1998bb0c23a5e53ba86b668d72db16cb744bdf16494275d75605f0693c2588a2a5e40c27fa65254cf782b0e1b8444941735b936d6a90f4c3e7adee64215
6
+ metadata.gz: 442a3e7209fc3d967ce2413453b242e518dde6b831379c4cdfedc7b54adc15e22db41bf8c55522ca70e60535d7f496e678c964cd91386938aa51b51863683655
7
+ data.tar.gz: 0f03315a9c011398fd53e6faa2561ec568e97b702b9f89b69681553c17329dd9856525aaac057ddd0a09d511f6c50ca4631e83cf2d49a381246629185d4b70b5
data/.gitignore CHANGED
@@ -3,3 +3,4 @@ boot.sh
3
3
  Gemfile.lock
4
4
  *.gem
5
5
  /coverage
6
+ /testdir
data/.travis.yml CHANGED
@@ -2,3 +2,4 @@ language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
4
  - 2.0.0
5
+ - 2.1.0
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://secure.travis-ci.org/camiloribeiro/cello.png)](http://travis-ci.org/camiloribeiro/cello)
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?
@@ -0,0 +1,11 @@
1
+ require "cello"
2
+
3
+ class Cello::Commands::Debug
4
+ class << self
5
+ def run
6
+ Dir["./features/support/browsers/*.rb"].each {|file| require file }
7
+ Dir["./features/pages/*.rb"].each {|file| require file }
8
+ require "pry"; binding.pry
9
+ end
10
+ end
11
+ end
@@ -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", "--create-project", "newproject"
16
- Cello::Commands::CreatePage.run
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
 
@@ -0,0 +1,8 @@
1
+ class Cello::Commands::NewPage
2
+ class << self
3
+ def run(url=ARGV)
4
+ Cello::PageObjects::Recorder.record url
5
+ end
6
+ end
7
+ end
8
+
@@ -0,0 +1,8 @@
1
+ class Cello::Commands::NewProject
2
+ class << self
3
+ def run(args=ARGV)
4
+ Cello::Structure::NewProject.create
5
+ end
6
+ end
7
+ end
8
+
@@ -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
- def get_elements page_url
6
- foo = RestClient.get page_url
7
- title = foo.scan(/\<title\>(.*?)\<\/title\>/)[0].to_s.gsub!(/\W+/, ' ').strip!.split(" ").each { |w| w.capitalize! }.join("")
8
- page = "require 'cello'\n"
9
- page += "class #{title} < Cello::PageObjects::Page\n\n"
10
- ary = Array.new()
11
- foo.scan(/\<input(.*?)\>/).each do |raw_element|
12
- bar = Elem.new nil, nil, nil
13
- raw_element.to_s.split(" ").each do |element|
14
- bar.element_type = element.split("=")[1].gsub!(/\W+/, '') if !element.scan(/type/).empty?
15
- bar.element_name = element.split("=")[1].gsub!(/\W+/, '') if !element.scan(/name/).empty?
16
- bar.element_id = element.split("=")[1].gsub!(/\W+/, '') if !element.scan(/id/).empty?
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
- ary.each do |yup|
22
- key = ":id"
23
- yup.element_name = yup.element_id if yup.element_name.nil?
24
- key = ":name" if yup.element_id.nil?
25
- yup.element_id = yup.element_name if yup.element_id.nil?
26
- page += " element :#{yup.element_name}, :#{yup.element_type}, #{key} => '#{yup.element_id }'\n" if !yup.element_type.empty? && !yup.element_type != "hidden"
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
@@ -0,0 +1,11 @@
1
+ require 'fileutils'
2
+
3
+ class Cello::Structure::NewProject
4
+ class << self
5
+ def create
6
+ FileUtils.mkpath "./features/step_definitions"
7
+ FileUtils.mkpath "./features/support"
8
+ FileUtils.mkpath "./features/pages"
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,2 @@
1
+ module Cello::Structure
2
+ end
data/lib/cello/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Cello
2
- VERSION = "0.0.21"
2
+ VERSION = "0.0.23"
3
3
  end
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.21
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 00:00:00.000000000 Z
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