generic_test 0.1.13 → 0.2.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b7fd4592cd7c34e39ae05d9db02ea20dd6ca739f368851db22dac04168504ec1
4
- data.tar.gz: fb55093d314dfc89e13d0ec4342317106d6caef89dcd9e7341c42c79a59f464b
3
+ metadata.gz: 9b1c9696f0ea835b89da12a7d1b95289955fc66097fa614009775acde222a5bd
4
+ data.tar.gz: 0ed1be3abda02a988dbd7befb16f4a6e725566e1a911e0c842268e371acc85f3
5
5
  SHA512:
6
- metadata.gz: f5ec80dd8977f15b6ffc3a66cec286a2183da371a10eb4d4428ff0f607d849e818bc303ffa96c3295e9ba787f7dcf092e95d64729318dcd357ee390937ec9680
7
- data.tar.gz: 92d050bbbd02da8821ba2685cec5bcf86a1187a3f9a3ab82d4cc0ef44b0bc5d47644c520e81b5fd8859293021b840bb16571cf407f7fdc08924beaf67dbef97f
6
+ metadata.gz: f69e2f461c62fcd4be622afbc3754197c6731d8d650aeffd5727f80514237aa136d347a131f94c6ab889f1ae3a62d5e9aad010eeff917932eefc04bf2be7715e
7
+ data.tar.gz: ae3bd8b8c02e3d269b55916482098a6dd3b86ef8e05ebb7a1aecb117f09d0e19a0b49d8233f8b393832d357f153fcc4ca3f846a589c3865eb5b9fe24927e1950
data/.gitlab-ci.yml CHANGED
@@ -1,4 +1,4 @@
1
- image: ruby:2.6
1
+ image: ruby:3.3
2
2
 
3
3
  include:
4
4
  - template: Code-Quality.gitlab-ci.yml
@@ -8,16 +8,22 @@ docker_build:
8
8
  # Use TLS https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#tls-enabled
9
9
  DOCKER_HOST: tcp://docker:2376
10
10
  DOCKER_TLS_CERTDIR: "/certs"
11
- stage: deploy # Part of a later stage
11
+ stage: test # Part of a later stage
12
12
  services:
13
- - docker:19.03.5-dind
14
- image: docker:19.03.5
13
+ - docker:20.10.11-dind
14
+ image: docker:20.10.11
15
15
  script:
16
16
  - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
17
17
  - docker pull --quiet $CI_REGISTRY_IMAGE:latest || true
18
18
  - docker build -t $CI_REGISTRY_IMAGE:latest .
19
19
  - docker run -t $CI_REGISTRY_IMAGE:latest generic_test page samuel-garratt.gitlab.io/generic_test/about.html
20
20
  - docker push $CI_REGISTRY_IMAGE:latest
21
+ # only:
22
+ # - master
23
+ # needs: ["test"]
24
+ except:
25
+ changes:
26
+ - "*.md"
21
27
 
22
28
  test:
23
29
  image: registry.gitlab.com/samuel-garratt/generic_test
@@ -34,6 +40,23 @@ test:
34
40
  expire_in: 1 week
35
41
  when: always
36
42
 
