legoTech_gem 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 184a880c5427d20c2ea97ede00f70711c75d815f736513ee2ccd5d3b4b53a66a
4
+ data.tar.gz: db8910637b4d0c09556ef05257bf181644eb80e088cd7ec8365bcf68c6bcbc96
5
+ SHA512:
6
+ metadata.gz: 2eb81f3c6efea456435f2265b113d2794311dcfc095bde67de725506168d50cc544f22b97dcbf9326482481c438ce70dce3970b0a09d08f0fdc9e81a6ffc1d92
7
+ data.tar.gz: b4a3db5b4d84581796e6e66f30c4cf43a52d5066b652e339e982ddf601aecd9fa25fc72781c666457329e1d096dc8c5c2192792ea4367fbf5c93897b946478d0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+ # A sample Gemfile
3
+ source "https://rubygems.org"
4
+ gem "selenium-webdriver", "~> 3.142.7" # which is same as gem "rails", ">= 3.142.7", "< 3.143.0"
@@ -0,0 +1,27 @@
1
+ # Ruby-Selenium
2
+ A Ruby gem to help developers write test cases for the UI
3
+
4
+ Please respect the naming definition as taken from here: https://github.com/airbnb/ruby#naming
5
+ Comments and tags must respect the naming from: https://rubydoc.info/gems/yard/file/docs/Tags.md
6
+ Ruby Types are defined here: https://www.geeksforgeeks.org/ruby-data-types/
7
+
8
+ **Note**: https://stackoverflow.com/questions/28506769/failed-to-require-a-local-gem/28507368#28507368
9
+
10
+ # How to install dependencies
11
+
12
+ 1. Make sure Ruby is installed `ruby -v` should return the current version of the language on your computer
13
+ 2. Install bundler using `gem install bundler` to allow you to build the project
14
+ 3. Make sure all of your new dependencies are within the Gemfile
15
+ 4. Run `bundle install --path vendor/bundle`
16
+
17
+ # How to build a release
18
+
19
+ 1. Make sure Ruby is installed `ruby -v` should return the current version of the language on your computer
20
+ 2. Install bundler using `gem install bundler` to allow you to build the project
21
+ 3. Building is as simple as `gem build ruby-selenium.gemspec`
22
+
23
+ # How to publish
24
+
25
+ 1. Make sure Ruby is installed `ruby -v` should return the current version of the language on your computer
26
+ 2. Make sure you have a built gem
27
+ 3. Using the gem command run the following `gem push [YOUR_GEM_NAME].gem`
@@ -0,0 +1,17 @@
1
+ Gem::Specification.new do |spec|
2
+ spec.name = "legoTech_gem"
3
+ spec.version = "0.0.3"
4
+ spec.authors = ["Patrique Legault"]
5
+ spec.email = ["patrique.legault@gmail.com"]
6
+ spec.summary = %q{A Ruby library used to test forms using browser automation}
7
+ spec.description = %q{A lightweight testing framework that utilizes selenium to allow developers to write test cases}
8
+ spec.homepage = "https://www.pat-lego.io"
9
+ spec.license = "MIT"
10
+ spec.files = Dir.glob("{lib}/**/*.rb") + %w(README.md legoTech.gemspec Gemfile)
11
+ spec.require_paths = ["lib"]
12
+ # spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
13
+ # spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
14
+
15
+ spec.add_development_dependency "bundler", "~> 1.5"
16
+ spec.add_development_dependency "selenium-webdriver", "~> 3.142.7"
17
+ end
@@ -0,0 +1,13 @@
1
+ require_relative "ui/actions/Action"
2
+
3
+ require_relative "ui/driver/Driver"
4
+
5
+ require_relative "ui/test-cases/TestCase"
6
+
7
+ require_relative "ui/test-suites/TestSuite"
8
+
9
+ require_relative "ui/enums/Field"
10
+ require_relative "ui/enums/Identifier"
11
+
12
+ module LegoTechSelenium
13
+ end
@@ -0,0 +1,18 @@
1
+ # @author Patrique Legault
2
+ class Actions
3
+
4
+ # A function that performs the given action against the webpage given the driver and the action
5
+ #
6
+ # @param driver [Driver] The driver object that represents the instance that is connected to the browser
7
+ # @param action [Hash] A ruby object that has the following layout
8
+ # {
9
+ # :field => Fields::...
10
+ # :identifier => Identifier::...
11
+ # :value => String
12
+ # }
13
+ # @return void
14
+ # @raise Selenium Exceptions
15
+ def test(driver, action)
16
+ raise "Test function in the Actions.rb file has not been overriden"
17
+ end
18
+ end
@@ -0,0 +1,31 @@
1
+ require "selenium-webdriver"
2
+
3
+ class Driver
4
+ @driver
5
+
6
+ # Pass in an instance of the driver
7
+ # @param The driver from Selenium Webdriver class
8
+ def initialize(driver)
9
+ @driver = driver
10
+ end
11
+
12
+ # Set the amount of time the driver should wait when searching for elements.
13
+ # @param implicit_wait seconds for implicit wait
14
+ def set_implicit_wait(implicit_wait)
15
+ end
16
+
17
+ # Sets the amount of time to wait for a page load to complete before throwing an error.
18
+ # @param page_load seconds to wait for page to load
19
+ def set_page_load(page_load)
20
+ end
21
+
22
+ # Sets the amount of time to wait for an asynchronous script to finish execution before throwing an error.
23
+ # @param script_time seconds to wait for script to complete
24
+ def set_script_tiemout(script_tiemout)
25
+ end
26
+
27
+ # The URL to navigate to
28
+ # @param navigate_to location for the browser to navigate to
29
+ def set_navigate_to(navigate_to)
30
+ end
31
+ end
@@ -0,0 +1,6 @@
1
+ module Fields
2
+ RADIO_BUTTON = 1
3
+ CHECK_BOX = 2
4
+ INPUT = 3
5
+ DROPDOWN_LIST = 4
6
+ end
@@ -0,0 +1,5 @@
1
+ module Identifier
2
+ CSS = 1
3
+ NAME = 2
4
+ ID = 3
5
+ end
@@ -0,0 +1,9 @@
1
+ class TestCase
2
+ def initialize(name)
3
+ if name.nil? or name.empty?
4
+ raise "All TestCasses must have a name associated to them"
5
+ end
6
+
7
+ @name = name
8
+ end
9
+ end
@@ -0,0 +1,62 @@
1
+ class TestSuite
2
+ # @param name [String] is the name of the TestSuite
3
+ # @param driver [Driver] is the driver variable
4
+ def initialize(name, driver)
5
+ if name.nil? or name.empty?
6
+ raise "All TestSuites must have a name associated to them"
7
+ end
8
+
9
+ if driver.nil?
10
+ raise "Driver must be non nil"
11
+ end
12
+ @name = name
13
+ @driver = driver
14
+ @entries = []
15
+ end
16
+
17
+ # Function used to add a TestCase to thee TestSuite
18
+ # @param testCase [TestCase] A test case to be executed
19
+ def addTestCase(testCase)
20
+ @entries.push(testCase)
21
+ end
22
+
23
+ # Retrieve the name of the TestSuite
24
+ # @return [String] The name of the TestSuite
25
+ def getName()
26
+ return @name
27
+ end
28
+
29
+ # Retrieve the number of TestCases within the TestSuite
30
+ # @return [Number] Number of TestCases
31
+ def getNumberOfTestCases
32
+ return @entries.size
33
+ end
34
+
35
+ # Function that will invoke all test cases
36
+ def run()
37
+ raise "Not yet built"
38
+ end
39
+
40
+ class Builder
41
+ # Constructor for internal builder
42
+ # @param name [String] The name of the class
43
+ # @param driver [Driver] The driver of the class
44
+ def initialize(name, driver)
45
+ @testSuites = TestSuite.new(name, driver)
46
+ end
47
+
48
+ # Add a test case to the test suite
49
+ # @param TestsCase [TestCase] to be added to the list
50
+ # @return self
51
+ def addTestCase(testCase)
52
+ @testSuites.addTestCase(testCase)
53
+ self
54
+ end
55
+
56
+ # Returns an instance of TestSuite
57
+ # @return TestSuite instance
58
+ def build
59
+ @testSuites
60
+ end
61
+ end
62
+ end
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: legoTech_gem
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ platform: ruby
6
+ authors:
7
+ - Patrique Legault
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-02-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.5'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: selenium-webdriver
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 3.142.7
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 3.142.7
41
+ description: A lightweight testing framework that utilizes selenium to allow developers
42
+ to write test cases
43
+ email:
44
+ - patrique.legault@gmail.com
45
+ executables: []
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - Gemfile
50
+ - README.md
51
+ - legoTech.gemspec
52
+ - lib/legoTech_gem.rb
53
+ - lib/ui/actions/Action.rb
54
+ - lib/ui/driver/Driver.rb
55
+ - lib/ui/enums/Field.rb
56
+ - lib/ui/enums/Identifier.rb
57
+ - lib/ui/test-cases/TestCase.rb
58
+ - lib/ui/test-suites/TestSuite.rb
59
+ homepage: https://www.pat-lego.io
60
+ licenses:
61
+ - MIT
62
+ metadata: {}
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ requirements: []
78
+ rubygems_version: 3.0.6
79
+ signing_key:
80
+ specification_version: 4
81
+ summary: A Ruby library used to test forms using browser automation
82
+ test_files: []