automation_wizard 0.1.3 → 2.0

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: b4abd231e06b200e5bcf4f11f49f89a7be3f173c
4
- data.tar.gz: a3bf2c012ce574852c5522a24bc49d4ad2a0e780
3
+ metadata.gz: 34759bd383003b2e10df0b6281c6c0fea20990c2
4
+ data.tar.gz: 99bc6417b22fb39435864fdaf3122f1325abf34a
5
5
  SHA512:
6
- metadata.gz: f0e28ec532413bbeaa9d5d9f66f5b6545598aa4180aa2eede929302257ab17abe332bf299aa7a0f6fd633e2fb3c7b86e99d6f1e93cd280a1adc8b42a4a9d0c15
7
- data.tar.gz: 1de04ac86e56f0077fdc1acfa6cce597fce45780396373225c7b748df38ae062ad2e6843cce39cc4c46c7eb3442436aa1a2f178d726eb1622b82e98982f93a5c
6
+ metadata.gz: 807b662eac58a5ba49c7a95dbb8bb3dc8808ffda606ad6ae77cae2cee97d5a99ad5f907b40d1d10a0446d3f38eb08f59ab5825978cc235543c26d4ca4863e6fb
7
+ data.tar.gz: 3156100d06b0161c1b85a2a5c1a27a0952e3f443b72b59eb19613998891903dbdacea6a404c53013e1c22fd885c81e3d4bfddefaac61f65ec5d0d1a3be508d04
data/ChangeLog CHANGED
@@ -1,3 +1,6 @@
1
+ === Version 2.0 / 2017-01-31
2
+ * Using Watir Drop framework
3
+
1
4
  === Version 0.1.2 / 2017-01-03
2
5
  * Updated Readme file, correcting typos and adding additional information.
3
6
  * Updated gemspec.
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- automation_wizard (0.1.3)
4
+ automation_wizard (2.0)
5
5
  thor (~> 0.17, >= 0.17.0)
6
6
 
7
7
  GEM
@@ -16,4 +16,4 @@ DEPENDENCIES
16
16
  automation_wizard!
17
17
 
18
18
  BUNDLED WITH
19
- 1.13.6
19
+ 1.14.3
data/Readme.md CHANGED
@@ -4,17 +4,42 @@ A gem that contains generators that create things testers need.
4
4
 
5
5
  Currently it only generates a cucumber project. You can do this by executing:
6
6
 
7
- wiz testproject <project_name>
7
+ wiz testproject <project_name> level=jr
8
8
 
9
9
  This command will create a project in the <em>project_name</em> directory with the files needed to begin
10
- developing cucumber features. There is an option that can be provided to have the project configure to use different gems:
10
+ developing specs. There is an option that can be provided to have the project configure to use different gems:
11
11
 
12
- ## Web testing
12
+ ###Automation Take-Home Test
13
13
 