43
+ # Example of using generic test
44
+ example_test:
45
+ stage: test
46
+ image: registry.gitlab.com/samuel-garratt/generic_test
47
+ script:
48
+ - generic_test page samuel-garratt.gitlab.io/generic_test/about.html
49
+ variables:
50
+ GIT_STRATEGY: none
51
+ artifacts:
52
+ paths:
53
+ - logs/*.xml
54
+ - reports
55
+ reports:
56
+ junit: logs/*.xml
57
+ expire_in: 1 week
58
+ when: always
59
+
37
60
  pages:
38
61
  stage: deploy
39
62
  script:
@@ -51,4 +74,4 @@ pages:
51
74
  image: docker:19.03.5
52
75
  stage: test
53
76
  script:
54
- - docker run myrepo/generic_test BASE_URL
77
+ - docker run myrepo/generic_test BASE_URL
data/.rspec CHANGED
@@ -1,5 +1,5 @@
1
1
  --format documentation
2
+ --format html --out report.html
2
3
  --color
3
4
  --require spec_helper
4
5
  --format RspecJunitFormatter --out logs/page_<%= ENV['PAGE_URL'].split('://').last.tr('/', '_') %>.xml
5
- --format RspecHtmlReporter
data/Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
- FROM ruby:2.6
2
- MAINTAINER Samuel Garratt
1
+ FROM ruby:3.3
2
+ LABEL AUTHOR=SamuelGarratt
3
3
 
4
4
  # Required ruby gems
5
5
  RUN mkdir /test
@@ -21,4 +21,6 @@ RUN export LANG=C.UTF-8
21
21
  RUN export LANGUAGE=C.UTF-8
22
22
  RUN export LC_ALL=C.UTF-8
23
23
  # By running test image is checked and webdriver will be cached
24
- RUN generic_test page samuel-garratt.gitlab.io/generic_test/about.html
24
+ RUN generic_test page samuel-garratt.gitlab.io/generic_test/about.html
25
+
26
+ ENTRYPOINT ["generic_test", "page"]
data/README.md CHANGED
@@ -2,7 +2,9 @@
2
2
 
3
3
  This gem provides an easy way to run generic tests for a website/api
4
4
 
5
- Test site is at https://samuel-garratt.gitlab.io/generic_test
5
+ Test site is at [https://samuel-garratt.gitlab.io/generic_test](https://samuel-garratt.gitlab.io/generic_test)
6
+
7
+ ## Quick start
6
8
 
7
9
  Run test gem through docker against this website with (Note it is an example that has some failures)
8
10
 
@@ -14,6 +16,27 @@ To get a log of your tests share a volume with the container.
14
16
 
15
17
  > Please share this volume from an empty folder. Running from within another gem might cause an issue
16
18
 
19
+ ## Add to gitlab CI for your website
20
+
21
+ Add the following `YAML` to test against a website
22
+ ```yaml
23
+ example_test:
24
+ stage: test
25
+ image: registry.gitlab.com/samuel-garratt/generic_test
26
+ script:
27
+ - generic_test page YOUR_WEBSITE_URL
28
+ variables:
29
+ GIT_STRATEGY: none # Make more efficient and remove any dependency conflicts
30
+ artifacts:
31
+ paths:
32
+ - logs/*.xml
33
+ - reports # HTML reports
34
+ reports:
35
+ junit: logs/*.xml
36
+ expire_in: 1 week
37
+ when: always
38
+ ```
39
+
17
40
  ## Installation
18
41
 
19
42
  Add this line to your application's Gemfile:
@@ -48,6 +71,10 @@ E.g.,
48
71
 
49
72
  `docker run -t registry.gitlab.com/samuel-garratt/generic_test generic_test page samuel-garratt.gitlab.io/generic_test`
50
73
 
74
+ Check version
75
+
76
+ `docker run -t registry.gitlab.com/samuel-garratt/generic_test generic_test version`
77
+
51
78
  ### Through login page
52
79
 
53
80
  Environment variables store Login URL, username and password
@@ -78,11 +105,17 @@ login:
78
105
 
79
106
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
80
107
 
81
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
108
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update
109
+ the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for
110
+ the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
111
+
112
+ The pipeline running on master will deploy a new version of the docker container with the latest version released
113
+ to rubygems.org. Therefore a `rake release` is required before any changes will be reflected in the newly built
114
+ docker container.
82
115
 
83
116
  ## Contributing
84
117
 
85
- Bug reports and pull requests are welcome on GitHub at https://gitlab.com/samuel-garratt/generic_test. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/generic_test/blob/master/CODE_OF_CONDUCT.md).
118
+ Bug reports and pull requests are welcome on GitLab at https://gitlab.com/samuel-garratt/generic_test. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://gitlab.com/samuel-garratt/generic_test/-/blob/master/CODE_OF_CONDUCT.md).
86
119
 
87
120
  ## License
88
121
 
data/exe/generic_test CHANGED
@@ -16,7 +16,7 @@ class Exe < Thor
16
16
  desc = ENV['PAGE_URL'].split('://').last.tr('/', '_')
17
17
  junit_format = "-f RspecJunitFormatter --out logs/page_#{desc}.xml"
18
18
  ENV['REPORT_PATH'] = "reports/#{desc}"
19
- html_format = '--require generic_test/html_reporter -f RspecHtmlReporter'
19
+ html_format = '--format html --out report.html'
20
20
  command = "rspec #{test_file_path} --format documentation --color #{junit_format} #{html_format}"
21
21
  raise $CHILD_STATUS.to_s unless system command
22
22
  end
data/generic_test.gemspec CHANGED
@@ -28,8 +28,6 @@ Gem::Specification.new do |spec|
28
28
  # Development dependencies are installed too since running external tests within gem
29
29
  spec.add_development_dependency 'jekyll' # For hosting test website
30
30
  spec.add_development_dependency 'rake'
31
- spec.add_dependency 'rspec-legacy_formatters' # Needed for rspec_html_reporter after RSpec 3
32
- spec.add_dependency 'rspec_html_reporter' # Pretty HTML reports
33
31
  spec.add_dependency 'rspec_junit_formatter' # Needed for nicer reporting of rspec for use in CI
34
32
  spec.add_dependency 'simplecov' # Code coverage
35
33
 
@@ -39,6 +37,5 @@ Gem::Specification.new do |spec|
39
37
  spec.add_dependency 'spellcheck' # Check for common spelling errors
40
38
  spec.add_dependency 'thor' # Command line utility
41
39
  spec.add_dependency 'watir' # UI interaction
42
- spec.add_dependency 'webdrivers' # Download chromedriver automatically
43
40
  spec.add_dependency 'yamler'
44
41
  end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Mock implementation of Bundler for use by generic_test where Bundler.root is needed
4
- module Bundler
5
- class << self
6
- # Used just so that RSpecHtmlReporter does not thrown an error
7
- def root
8
- ''
9
- end
10
- end
11
- end
12
-
13
- require 'rspec_html_reporter'
@@ -9,7 +9,7 @@ ENV['PAGE_NUM'] ||= '1'
9
9
  browser_args = %w[--disable-popup-blocking --no-sandbox --disable-dev-shm-usage]
10
10
  browser_args << '--headless' if ENV['HEADLESS'] == 'true'
11
11
 
12
- GenericTest.browser = Watir::Browser.new :chrome, args: browser_args
12
+ GenericTest.browser = Watir::Browser.new :chrome, options: { args: browser_args }
13
13
 
14
14
  raise 'PAGE_URL environment variable not set' unless ENV['PAGE_URL']
15
15
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GenericTest
4
- VERSION = '0.1.13'
4
+ VERSION = '0.2.1'
5
5
  end
data/lib/generic_test.rb CHANGED
@@ -5,7 +5,6 @@ require 'generic_test/page'
5
5
  require 'generic_test/checker'
6
6
  require 'spellcheck'
7
7
  require 'watir'
8
- require 'webdrivers'
9
8
 
10
9
  # Handles testing of sites generically for common issues
11
10
  module GenericTest
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: generic_test
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Garratt
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-04 00:00:00.000000000 Z
11
+ date: 2024-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -38,34 +38,6 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: rspec-legacy_formatters
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: rspec_html_reporter
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
41
  - !ruby/object:Gem::Dependency
70
42
  name: rspec_junit_formatter
71
43
  requirement: !ruby/object:Gem::Requirement
@@ -178,20 +150,6 @@ dependencies:
178
150
  - - ">="
179
151
  - !ruby/object:Gem::Version
180
152
  version: '0'
181
- - !ruby/object:Gem::Dependency
182
- name: webdrivers
183
- requirement: !ruby/object:Gem::Requirement
184
- requirements:
185
- - - ">="
186
- - !ruby/object:Gem::Version
187
- version: '0'
188
- type: :runtime
189
- prerelease: false
190
- version_requirements: !ruby/object:Gem::Requirement
191
- requirements:
192
- - - ">="
193
- - !ruby/object:Gem::Version
194
- version: '0'
195
153
  - !ruby/object:Gem::Dependency
196
154
  name: yamler
197
155
  requirement: !ruby/object:Gem::Requirement
@@ -250,7 +208,7 @@ metadata:
250
208
  homepage_uri: https://gitlab.com/samuel-garratt/generic_test
251
209
  source_code_uri: https://gitlab.com/samuel-garratt/generic_test
252
210
  changelog_uri: https://gitlab.com/samuel-garratt/generic_test/blob/master/ChangeLog
253
- post_install_message:
211
+ post_install_message:
254
212
  rdoc_options: []
255
213
  require_paths:
256
214
  - lib
@@ -265,8 +223,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
265
223
  - !ruby/object:Gem::Version
266
224
  version: '0'
267
225
  requirements: []
268
- rubygems_version: 3.0.6
269
- signing_key:
226
+ rubygems_version: 3.2.3
227
+ signing_key:
270
228
  specification_version: 4
271
229
  summary: Generic tests for a website/api.
272
230
  test_files: []