generic_test 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +1 -3
- data/ChangeLog +3 -0
- data/exe/generic_test +2 -1
- data/lib/generic_test/page.rb +2 -2
- data/lib/generic_test/setup.rb +1 -1
- data/lib/generic_test/version.rb +1 -1
- data/spec/generic_test_spec.rb +27 -1
- data/test_site/about.html +2 -1
- data/test_site/sub_page.html +14 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa5ac1b64df0509fe04187e155f7a5ea61d91abe6e69118f907128dd5debd536
|
4
|
+
data.tar.gz: 0d969885b9c68bc367ef7a0e2f3e57e273106fb23850247c42ca9df58af69d01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bafdce738fd92376ee241cf140413ff55e82def63a08a26ff7288714daa424f588dce326f66729d5b7aa3647593c4c6351bc89956e7af02161553d664fa3220c
|
7
|
+
data.tar.gz: b0c8409d760eed8c9df56837c8b98652e7166f801faf7cb4d66abd3d520c109804e6222ec1c6b9f9ed42ff55f344937c97c36ce016e21a8af50c383126ed0be9
|
data/.gitlab-ci.yml
CHANGED
data/ChangeLog
CHANGED
data/exe/generic_test
CHANGED
@@ -26,7 +26,8 @@ class Exe < Thor
|
|
26
26
|
ENV['REPORT_PATH'] = "reports/#{desc}"
|
27
27
|
html_format = '--format html --out logs/report.html'
|
28
28
|
command = "rspec #{test_file_path} --format documentation --color #{junit_format} #{html_format}"
|
29
|
-
|
29
|
+
exit(1) unless system command
|
30
|
+
#raise $CHILD_STATUS.to_s unless system command
|
30
31
|
end
|
31
32
|
|
32
33
|
desc 'version', 'Version of generic_test'
|
data/lib/generic_test/page.rb
CHANGED
@@ -3,9 +3,9 @@
|
|
3
3
|
module GenericTest
|
4
4
|
# Represents a web page state at a particular point of time
|
5
5
|
class Page
|
6
|
-
# @return [Array] List of links
|
6
|
+
# @return [Array] List of links elements on the page
|
7
7
|
attr_accessor :links
|
8
|
-
# @return [Array] List of
|
8
|
+
# @return [Array] List of urls that include domain being tested
|
9
9
|
attr_accessor :internal_links
|
10
10
|
# @return [Array] List of emails
|
11
11
|
attr_accessor :emails
|
data/lib/generic_test/setup.rb
CHANGED
@@ -42,5 +42,5 @@ sleep 2.5 # Give a bit of time for page to load
|
|
42
42
|
puts "Checking #{ENV['PAGE_URL']} (#{browser.title})"
|
43
43
|
GenericTest.pages << GenericTest::Page.new(browser)
|
44
44
|
if GenericTest.all_subpages
|
45
|
-
puts "Subpages include #{GenericTest.pages.first.internal_links }"
|
45
|
+
puts "Subpages include #{GenericTest.pages.first.internal_links.count } links"
|
46
46
|
end
|
data/lib/generic_test/version.rb
CHANGED
data/spec/generic_test_spec.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
# Used by executable to verify a particular web page
|
4
4
|
require 'generic_test/setup'
|
5
5
|
page = GenericTest.pages.first
|
6
|
+
checkmark = "\u2713"
|
6
7
|
links = page.links
|
7
8
|
RSpec.describe "#{page.title} Links respond" do
|
8
9
|
links.each_with_index do |link, index|
|
@@ -19,10 +20,16 @@ RSpec.describe "#{page.title} Links respond" do
|
|
19
20
|
end
|
20
21
|
|
21
22
|
if GenericTest.all_subpages
|
23
|
+
extra_subpage_links = []
|
22
24
|
browser = GenericTest.browser
|
23
25
|
page.internal_links.each do |href|
|
24
26
|
browser.goto href
|
25
27
|
sub_page = GenericTest::Page.new(browser)
|
28
|
+
sub_page.internal_links.each do |internal_link|
|
29
|
+
extra_subpage_links << internal_link unless page.internal_links.include? internal_link
|
30
|
+
end
|
31
|
+
extra_subpage_links.uniq!
|
32
|
+
puts "Extra subpage links #{extra_subpage_links.count}"
|
26
33
|
RSpec.describe "Subpage #{browser.title} #{href}" do
|
27
34
|
sub_page.links.each_with_index do |link, index|
|
28
35
|
link_text = link.text.to_s.empty? ? '' : " \"#{link.text}\""
|
@@ -34,7 +41,26 @@ if GenericTest.all_subpages
|
|
34
41
|
expect(Checker.link_status(link_href)).to be_between 200, 399
|
35
42
|
end
|
36
43
|
end
|
37
|
-
puts "Checking #{GenericTest.tested_links.count} non duplicate links"
|
44
|
+
puts "#{checkmark} Checking #{GenericTest.tested_links.count} non duplicate links"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
extra_subpage_links.each do |href|
|
49
|
+
browser.goto href
|
50
|
+
sub_page = GenericTest::Page.new(browser)
|
51
|
+
|
52
|
+
RSpec.describe "Subpage lv 2 #{browser.title} #{href}" do
|
53
|
+
sub_page.links.each_with_index do |link, index|
|
54
|
+
link_text = link.text.to_s.empty? ? '' : " \"#{link.text}\""
|
55
|
+
next if GenericTest.tested_links.include? link.href
|
56
|
+
|
57
|
+
GenericTest.tested_links << link.href
|
58
|
+
link_href = link.href
|
59
|
+
it "Link (#{GenericTest.tested_links.count})#{link_text} to '#{link.href}' succeeds" do
|
60
|
+
expect(Checker.link_status(link_href)).to be_between 200, 399
|
61
|
+
end
|
62
|
+
end
|
63
|
+
puts "#{checkmark} Checking #{GenericTest.tested_links.count} non duplicate links (lv2)"
|
38
64
|
end
|
39
65
|
end
|
40
66
|
end
|
data/test_site/about.html
CHANGED
@@ -10,7 +10,8 @@
|
|
10
10
|
Generic test page makes things easy
|
11
11
|
All tests in this page work
|
12
12
|
</p>
|
13
|
-
<a href="
|
13
|
+
<a href="sub_page.html">Sub page</a>
|
14
14
|
<a href="mailto:samuel.garratt@integrationqa.com">Email me</a>
|
15
|
+
<a href="tel:021234567">Ignore telephone</a>
|
15
16
|
</body>
|
16
17
|
</html>
|
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.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Garratt
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-07-
|
11
|
+
date: 2024-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -201,6 +201,7 @@ files:
|
|
201
201
|
- test_site/about.html
|
202
202
|
- test_site/index.html
|
203
203
|
- test_site/login_page.html
|
204
|
+
- test_site/sub_page.html
|
204
205
|
homepage: https://gitlab.com/samuel-garratt/generic_test
|
205
206
|
licenses:
|
206
207
|
- MIT
|