14
- If you are testing a web application, <em>testgen</em> can setup the project to use the PageObject gem.
14
+ Purpose:
15
+
16
+ 1. To measure the candidate's ability to build robust tests using the PageObject gem as a base.
17
+
18
+ 2. To measure the candidate's overall code quality
19
+
20
+
21
+ Deliverables:
22
+
23
+ * Return the generated project folder in a zip file
24
+
25
+ * Include instructions on how to run the tests and install any required libraries
26
+
27
+
28
+ Required Tools in Generated Gemfile:
29
+
30
+ * RSpec for the test framework
31
+
32
+ * Watir-drops gem for the test code (this gem enables you to implement the Page Objects)
33
+
34
+ * Rake for launching tests / tasks
35
+
36
+ * Pry for debugging (optional)
37
+
38
+
39
+ Browser the test needs to run on:
40
+
41
+ * Chrome (Chrome driver should be installed first if not already. If chrome driver is not installed, use [webdrivers](https://github.com/titusfortner/webdrivers))
15
42
 
16
- wiz testproject <project_name> --pageobject-driver=watir
17
43
 
18
- Valid options for the <em>--pageobject-driver</em> option are 'watir' or 'selenium'
19
44
 
20
45
 
@@ -1,22 +1,22 @@
1
1
  # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "automation_wizard/version"
2
+ $:.push File.expand_path('../lib', __FILE__)
3
+ require 'automation_wizard/version'
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "automation_wizard"
7
7
  s.version = AutomationWizard::VERSION
8
8
  s.license = 'MIT'
9
- s.authors = ["Avery Roswell"]
10
- s.email = ["avery.roswell@loblaw.ca"]
9
+ s.authors = ['Avery Roswell']
10
+ s.email = ['avery.roswell@loblaw.ca']
11
11
  s.summary = %q{Generator for wizard test. Generator for base project setup.}
12
12
  s.description = %q{A collection of generators for project setup, applicant testing, and onboarding.}
13
13
 
14
- s.rubyforge_project = "automation_wizard"
14
+ s.rubyforge_project = 'automation_wizard'
15
15
 
16
16
  s.files = `git ls-files`.split("\n")
17
17
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
- s.require_paths = ["lib"]
19
+ s.require_paths = ['lib']
20
20
 
21
21
  s.add_dependency 'thor', '~> 0.17', '>=0.17.0'
22
22
  end
@@ -1,9 +1,8 @@
1
1
  ###Project Setup
2
2
 
3
3
  1. Use gem install to install the automation_wizard: `gem install automation_wizard`
4
- 2. From the command line enter `wiz testproject web_automation --pageobject-driver=watir` to generate a project for web application
4
+ 2. From the command line enter `wiz testproject web_automation --level=jr` to generate a project for web application
5
5
  testing using watir as the ruby library for automating tests. Watir interacts with a browser as a user would.
6
6
  Change directories into the newly created web_automation project folder. From there run `bundle install`
7
- 3. You'll need _chromedriver_ to help with the automation. If _chromedriver_ is not installed, use _Brew_ to install the driver. You can use `brew list` to list the installed packages on your computer.
8
- If _chromedriver_ is not listed then install it with: `brew install chromedriver`
7
+ 3. You'll need _chromedriver_ to help with the automation. If _chromedriver_ is not installed, use [webdrivers] (https://github.com/titusfortner/webdrivers) to install the driver.
9
8
  4. Follow the readme file in the generated project folder.
@@ -1,14 +1,15 @@
1
1
  require 'thor'
2
2
  require 'automation_wizard/generators/project'
3
+ require 'pry'
3
4
 
4
5
  module AutomationWizard
5
6
  class CLI < Thor
6
-
7
- desc "testproject <project_name>", "Create a new test project"
8
- method_option :pageobject_driver, type: :string, required: false, desc: "Use the PageObject gem to drive browsers. Valid values are 'watir' and 'selenium'"
7
+
8
+ desc 'testproject <project_name>', 'Create a new test project'
9
+ method_option :level, type: :string, required: true, desc: 'Provide level option.'
9
10
 
10
11
  def testproject(name)
11
- driver = options[:pageobject_driver].nil? ? 'none' : options[:pageobject_driver]
12
+ driver = options[:level]
12
13
  AutomationWizard::Generators::Project.start([name, driver])
13
14
  end
14
15
 
@@ -6,58 +6,51 @@ module AutomationWizard
6
6
  include Thor::Actions
7
7
 
8
8
  argument :name, type: :string, desc: 'The name of the project'
9
- argument :pageobject_driver, type: :string, desc: 'Driver to use with PageObject'
9
+ argument :level, type: :string, desc: 'Project level'
10
10
 
11
- desc "Generates a project structure for automation applicant test"
11
+ desc 'Generates a project structure for automation applicant test'
12
12
 
13
13
  def self.source_root
14
- File.dirname(__FILE__) + "/project"
14
+ File.dirname(__FILE__) + '/project'
15
15
  end
16
-
17
- def create_top_directory
16
+
17
+ def create_project_structure
18
18
  empty_directory(name)
19
+ empty_directory("#{name}/spec")
20
+ empty_directory("#{name}/lib")
21
+ empty_directory("#{name}/lib/models")
22
+ empty_directory("#{name}/lib/pages")
19
23
  end
20
-
21
- def copy_cucumber_yml
22
- template "cucumber.yml.tt", "#{name}/cucumber.yml"
24
+
25
+ def copy_rspec
26
+ template '.rspec', "#{name}/.rspec"
23
27
  end
24
-
28
+
25
29
  def copy_gemfile
26
- template "Gemfile.tt", "#{name}/Gemfile"
30
+ template 'Gemfile', "#{name}/Gemfile"
27
31
  end
28
32
 
29
33
  def copy_rakefile
30
- copy_file "Rakefile", "#{name}/Rakefile"
34
+ copy_file 'Rakefile', "#{name}/Rakefile"
31
35
  end
32
36
 
33
37
  def copy_readme
34
- copy_file "Readme.md.tt", "#{name}/Readme.md"
38
+ copy_file 'Readme.md.tt', "#{name}/README.md"
35
39
  end
36
40
 
37
- def create_cucumber_directories
38
- empty_directory("#{name}/features")
39
- empty_directory("#{name}/features/support")
40
- empty_directory("#{name}/features/step_definitions")
41
- end
42
-
43
- def copy_env
44
- template "env.rb.tt", "#{name}/features/support/env.rb"
41
+ def copy_specs
42
+ template 'spec_helper.rb', "#{name}/spec/spec_helper.rb"
43
+ template 'loblaws_search_spec.rb.tt', "#{name}/spec/loblaws_search_spec.rb"
45
44
  end
46
45
 
47
- def copy_hooks
48
- template "hooks.rb.tt", "#{name}/features/support/hooks.rb" unless no_driver_selected
46
+ def copy_pages
47
+ template 'loblaws_home.rb.tt', "#{name}/lib/pages/loblaws_home.rb"
49
48
  end
50
49
 
51
- def create_pages_directory
52
- empty_directory("#{name}/features/support/pages") unless no_driver_selected
50
+ def copy_models
51
+ template 'model_loblaws_search.rb.tt', "#{name}/lib/models/model_loblaws_search.rb"
53
52
  end
54
53
 
55
-
56
- private
57
- def no_driver_selected
58
- pageobject_driver.downcase == 'none'
59
- end
60
-
61
54
  end
62
55
  end
63
56
  end
@@ -0,0 +1,3 @@
1
+ --color
2
+ --format d
3
+ --order rand
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rspec'
4
+ gem 'rake'
5
+ gem 'pry'
6
+ gem 'watir_drops'
7
+ gem 'watir_model'
@@ -1,9 +1,5 @@
1
- require 'rubygems'
2
- require 'cucumber'
3
- require 'cucumber/rake/task'
1
+ require 'rspec/core/rake_task'
4
2
 
5
- Cucumber::Rake::Task.new(:features) do |t|
6
- t.profile = 'default'
7
- end
3
+ RSpec::Core::RakeTask.new(:spec)
8
4
 
9
- task :default => :features
5
+ task :default => :spec
@@ -16,18 +16,21 @@ Deliverables:
16
16
 
17
17
  Required Tools in Generated Gemfile:
18
18
 
19
- * Cucumber for the test framework
19
+ * RSpec for the test framework
20
20
 
21
- * Page-Object gem for the test code (it is a wrapper for Selenium & Watir WebDriver and allows user to easily use the Page Object design pattern)
21
+ * Watir-drops gem for the test code (this gem enables you to implement the Page Objects)
22
22
 
23
23
  * Rake for launching tests / tasks
24
24
 
25
25
  * Pry for debugging (optional)
26
26
 
27
+ * chromedriver executable for controlling a Chrome browser (if not installed, follow instructions [here](https://github.com/titusfortner/webdrivers))
28
+
29
+
27
30
 
28
31
  Browser the test needs to run on:
29
32
 
30
- * Chrome (Chrome driver should be installed first if not already. See installing Chrome driver above)
33
+ * Chrome
31
34
 
32
35
 
33
36
  Time:
@@ -0,0 +1,13 @@
1
+ <% if level.downcase == 'jr' -%>
2
+ class LoblawsHome < WatirDrops::PageObject
3
+
4
+ page_url { 'https://www.loblaws.ca' }
5
+
6
+ element(:search_term) { browser.text_field(id: 'search-bar')}
7
+
8
+ def populate_search_field(data)
9
+ fill_form(data)
10
+ end
11
+
12
+ end
13
+ <% end %>
@@ -0,0 +1,18 @@
1
+ <% if level.downcase == 'jr' -%>
2
+ require_relative 'spec_helper'
3
+ require_relative '../lib/pages/loblaws_home'
4
+ require_relative '../lib/models/model_loblaws_search'
5
+
6
+ describe 'Loblaws Home Page' do
7
+ let(:browser) { WatirDrops::PageObject.browser}
8
+
9
+
10
+ it 'fills in search field' do
11
+ search_data = ModelLoblawsSearch.new
12
+ page = LoblawsHome.visit
13
+ page.populate_search_field(search_data)
14
+
15
+ expect(page.search_term.value).to include search_data.search_term
16
+ end
17
+ end
18
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <% if level.downcase == 'jr' -%>
2
+ class ModelLoblawsSearch < WatirModel
3
+ key(:search_term) { 'cheese' }
4
+ end
5
+ <% end %>
@@ -0,0 +1,22 @@
1
+ require 'watir_drops'
2
+ require 'watir_model'
3
+ require 'pry'
4
+
5
+ Watir.default_timeout = 15
6
+
7
+ RSpec.configure do |config|
8
+
9
+ config.before(:suite) do
10
+
11
+ end
12
+
13
+ config.before(:each) do
14
+ WatirDrops::PageObject.browser = Watir::Browser.new :chrome
15
+ WatirDrops::PageObject.browser.window.maximize
16
+ end
17
+
18
+ config.after(:each) do |scenario|
19
+ WatirDrops::PageObject.browser.close
20
+ end
21
+
22
+ end
@@ -1,3 +1,3 @@
1
1
  module AutomationWizard
2
- VERSION = "0.1.3"
2
+ VERSION = "2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: automation_wizard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: '2.0'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Avery Roswell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-10 00:00:00.000000000 Z
11
+ date: 2017-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -41,21 +41,23 @@ extra_rdoc_files: []
41
41
  files:
42
42
  - ".gitignore"
43
43
  - ChangeLog
44
+ - Gemfile
44
45
  - Gemfile.lock
45
46
  - Readme.md
46
47
  - automation_wizard.gemspec
47
48
  - bin/wiz
48
49
  - email_instructions.md
49
- - gemfile
50
50
  - lib/automation_wizard.rb
51
51
  - lib/automation_wizard/cli.rb
52
52
  - lib/automation_wizard/generators/project.rb
53
- - lib/automation_wizard/generators/project/Gemfile.tt
53
+ - lib/automation_wizard/generators/project/.rspec
54
+ - lib/automation_wizard/generators/project/Gemfile
54
55
  - lib/automation_wizard/generators/project/Rakefile
55
56
  - lib/automation_wizard/generators/project/Readme.md.tt
56
- - lib/automation_wizard/generators/project/cucumber.yml.tt
57
- - lib/automation_wizard/generators/project/env.rb.tt
58
- - lib/automation_wizard/generators/project/hooks.rb.tt
57
+ - lib/automation_wizard/generators/project/loblaws_home.rb.tt
58
+ - lib/automation_wizard/generators/project/loblaws_search_spec.rb.tt
59
+ - lib/automation_wizard/generators/project/model_loblaws_search.rb.tt
60
+ - lib/automation_wizard/generators/project/spec_helper.rb
59
61
  - lib/automation_wizard/version.rb
60
62
  homepage:
61
63
  licenses:
data/gemfile DELETED
@@ -1,2 +0,0 @@
1
- source "https://rubygems.org"
2
- gemspec
@@ -1,10 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'cucumber'
4
- gem 'rspec'
5
- gem 'rake'
6
- gem 'pry'
7
- <% unless pageobject_driver.downcase == 'none' -%>
8
- gem 'page-object'
9
- <% end -%>
10
-
@@ -1 +0,0 @@
1
- default: --no-source --color --format pretty
@@ -1,10 +0,0 @@
1
- require 'rspec'
2
- require 'pry'
3
- <% unless pageobject_driver.downcase == 'none' -%>
4
- require 'page-object'
5
- <% end -%>
6
-
7
- <% unless pageobject_driver.downcase == 'none' -%>
8
- World(PageObject::PageFactory)
9
- <% end -%>
10
-
@@ -1,11 +0,0 @@
1
- <% if pageobject_driver.downcase == 'watir' -%>require 'watir' <% end %>
2
- <% if pageobject_driver.downcase == 'selenium' -%>require 'selenium-webdriver' <% end %>
3
-
4
- Before do
5
- <% if pageobject_driver.downcase == 'watir' -%> @browser = Watir::Browser.new :chrome <% end %>
6
- <% if pageobject_driver.downcase == 'selenium' -%> @browser = Selenium::WebDriver.for :chrome <% end %>
7
- end
8
-
9
- After do
10
- @browser.close
11
- end