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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ffa3efa41fd3a9b55a1ab5a258d235dbc66a1b49140e860a0dc14fa7171d1c54
4
- data.tar.gz: 6661eaf0388ee25e92d75d4db9a9c9cd4c30b2a3415729fb4d5679e0661cfe78
3
+ metadata.gz: fa5ac1b64df0509fe04187e155f7a5ea61d91abe6e69118f907128dd5debd536
4
+ data.tar.gz: 0d969885b9c68bc367ef7a0e2f3e57e273106fb23850247c42ca9df58af69d01
5
5
  SHA512:
6
- metadata.gz: 430e5e3e718cffbf314033ae023382f160f7abb6f3ac81bba0de0abac0cc084ce784484c94707aa048c2f9486fd6c248eb51eeda73f011f25a246caa42647bca
7
- data.tar.gz: bcdaa788d1a6148c836de1785c45340dcb9a15608573590eca035915c9fa7eed4003d46f060c750e241d3d06fa051f98ec42293f8f4834665208f99241e9ecfe
6
+ metadata.gz: bafdce738fd92376ee241cf140413ff55e82def63a08a26ff7288714daa424f588dce326f66729d5b7aa3647593c4c6351bc89956e7af02161553d664fa3220c
7
+ data.tar.gz: b0c8409d760eed8c9df56837c8b98652e7166f801faf7cb4d66abd3d520c109804e6222ec1c6b9f9ed42ff55f344937c97c36ce016e21a8af50c383126ed0be9
data/.gitlab-ci.yml CHANGED
@@ -21,9 +21,7 @@ docker_build:
21
21
  only:
22
22
  - master
23
23
  needs: ["test"]
24
- except:
25
- changes:
26
- - "*.md"
24
+ when: manual
27
25
 
28
26
  test:
29
27
  image: registry.gitlab.com/samuel-garratt/generic_test
data/ChangeLog CHANGED
@@ -1,3 +1,6 @@
1
+ Version 0.3.1
2
+ * Going through subpages goes 1 level deeper to subpages of subpages
3
+
1
4
  Version 0.3.0
2
5
  * Added option to test all subpages and skip spellcheck
3
6
 
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
- raise $CHILD_STATUS.to_s unless system command
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'
@@ -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 links that include domain being tested
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
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GenericTest
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.1'
5
5
  end
@@ -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="index.html">Index page</a>
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>
@@ -0,0 +1,14 @@
1
+ <html>
2
+ <head>
3
+ <title>Sub page</title>
4
+ </head>
5
+ <body>
6
+ <header>
7
+ <h1>Sub page</h1>
8
+ </header>
9
+ <p>
10
+ This is a sub page
11
+ </p>
12
+ <a href="about.html">About</a>
13
+ </body>
14
+ </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.0
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-10 00:00:00.000000000 Z
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