ruby_raider 3.6.0 → 3.8.0
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 +4 -4
- data/README.md +1 -2
- data/RELEASE.md +7 -0
- data/lib/generators/common_generator.rb +0 -6
- data/lib/generators/helper_generator.rb +0 -7
- data/lib/generators/infrastructure/templates/azure_pipelines.tt +2 -1
- data/lib/generators/infrastructure/templates/github.tt +2 -34
- data/lib/generators/infrastructure/templates/github_appium.tt +6 -4
- data/lib/generators/templates/common/gemfile.tt +1 -5
- data/lib/generators/templates/common/git_ignore.tt +0 -3
- data/lib/generators/templates/common/read_me.tt +16 -7
- data/lib/generators/templates/helpers/partials/screenshot.tt +3 -3
- data/lib/generators/templates/helpers/spec_helper.tt +0 -6
- data/lib/version +1 -1
- data/sig/generators/common_generator.rbs +0 -1
- data/sig/generators/helper_generator.rbs +0 -2
- data/spec/integration/content/azure_content_spec.rb +4 -3
- data/spec/integration/content/ci_content_spec.rb +18 -11
- data/spec/integration/content/common_content_spec.rb +2 -2
- data/spec/integration/content/gemfile_content_spec.rb +6 -6
- data/spec/integration/content/helper_content_spec.rb +3 -42
- data/spec/integration/content/readme_content_spec.rb +11 -2
- data/spec/integration/content/rspec_reporter_content_spec.rb +26 -0
- data/spec/integration/end_to_end_spec.rb +8 -8
- data/spec/integration/generators/helpers_generator_spec.rb +2 -6
- metadata +3 -8
- data/lib/generators/templates/helpers/allure_helper.tt +0 -32
- data/lib/generators/templates/helpers/partials/allure_imports.tt +0 -7
- data/lib/generators/templates/helpers/partials/allure_requirements.tt +0 -8
- data/lib/generators/templates/helpers/partials/video_start.tt +0 -9
- data/lib/generators/templates/helpers/partials/video_stop.tt +0 -4
- data/lib/generators/templates/helpers/test_helper.tt +0 -88
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9cd1d87871eeb4bad99f5952f35a7f81da1f54d9170536ebd959ebe19403d63d
|
|
4
|
+
data.tar.gz: 0bdb788bce2e8245483176ebe5118ff046fef892ae8767d74986384d9747deba
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0a9f31493361abd7af6a78f8afe18a7d6f82569c364ed08c17445705bc3e0e5ef770a0da54b927139996393622a49306433b8aa0deccd61483a8af724b432fcc
|
|
7
|
+
data.tar.gz: 85c9d92cf395f858f4c2977a382c96385ebb82992cdc6ad100477ed8c9d91f34a6ea302a3cea26a612e5b682b4ad1b3d398449420abc6e5f58c3b5eaa8ccebbb
|
data/README.md
CHANGED
|
@@ -60,8 +60,7 @@ Every generated project comes with:
|
|
|
60
60
|
|
|
61
61
|
- **Page Object Model** — Base page and component classes with example pages
|
|
62
62
|
- **Test examples** — Working login tests against the [Raider Test Store](https://raider-test-site.onrender.com/)
|
|
63
|
-
- **
|
|
64
|
-
- **Raider reporting** — RSpec and Cucumber projects include [raider_reporter](https://github.com/RaiderHQ/raider_reporter), which writes results to `raider-results/` and uploads runs when `RAIDER_TOKEN` and `RAIDER_ENDPOINT` are set
|
|
63
|
+
- **Raider reporting** — RSpec and Cucumber projects include [raider_reporter](https://github.com/RaiderHQ/raider_reporter), which writes results to `raider-results/` and uploads runs when `RAIDER_TOKEN` and `RAIDER_ENDPOINT` are set; generated CI runs the suite through `raider-reporter exec` with `RAIDER_QUARANTINE`, so quarantined tests do not fail the build
|
|
65
64
|
- **GitHub Actions CI** — Ready-to-use test pipeline
|
|
66
65
|
- **Rake tasks** — Default, smoke, and regression tasks with tag-based filtering
|
|
67
66
|
- **Retry support** — RSpec retry with configurable retry count via `RETRY_COUNT` env var
|
data/RELEASE.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
## Release Notes
|
|
4
4
|
|
|
5
|
+
### 3.7.0
|
|
6
|
+
|
|
7
|
+
- Generated RSpec projects no longer include Allure: the `allure-rspec` and `allure-ruby-commons` gems, `helpers/allure_helper.rb`, the `allure-results` folder and `.gitignore` entry, and the Allure report and gh-pages steps in the GitHub Actions workflow are gone. `raider_reporter` is now the only reporter.
|
|
8
|
+
- Generated Gemfiles now require `raider_reporter` `~> 0.7`, which writes a browsable `raider-results/index.html` next to `run.json`; `bundle exec raider-reporter report` rebuilds it.
|
|
9
|
+
- The generated Readme's Reporting section points to the local HTML report; failure screenshots are attached to the report and to Raider.
|
|
10
|
+
- The unused `test_helper` and `video_stop` templates (Allure-only) are removed.
|
|
11
|
+
|
|
5
12
|
### 3.6.0
|
|
6
13
|
|
|
7
14
|
- New `ci` parameter: `raider new my_project -p framework:rspec automation:selenium ci:azure` generates an `azure-pipelines.yml` for web projects instead of the GitHub Actions workflow. `ci:github` (the default) is unchanged; any other value fails with `Invalid parameters: ci must be github or azure`.
|
|
@@ -7,18 +7,11 @@ class HelpersGenerator < Generator
|
|
|
7
7
|
generate_browser_helper
|
|
8
8
|
generate_driver_helper
|
|
9
9
|
generate_appium_helper
|
|
10
|
-
generate_allure_helper
|
|
11
10
|
generate_spec_helper
|
|
12
11
|
end
|
|
13
12
|
|
|
14
13
|
private
|
|
15
14
|
|
|
16
|
-
def generate_allure_helper
|
|
17
|
-
return if cucumber?
|
|
18
|
-
|
|
19
|
-
template('helpers/allure_helper.tt', "#{name}/helpers/allure_helper.rb")
|
|
20
|
-
end
|
|
21
|
-
|
|
22
15
|
def generate_browser_helper
|
|
23
16
|
return if selenium_based? || mobile?
|
|
24
17
|
|
|
@@ -21,11 +21,12 @@ jobs:
|
|
|
21
21
|
inputs: { versionSpec: '3.4' }
|
|
22
22
|
- script: bundle install
|
|
23
23
|
displayName: Install gems
|
|
24
|
-
- script: <%- if cucumber? -%>bundle exec cucumber features/ --format pretty<%- else -%>bundle exec rspec spec/ --format documentation<%- end %>
|
|
24
|
+
- script: <%- if cucumber? -%>bundle exec raider-reporter exec -- bundle exec cucumber features/ --format pretty<%- else -%>bundle exec raider-reporter exec -- bundle exec rspec spec/ --format documentation<%- end %>
|
|
25
25
|
displayName: Run tests
|
|
26
26
|
env:
|
|
27
27
|
RAIDER_TOKEN: $(RAIDER_TOKEN)
|
|
28
28
|
RAIDER_ENDPOINT: $(RAIDER_ENDPOINT)
|
|
29
|
+
RAIDER_QUARANTINE: 1
|
|
29
30
|
- task: PublishPipelineArtifact@1
|
|
30
31
|
condition: always()
|
|
31
32
|
inputs: { targetPath: raider-results, artifact: raider-results-$(System.JobPositionInPhase)-$(System.JobAttempt) }
|
|
@@ -33,17 +33,13 @@ jobs:
|
|
|
33
33
|
with:
|
|
34
34
|
chrome-version: stable
|
|
35
35
|
|
|
36
|
-
<%- unless framework == 'cucumber' -%>
|
|
37
|
-
- name: Create allure-results folder
|
|
38
|
-
run: mkdir -p allure-results
|
|
39
|
-
|
|
40
|
-
<%- end -%>
|
|
41
36
|
- name: Run tests
|
|
42
|
-
run: <%- if framework == 'cucumber' -%>bundle exec cucumber features --format pretty<%- else -%>bundle exec rspec spec --format documentation<%- end %>
|
|
37
|
+
run: <%- if framework == 'cucumber' -%>bundle exec raider-reporter exec -- bundle exec cucumber features --format pretty<%- else -%>bundle exec raider-reporter exec -- bundle exec rspec spec --format documentation<%- end %>
|
|
43
38
|
env:
|
|
44
39
|
HEADLESS: true
|
|
45
40
|
RAIDER_TOKEN: ${{ secrets.RAIDER_TOKEN }}
|
|
46
41
|
RAIDER_ENDPOINT: ${{ vars.RAIDER_ENDPOINT }}
|
|
42
|
+
RAIDER_QUARANTINE: "1"
|
|
47
43
|
|
|
48
44
|
- name: Upload Raider results
|
|
49
45
|
uses: actions/upload-artifact@v4
|
|
@@ -53,34 +49,6 @@ jobs:
|
|
|
53
49
|
path: raider-results/
|
|
54
50
|
if-no-files-found: ignore
|
|
55
51
|
|
|
56
|
-
<%- unless framework == 'cucumber' -%>
|
|
57
|
-
- name: Get Allure history
|
|
58
|
-
uses: actions/checkout@v2
|
|
59
|
-
if: always()
|
|
60
|
-
continue-on-error: true
|
|
61
|
-
with:
|
|
62
|
-
ref: gh-pages
|
|
63
|
-
path: gh-pages
|
|
64
|
-
|
|
65
|
-
- name: Allure Report
|
|
66
|
-
uses: simple-elf/allure-report-action@master
|
|
67
|
-
if: always()
|
|
68
|
-
id: allure-report
|
|
69
|
-
with:
|
|
70
|
-
allure_results: allure-results
|
|
71
|
-
gh_pages: gh-pages
|
|
72
|
-
allure_report: allure-report
|
|
73
|
-
allure_history: allure-history
|
|
74
|
-
|
|
75
|
-
- name: Deploy report to Github Pages
|
|
76
|
-
if: always()
|
|
77
|
-
uses: peaceiris/actions-gh-pages@v2
|
|
78
|
-
env:
|
|
79
|
-
PERSONAL_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
80
|
-
PUBLISH_BRANCH: gh-pages
|
|
81
|
-
PUBLISH_DIR: allure-history
|
|
82
|
-
|
|
83
|
-
<%- end -%>
|
|
84
52
|
raider-comment:
|
|
85
53
|
needs: [build]
|
|
86
54
|
if: always() && github.event_name == 'pull_request'
|
|
@@ -46,14 +46,15 @@ jobs:
|
|
|
46
46
|
|
|
47
47
|
- name: Run tests
|
|
48
48
|
<%- if cucumber? -%>
|
|
49
|
-
run: bundle exec cucumber features/ --format pretty
|
|
49
|
+
run: bundle exec raider-reporter exec -- bundle exec cucumber features/ --format pretty
|
|
50
50
|
<%- else -%>
|
|
51
|
-
run: bundle exec rspec spec/ --format documentation
|
|
51
|
+
run: bundle exec raider-reporter exec -- bundle exec rspec spec/ --format documentation
|
|
52
52
|
<%- end -%>
|
|
53
53
|
env:
|
|
54
54
|
APP_PATH: ${{ github.workspace }}/apps/RaiderTestApp.app
|
|
55
55
|
RAIDER_TOKEN: ${{ secrets.RAIDER_TOKEN }}
|
|
56
56
|
RAIDER_ENDPOINT: ${{ vars.RAIDER_ENDPOINT }}
|
|
57
|
+
RAIDER_QUARANTINE: "1"
|
|
57
58
|
|
|
58
59
|
- name: Upload Raider results
|
|
59
60
|
uses: actions/upload-artifact@v4
|
|
@@ -105,14 +106,15 @@ jobs:
|
|
|
105
106
|
profile: pixel_8
|
|
106
107
|
script: |
|
|
107
108
|
<%- if cucumber? -%>
|
|
108
|
-
bundle exec cucumber features/ --format pretty
|
|
109
|
+
bundle exec raider-reporter exec -- bundle exec cucumber features/ --format pretty
|
|
109
110
|
<%- else -%>
|
|
110
|
-
bundle exec rspec spec/ --format documentation
|
|
111
|
+
bundle exec raider-reporter exec -- bundle exec rspec spec/ --format documentation
|
|
111
112
|
<%- end -%>
|
|
112
113
|
env:
|
|
113
114
|
APP_PATH: ${{ github.workspace }}/apps/app-release.apk
|
|
114
115
|
RAIDER_TOKEN: ${{ secrets.RAIDER_TOKEN }}
|
|
115
116
|
RAIDER_ENDPOINT: ${{ vars.RAIDER_ENDPOINT }}
|
|
117
|
+
RAIDER_QUARANTINE: "1"
|
|
116
118
|
|
|
117
119
|
- name: Upload Raider results
|
|
118
120
|
uses: actions/upload-artifact@v4
|
|
@@ -5,10 +5,6 @@ gem 'activesupport'
|
|
|
5
5
|
gem 'appium_lib'
|
|
6
6
|
gem 'appium_console'
|
|
7
7
|
<% end %>
|
|
8
|
-
<%- if rspec? -%>
|
|
9
|
-
gem 'allure-rspec', '2.28.0'
|
|
10
|
-
gem 'allure-ruby-commons', '2.28.0'
|
|
11
|
-
<%- end -%>
|
|
12
8
|
<%- if axe_addon? -%>
|
|
13
9
|
gem 'axe-core-rspec'
|
|
14
10
|
gem 'axe-core-selenium'
|
|
@@ -17,7 +13,7 @@ gem 'parallel_split_test'
|
|
|
17
13
|
gem 'parallel_tests'
|
|
18
14
|
gem 'rake'
|
|
19
15
|
gem 'reek'
|
|
20
|
-
gem 'raider_reporter', '~> 0.
|
|
16
|
+
gem 'raider_reporter', '~> 0.8'
|
|
21
17
|
<%- if rspec? -%>
|
|
22
18
|
gem 'rspec-retry'
|
|
23
19
|
<%- end -%>
|
|
@@ -85,10 +85,11 @@ raider g scaffold [NAME] # Create page + test + steps
|
|
|
85
85
|
## Reporting
|
|
86
86
|
|
|
87
87
|
<%- if rspec? -%>
|
|
88
|
-
Every run writes machine-readable results to `raider-results/` (including `run.json`)
|
|
89
|
-
|
|
88
|
+
Every run writes machine-readable results to `raider-results/` (including `run.json`) and a browsable report,
|
|
89
|
+
`raider-results/index.html`. Open it in a browser after a run; `bundle exec raider-reporter report` rebuilds it.
|
|
90
90
|
<%- else -%>
|
|
91
|
-
Every run writes machine-readable results to `raider-results/` (including `run.json`)
|
|
91
|
+
Every run writes machine-readable results to `raider-results/` (including `run.json`) and a browsable report,
|
|
92
|
+
`raider-results/index.html`. The reporter runs in plugin mode:
|
|
92
93
|
`features/support/env.rb` requires `raider_reporter/cucumber`, so no extra Cucumber formatter flag is needed.
|
|
93
94
|
<%- end -%>
|
|
94
95
|
|
|
@@ -100,13 +101,21 @@ export RAIDER_ENDPOINT=https://your-raider-endpoint
|
|
|
100
101
|
```
|
|
101
102
|
|
|
102
103
|
<%- if rspec? -%>
|
|
103
|
-
Without `RAIDER_TOKEN`, nothing is uploaded and the suite output is unchanged. Failure screenshots are attached to
|
|
104
|
-
|
|
104
|
+
Without `RAIDER_TOKEN`, nothing is uploaded and the suite output is unchanged. Failure screenshots are attached to the
|
|
105
|
+
report and to Raider. See the [raider_reporter README](https://github.com/RaiderHQ/raider_reporter) for details.
|
|
105
106
|
<%- else -%>
|
|
106
|
-
Without `RAIDER_TOKEN`, nothing is uploaded and the suite output is unchanged. Failure screenshots are attached to
|
|
107
|
-
Raider. See the [raider_reporter README](https://github.com/RaiderHQ/raider_reporter) for details.
|
|
107
|
+
Without `RAIDER_TOKEN`, nothing is uploaded and the suite output is unchanged. Failure screenshots are attached to the
|
|
108
|
+
report and to Raider. See the [raider_reporter README](https://github.com/RaiderHQ/raider_reporter) for details.
|
|
108
109
|
<%- end -%>
|
|
109
110
|
|
|
111
|
+
<%- unless azure? && mobile? -%>
|
|
112
|
+
### Quarantine
|
|
113
|
+
|
|
114
|
+
CI runs the suite through `bundle exec raider-reporter exec -- …` with `RAIDER_QUARANTINE` set. Tests quarantined in
|
|
115
|
+
Raider still run and are still reported (as `quarantined`), and a build whose only failures are quarantined stays green.
|
|
116
|
+
Local runs keep quarantine off. To turn it off in CI, remove `RAIDER_QUARANTINE` from the pipeline.
|
|
117
|
+
|
|
118
|
+
<%- end -%>
|
|
110
119
|
<%- if azure? && mobile? -%>
|
|
111
120
|
## CI
|
|
112
121
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<% if selenium_based? %>
|
|
2
|
-
|
|
2
|
+
driver.save_screenshot(screenshot_path)
|
|
3
3
|
<% elsif watir? %>
|
|
4
|
-
|
|
4
|
+
browser.screenshot.save(screenshot_path)
|
|
5
5
|
<% else %>
|
|
6
|
-
|
|
6
|
+
driver.screenshot(screenshot_path)
|
|
7
7
|
<% end %>
|
|
@@ -5,10 +5,8 @@ require 'axe-rspec'
|
|
|
5
5
|
<%- end -%>
|
|
6
6
|
require 'rspec'
|
|
7
7
|
require 'rspec/retry'
|
|
8
|
-
require 'digest'
|
|
9
8
|
require 'raider_reporter/rspec'
|
|
10
9
|
require 'tmpdir'
|
|
11
|
-
require_relative 'allure_helper'
|
|
12
10
|
<%- if watir? -%>
|
|
13
11
|
require_relative 'browser_helper'
|
|
14
12
|
<%- else -%>
|
|
@@ -16,14 +14,11 @@ require_relative 'driver_helper'
|
|
|
16
14
|
<%- end -%>
|
|
17
15
|
|
|
18
16
|
module SpecHelper
|
|
19
|
-
|
|
20
|
-
AllureHelper.configure
|
|
21
17
|
RSpec.configure do |config|
|
|
22
18
|
config.example_status_persistence_file_path = 'spec/examples.txt'
|
|
23
19
|
config.verbose_retry = true
|
|
24
20
|
config.display_try_failure_messages = true
|
|
25
21
|
config.default_retry_count = ENV.fetch('RETRY_COUNT', 0).to_i
|
|
26
|
-
config.add_formatter(AllureHelper.formatter)
|
|
27
22
|
config.add_formatter(RaiderReporter::RSpec::Formatter)
|
|
28
23
|
<%- if watir? -%>
|
|
29
24
|
config.include(BrowserHelper)
|
|
@@ -59,7 +54,6 @@ module SpecHelper
|
|
|
59
54
|
Dir.mktmpdir do |temp_folder|
|
|
60
55
|
screenshot_path = "#{temp_folder}/#{example_name}.png"
|
|
61
56
|
<%= partial('screenshot', strip: true) %>
|
|
62
|
-
AllureHelper.add_screenshot(example_name, screenshot)
|
|
63
57
|
RaiderReporter.attach('screenshot', screenshot_path, type: :png)
|
|
64
58
|
end
|
|
65
59
|
end
|
data/lib/version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.
|
|
1
|
+
3.8.0
|
|
@@ -27,9 +27,9 @@ describe 'Azure Pipelines content' do
|
|
|
27
27
|
let(:yml) { YAML.safe_load(raw) }
|
|
28
28
|
let(:run_command) do
|
|
29
29
|
if framework == 'cucumber'
|
|
30
|
-
'bundle exec cucumber features/ --format pretty'
|
|
30
|
+
'bundle exec raider-reporter exec -- bundle exec cucumber features/ --format pretty'
|
|
31
31
|
else
|
|
32
|
-
'bundle exec rspec spec/ --format documentation'
|
|
32
|
+
'bundle exec raider-reporter exec -- bundle exec rspec spec/ --format documentation'
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
|
|
@@ -49,7 +49,8 @@ describe 'Azure Pipelines content' do
|
|
|
49
49
|
|
|
50
50
|
it 'passes exactly the Raider settings to the test step' do
|
|
51
51
|
step = yml['jobs'][0]['steps'].find { |s| s['script'] == run_command }
|
|
52
|
-
expect(step['env']).to eq('RAIDER_TOKEN' => '$(RAIDER_TOKEN)', 'RAIDER_ENDPOINT' => '$(RAIDER_ENDPOINT)'
|
|
52
|
+
expect(step['env']).to eq('RAIDER_TOKEN' => '$(RAIDER_TOKEN)', 'RAIDER_ENDPOINT' => '$(RAIDER_ENDPOINT)',
|
|
53
|
+
'RAIDER_QUARANTINE' => 1)
|
|
53
54
|
expect(yml['variables']['HEADLESS']).to eq('true')
|
|
54
55
|
end
|
|
55
56
|
|
|
@@ -75,7 +75,18 @@ describe 'CI pipeline content' do
|
|
|
75
75
|
expect(test_steps).not_to be_empty
|
|
76
76
|
test_steps.each do |step|
|
|
77
77
|
expect(step['env']).to include('RAIDER_TOKEN' => '${{ secrets.RAIDER_TOKEN }}',
|
|
78
|
-
'RAIDER_ENDPOINT' => '${{ vars.RAIDER_ENDPOINT }}'
|
|
78
|
+
'RAIDER_ENDPOINT' => '${{ vars.RAIDER_ENDPOINT }}',
|
|
79
|
+
'RAIDER_QUARANTINE' => '1')
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
it 'runs every test command through raider-reporter exec' do
|
|
84
|
+
expect(test_steps).not_to be_empty
|
|
85
|
+
test_steps.each do |step|
|
|
86
|
+
command = step['run'] || step['with']['script']
|
|
87
|
+
wrapped = command.scan(/raider-reporter exec -- bundle exec #{runner}\b/).size
|
|
88
|
+
expect(wrapped).to be_positive
|
|
89
|
+
expect(command.scan(/bundle exec #{runner}\b/).size).to eq(wrapped)
|
|
79
90
|
end
|
|
80
91
|
end
|
|
81
92
|
|
|
@@ -128,20 +139,16 @@ describe 'CI pipeline content' do
|
|
|
128
139
|
end
|
|
129
140
|
end
|
|
130
141
|
|
|
131
|
-
shared_examples 'github allure steps' do |project_name|
|
|
132
|
-
subject(:pipeline) { read_generated(project_name, '.github/workflows/test_pipeline.yml') }
|
|
133
|
-
|
|
134
|
-
it 'keeps the Allure steps' do
|
|
135
|
-
expect(pipeline).to include('simple-elf/allure-report-action', 'peaceiris/actions-gh-pages')
|
|
136
|
-
end
|
|
137
|
-
end
|
|
138
|
-
|
|
139
142
|
shared_examples 'github without allure steps' do |project_name|
|
|
140
143
|
subject(:pipeline) { read_generated(project_name, '.github/workflows/test_pipeline.yml') }
|
|
141
144
|
|
|
142
145
|
it 'has no Allure report or gh-pages steps' do
|
|
143
146
|
expect(pipeline).not_to match(/allure|gh-pages/i)
|
|
144
147
|
end
|
|
148
|
+
|
|
149
|
+
it 'still uploads raider-results' do
|
|
150
|
+
expect(pipeline).to include('name: raider-results', 'path: raider-results/')
|
|
151
|
+
end
|
|
145
152
|
end
|
|
146
153
|
|
|
147
154
|
context 'with rspec and selenium' do
|
|
@@ -151,7 +158,7 @@ describe 'CI pipeline content' do
|
|
|
151
158
|
include_examples 'github triggers', name, 'test_pipeline.yml'
|
|
152
159
|
include_examples 'github raider wiring', name, 'test_pipeline.yml'
|
|
153
160
|
include_examples 'github raider-comment job', name, 'test_pipeline.yml', %w[build]
|
|
154
|
-
include_examples 'github allure steps', name
|
|
161
|
+
include_examples 'github without allure steps', name
|
|
155
162
|
end
|
|
156
163
|
|
|
157
164
|
context 'with cucumber and selenium' do
|
|
@@ -171,7 +178,7 @@ describe 'CI pipeline content' do
|
|
|
171
178
|
include_examples 'github triggers', name, 'test_pipeline.yml'
|
|
172
179
|
include_examples 'github raider wiring', name, 'test_pipeline.yml'
|
|
173
180
|
include_examples 'github raider-comment job', name, 'test_pipeline.yml', %w[build]
|
|
174
|
-
include_examples 'github allure steps', name
|
|
181
|
+
include_examples 'github without allure steps', name
|
|
175
182
|
end
|
|
176
183
|
|
|
177
184
|
context 'with cucumber and watir' do
|
|
@@ -106,8 +106,8 @@ describe 'Common file content' do
|
|
|
106
106
|
shared_examples 'rspec gitignore' do |project_name|
|
|
107
107
|
subject(:gitignore) { read_generated(project_name, '.gitignore') }
|
|
108
108
|
|
|
109
|
-
it '
|
|
110
|
-
expect(gitignore).
|
|
109
|
+
it 'does not include allure-results' do
|
|
110
|
+
expect(gitignore).not_to include('allure-results')
|
|
111
111
|
end
|
|
112
112
|
|
|
113
113
|
it 'includes spec/examples.txt' do
|
|
@@ -34,8 +34,8 @@ describe 'Gemfile content' do
|
|
|
34
34
|
expect(gemfile).to include("gem 'rspec'")
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
-
it '
|
|
38
|
-
expect(gemfile).
|
|
37
|
+
it 'does not include allure gems' do
|
|
38
|
+
expect(gemfile).not_to match(/allure/i)
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
it 'includes rubocop-rspec' do
|
|
@@ -127,11 +127,11 @@ describe 'Gemfile content' do
|
|
|
127
127
|
let(:gemfile) { read_generated("#{FrameworkIndex::RSPEC}_#{automation}", 'Gemfile') }
|
|
128
128
|
|
|
129
129
|
it 'includes raider_reporter' do
|
|
130
|
-
expect(gemfile).to include("gem 'raider_reporter', '~> 0.
|
|
130
|
+
expect(gemfile).to include("gem 'raider_reporter', '~> 0.8'")
|
|
131
131
|
end
|
|
132
132
|
|
|
133
|
-
it '
|
|
134
|
-
expect(gemfile).
|
|
133
|
+
it 'has no allure gems' do
|
|
134
|
+
expect(gemfile).not_to match(/allure/i)
|
|
135
135
|
end
|
|
136
136
|
|
|
137
137
|
it 'pins ruby_raider to the generator major.minor' do
|
|
@@ -143,7 +143,7 @@ describe 'Gemfile content' do
|
|
|
143
143
|
let(:gemfile) { read_generated("#{FrameworkIndex::CUCUMBER}_#{automation}", 'Gemfile') }
|
|
144
144
|
|
|
145
145
|
it 'includes raider_reporter' do
|
|
146
|
-
expect(gemfile).to include("gem 'raider_reporter', '~> 0.
|
|
146
|
+
expect(gemfile).to include("gem 'raider_reporter', '~> 0.8'")
|
|
147
147
|
end
|
|
148
148
|
|
|
149
149
|
it 'drops allure-cucumber' do
|
|
@@ -103,10 +103,6 @@ describe 'Helper file content' do
|
|
|
103
103
|
it 'configures RSpec' do
|
|
104
104
|
expect(helper).to include('RSpec.configure')
|
|
105
105
|
end
|
|
106
|
-
|
|
107
|
-
it 'requires allure_helper' do
|
|
108
|
-
expect(helper).to include("require_relative 'allure_helper'")
|
|
109
|
-
end
|
|
110
106
|
end
|
|
111
107
|
|
|
112
108
|
shared_examples 'raider reporter spec helper' do |project_name, screenshot_call|
|
|
@@ -116,10 +112,6 @@ describe 'Helper file content' do
|
|
|
116
112
|
expect(helper).to include("require 'raider_reporter/rspec'")
|
|
117
113
|
end
|
|
118
114
|
|
|
119
|
-
it 'requires digest, which allure-ruby-commons uses without requiring' do
|
|
120
|
-
expect(helper).to include("require 'digest'")
|
|
121
|
-
end
|
|
122
|
-
|
|
123
115
|
it 'adds the raider formatter in spec_helper so a command-line --format cannot drop it' do
|
|
124
116
|
expect(helper).to include('config.add_formatter(RaiderReporter::RSpec::Formatter)')
|
|
125
117
|
end
|
|
@@ -128,10 +120,6 @@ describe 'Helper file content' do
|
|
|
128
120
|
expect(helper).not_to match(/config\.formatter\s*=/)
|
|
129
121
|
end
|
|
130
122
|
|
|
131
|
-
it 'adds the allure formatter' do
|
|
132
|
-
expect(helper).to include('config.add_formatter(AllureHelper.formatter)')
|
|
133
|
-
end
|
|
134
|
-
|
|
135
123
|
it 'screenshots only on failure' do
|
|
136
124
|
lines = helper.lines
|
|
137
125
|
start = lines.index { |line| line.include?('if example.exception') }
|
|
@@ -140,8 +128,9 @@ describe 'Helper file content' do
|
|
|
140
128
|
body = lines[(start + 1)..].take_while { |line| line.strip.empty? || line[/\A */].size > indent }
|
|
141
129
|
guarded = body.join
|
|
142
130
|
|
|
143
|
-
expect(guarded).to include('
|
|
144
|
-
expect(
|
|
131
|
+
expect(guarded).to include('RaiderReporter.attach', screenshot_call)
|
|
132
|
+
expect(helper).not_to include('AllureHelper')
|
|
133
|
+
expect(helper).not_to match(/screenshot\s*=/)
|
|
145
134
|
expect(lines.select { |line| line.include?(screenshot_call) }.size).to eq(1)
|
|
146
135
|
end
|
|
147
136
|
|
|
@@ -182,20 +171,6 @@ describe 'Helper file content' do
|
|
|
182
171
|
end
|
|
183
172
|
end
|
|
184
173
|
|
|
185
|
-
# --- Allure helper ---
|
|
186
|
-
|
|
187
|
-
shared_examples 'valid allure helper' do |project_name|
|
|
188
|
-
subject(:helper) { read_generated(project_name, 'helpers/allure_helper.rb') }
|
|
189
|
-
|
|
190
|
-
it 'has valid Ruby syntax' do
|
|
191
|
-
expect(helper).to have_valid_ruby_syntax
|
|
192
|
-
end
|
|
193
|
-
|
|
194
|
-
it 'defines AllureHelper' do
|
|
195
|
-
expect(helper).to match(/AllureHelper|module AllureHelper|class AllureHelper/)
|
|
196
|
-
end
|
|
197
|
-
end
|
|
198
|
-
|
|
199
174
|
# --- RSpec + automation contexts ---
|
|
200
175
|
|
|
201
176
|
context 'with rspec and selenium' do
|
|
@@ -204,7 +179,6 @@ describe 'Helper file content' do
|
|
|
204
179
|
it_behaves_like 'selenium driver helper', name
|
|
205
180
|
it_behaves_like 'valid spec helper', name
|
|
206
181
|
it_behaves_like 'selenium spec helper', name
|
|
207
|
-
it_behaves_like 'valid allure helper', name
|
|
208
182
|
end
|
|
209
183
|
|
|
210
184
|
context 'with rspec and watir' do
|
|
@@ -212,7 +186,6 @@ describe 'Helper file content' do
|
|
|
212
186
|
it_behaves_like 'valid browser helper', name
|
|
213
187
|
it_behaves_like 'valid spec helper', name
|
|
214
188
|
it_behaves_like 'watir spec helper', name
|
|
215
|
-
it_behaves_like 'valid allure helper', name
|
|
216
189
|
end
|
|
217
190
|
|
|
218
191
|
# --- Cucumber + automation contexts (no spec_helper/test_helper) ---
|
|
@@ -228,18 +201,6 @@ describe 'Helper file content' do
|
|
|
228
201
|
it_behaves_like 'valid browser helper', name
|
|
229
202
|
end
|
|
230
203
|
|
|
231
|
-
# --- Mobile contexts (with AppiumRecorder) ---
|
|
232
|
-
|
|
233
|
-
context 'with cucumber and appium android' do
|
|
234
|
-
name = "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::ANDROID}"
|
|
235
|
-
|
|
236
|
-
end
|
|
237
|
-
|
|
238
|
-
context 'with rspec and appium ios' do
|
|
239
|
-
name = "#{FrameworkIndex::RSPEC}_#{AutomationIndex::IOS}"
|
|
240
|
-
|
|
241
|
-
end
|
|
242
|
-
|
|
243
204
|
# --- Raider reporter wiring (every rspec automation) ---
|
|
244
205
|
|
|
245
206
|
AUTOMATION_TYPES.each do |automation|
|
|
@@ -16,8 +16,13 @@ describe 'Generated Readme content' do
|
|
|
16
16
|
'https://github.com/RaiderHQ/raider_reporter')
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
it '
|
|
20
|
-
expect(readme).to
|
|
19
|
+
it 'explains quarantine in CI' do
|
|
20
|
+
expect(readme).to include('### Quarantine', 'RAIDER_QUARANTINE', 'raider-reporter exec')
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it 'points to the local HTML report' do
|
|
24
|
+
expect(readme).to include('raider-results/index.html')
|
|
25
|
+
expect(readme).not_to match(/allure/i)
|
|
21
26
|
end
|
|
22
27
|
end
|
|
23
28
|
|
|
@@ -33,6 +38,10 @@ describe 'Generated Readme content' do
|
|
|
33
38
|
'https://github.com/RaiderHQ/raider_reporter')
|
|
34
39
|
end
|
|
35
40
|
|
|
41
|
+
it 'explains quarantine in CI' do
|
|
42
|
+
expect(readme).to include('### Quarantine', 'RAIDER_QUARANTINE', 'raider-reporter exec')
|
|
43
|
+
end
|
|
44
|
+
|
|
36
45
|
it 'does not mention Allure' do
|
|
37
46
|
expect(readme).not_to match(/allure/i)
|
|
38
47
|
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'content_helper'
|
|
4
|
+
|
|
5
|
+
describe 'RSpec projects without Allure' do
|
|
6
|
+
AUTOMATION_TYPES.each do |automation|
|
|
7
|
+
context "with rspec and #{automation}" do
|
|
8
|
+
let(:project_name) { "#{FrameworkIndex::RSPEC}_#{automation}" }
|
|
9
|
+
|
|
10
|
+
it 'does not mention Allure in any generated file' do
|
|
11
|
+
files = Dir.glob("#{project_name}/**/*", File::FNM_DOTMATCH).select { |f| File.file?(f) }
|
|
12
|
+
files = files.reject { |f| File.binread(f, 512).include?("\x00") }
|
|
13
|
+
expect(files.select { |f| File.read(f).match?(/allure/i) }).to be_empty
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it 'does not generate the allure helper or the allure-results folder' do
|
|
17
|
+
expect(File).not_to exist(File.join(project_name, 'helpers/allure_helper.rb'))
|
|
18
|
+
expect(File).not_to exist(File.join(project_name, 'allure-results'))
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it 'pins raider_reporter 0.8' do
|
|
22
|
+
expect(read_generated(project_name, 'Gemfile')).to include("gem 'raider_reporter', '~> 0.8'")
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -104,10 +104,10 @@ describe 'End-to-End Project Generation and Execution' do
|
|
|
104
104
|
expect(bundle_install(project)).to be true
|
|
105
105
|
end
|
|
106
106
|
|
|
107
|
-
it 'resolves raider_reporter 0.
|
|
107
|
+
it 'resolves raider_reporter 0.8 from RubyGems and ships the raider-reporter executable', :aggregate_failures do
|
|
108
108
|
skip 'Bundle install failed' unless bundle_install(project)
|
|
109
109
|
|
|
110
|
-
expect(File.read(File.join(project, 'Gemfile.lock'))).to match(/^ raider_reporter \(0\.
|
|
110
|
+
expect(File.read(File.join(project, 'Gemfile.lock'))).to match(/^ raider_reporter \(0\.8\.\d+\)$/)
|
|
111
111
|
result = run_in_project(project, 'bundle exec raider-reporter --help', timeout: 60)
|
|
112
112
|
expect(result[:exit_code]).to eq(0), "STDOUT: #{result[:stdout]}\nSTDERR: #{result[:stderr]}"
|
|
113
113
|
expect(result[:stdout] + result[:stderr]).to include('raider-reporter comment')
|
|
@@ -163,11 +163,11 @@ describe 'End-to-End Project Generation and Execution' do
|
|
|
163
163
|
"STDERR: #{result[:stderr]}"
|
|
164
164
|
end
|
|
165
165
|
|
|
166
|
-
it 'resolves raider_reporter 0.
|
|
166
|
+
it 'resolves raider_reporter 0.8 from RubyGems and requires its Cucumber plugin', :aggregate_failures do
|
|
167
167
|
skip 'Bundle install failed' unless bundle_install(project)
|
|
168
168
|
|
|
169
169
|
lockfile = File.read(File.join(project, 'Gemfile.lock'))
|
|
170
|
-
expect(lockfile).to match(/^ raider_reporter \(0\.
|
|
170
|
+
expect(lockfile).to match(/^ raider_reporter \(0\.8\.\d+\)$/)
|
|
171
171
|
expect(File.read(File.join(project, 'features/support/env.rb'))).to include("require 'raider_reporter/cucumber'")
|
|
172
172
|
end
|
|
173
173
|
|
|
@@ -310,12 +310,12 @@ describe 'End-to-End Project Generation and Execution' do
|
|
|
310
310
|
describe 'Selenium + RSpec' do
|
|
311
311
|
let(:project) { generate_azure_project('rspec') }
|
|
312
312
|
|
|
313
|
-
it 'ships azure-pipelines.yml and resolves raider_reporter 0.
|
|
313
|
+
it 'ships azure-pipelines.yml and resolves raider_reporter 0.8', :aggregate_failures do
|
|
314
314
|
expect(File).to exist(File.join(project, 'azure-pipelines.yml'))
|
|
315
315
|
expect(File).not_to exist(File.join(project, '.github/workflows'))
|
|
316
316
|
skip 'Bundle install failed' unless bundle_install(project)
|
|
317
317
|
|
|
318
|
-
expect(File.read(File.join(project, 'Gemfile.lock'))).to match(/^ raider_reporter \(0\.
|
|
318
|
+
expect(File.read(File.join(project, 'Gemfile.lock'))).to match(/^ raider_reporter \(0\.8\.\d+\)$/)
|
|
319
319
|
end
|
|
320
320
|
|
|
321
321
|
it 'records provider azure_pipelines and an azure_pipelines: build key in run.json', :aggregate_failures, :slow do
|
|
@@ -332,11 +332,11 @@ describe 'End-to-End Project Generation and Execution' do
|
|
|
332
332
|
describe 'Selenium + Cucumber' do
|
|
333
333
|
let(:project) { generate_azure_project('cucumber') }
|
|
334
334
|
|
|
335
|
-
it 'ships azure-pipelines.yml and resolves raider_reporter 0.
|
|
335
|
+
it 'ships azure-pipelines.yml and resolves raider_reporter 0.8', :aggregate_failures do
|
|
336
336
|
expect(File).to exist(File.join(project, 'azure-pipelines.yml'))
|
|
337
337
|
skip 'Bundle install failed' unless bundle_install(project)
|
|
338
338
|
|
|
339
|
-
expect(File.read(File.join(project, 'Gemfile.lock'))).to match(/^ raider_reporter \(0\.
|
|
339
|
+
expect(File.read(File.join(project, 'Gemfile.lock'))).to match(/^ raider_reporter \(0\.8\.\d+\)$/)
|
|
340
340
|
end
|
|
341
341
|
|
|
342
342
|
it 'records provider azure_pipelines and an azure_pipelines: build key in run.json', :aggregate_failures, :slow do
|
|
@@ -5,12 +5,8 @@ require_relative '../spec_helper'
|
|
|
5
5
|
|
|
6
6
|
describe HelpersGenerator do
|
|
7
7
|
shared_examples 'creates common helpers' do |name|
|
|
8
|
-
it 'creates an allure helper file
|
|
9
|
-
|
|
10
|
-
expect(File).not_to exist("#{name}/helpers/allure_helper.rb")
|
|
11
|
-
else
|
|
12
|
-
expect(File).to exist("#{name}/helpers/allure_helper.rb")
|
|
13
|
-
end
|
|
8
|
+
it 'never creates an allure helper file' do
|
|
9
|
+
expect(File).not_to exist("#{name}/helpers/allure_helper.rb")
|
|
14
10
|
end
|
|
15
11
|
end
|
|
16
12
|
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby_raider
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Agustin Pequeno
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-10-
|
|
10
|
+
date: 2026-10-24 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: rake
|
|
@@ -234,22 +234,16 @@ files:
|
|
|
234
234
|
- lib/generators/templates/common/reek.tt
|
|
235
235
|
- lib/generators/templates/common/rspec.tt
|
|
236
236
|
- lib/generators/templates/common/rubocop.tt
|
|
237
|
-
- lib/generators/templates/helpers/allure_helper.tt
|
|
238
237
|
- lib/generators/templates/helpers/appium_helper.tt
|
|
239
238
|
- lib/generators/templates/helpers/browser_helper.tt
|
|
240
239
|
- lib/generators/templates/helpers/driver_helper.tt
|
|
241
|
-
- lib/generators/templates/helpers/partials/allure_imports.tt
|
|
242
|
-
- lib/generators/templates/helpers/partials/allure_requirements.tt
|
|
243
240
|
- lib/generators/templates/helpers/partials/appium_driver.tt
|
|
244
241
|
- lib/generators/templates/helpers/partials/browserstack_config.tt
|
|
245
242
|
- lib/generators/templates/helpers/partials/driver_and_options.tt
|
|
246
243
|
- lib/generators/templates/helpers/partials/quit_driver.tt
|
|
247
244
|
- lib/generators/templates/helpers/partials/screenshot.tt
|
|
248
245
|
- lib/generators/templates/helpers/partials/selenium_driver.tt
|
|
249
|
-
- lib/generators/templates/helpers/partials/video_start.tt
|
|
250
|
-
- lib/generators/templates/helpers/partials/video_stop.tt
|
|
251
246
|
- lib/generators/templates/helpers/spec_helper.tt
|
|
252
|
-
- lib/generators/templates/helpers/test_helper.tt
|
|
253
247
|
- lib/generators/templates/helpers/video_helper.tt
|
|
254
248
|
- lib/ruby_raider.rb
|
|
255
249
|
- lib/scaffolding/name_normalizer.rb
|
|
@@ -315,6 +309,7 @@ files:
|
|
|
315
309
|
- spec/integration/content/helper_content_spec.rb
|
|
316
310
|
- spec/integration/content/page_content_spec.rb
|
|
317
311
|
- spec/integration/content/readme_content_spec.rb
|
|
312
|
+
- spec/integration/content/rspec_reporter_content_spec.rb
|
|
318
313
|
- spec/integration/content/syntax_validation_spec.rb
|
|
319
314
|
- spec/integration/content/test_content_spec.rb
|
|
320
315
|
- spec/integration/end_to_end_features_spec.rb
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
<%=- partial('allure_requirements', trim: false, strip: true) -%>
|
|
4
|
-
<%- allure = partial('allure_imports', trim: false, strip: true) -%>
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
module AllureHelper
|
|
8
|
-
class << self
|
|
9
|
-
def configure
|
|
10
|
-
<%= allure %>.configure do |config|
|
|
11
|
-
config.results_directory = 'allure-results'
|
|
12
|
-
config.clean_results_directory = true
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def add_screenshot(name, file)
|
|
17
|
-
Allure.add_attachment(
|
|
18
|
-
name:,
|
|
19
|
-
source: file,
|
|
20
|
-
type: Allure::ContentType::PNG,
|
|
21
|
-
test_case: true
|
|
22
|
-
)
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
<%- if rspec? -%>
|
|
26
|
-
|
|
27
|
-
def formatter
|
|
28
|
-
AllureRspecFormatter
|
|
29
|
-
end
|
|
30
|
-
<%- end -%>
|
|
31
|
-
end
|
|
32
|
-
end
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
<% if capybara? %>
|
|
2
|
-
@video_recorder = VideoHelper.recorder_for(Capybara.current_session.driver)
|
|
3
|
-
<% elsif selenium_based? %>
|
|
4
|
-
@video_recorder = VideoHelper.recorder_for(driver)
|
|
5
|
-
<% elsif watir? %>
|
|
6
|
-
@video_recorder = VideoHelper.recorder_for(browser)
|
|
7
|
-
<% else %>
|
|
8
|
-
@video_recorder = VideoHelper.recorder_for(driver)
|
|
9
|
-
<% end %>
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
<%- if axe_addon? %>
|
|
4
|
-
require 'axe-minitest'
|
|
5
|
-
<%- end -%>
|
|
6
|
-
require 'minitest/autorun'
|
|
7
|
-
require 'tmpdir'
|
|
8
|
-
<%- if allure_reporter? -%>
|
|
9
|
-
require_relative 'allure_helper'
|
|
10
|
-
<%- end -%>
|
|
11
|
-
<%- unless skip_video? -%>
|
|
12
|
-
require_relative 'video_helper'
|
|
13
|
-
<%- end -%>
|
|
14
|
-
<%- if watir? -%>
|
|
15
|
-
require_relative 'browser_helper'
|
|
16
|
-
<%- elsif capybara? -%>
|
|
17
|
-
require_relative 'capybara_helper'
|
|
18
|
-
<%- else -%>
|
|
19
|
-
require_relative 'driver_helper'
|
|
20
|
-
<%- end -%>
|
|
21
|
-
|
|
22
|
-
<%- if allure_reporter? -%>
|
|
23
|
-
AllureHelper.configure
|
|
24
|
-
<%- end -%>
|
|
25
|
-
<%- if capybara? -%>
|
|
26
|
-
CapybaraHelper.configure
|
|
27
|
-
<%- end -%>
|
|
28
|
-
<%- if json_reporter? -%>
|
|
29
|
-
require 'minitest/reporters'
|
|
30
|
-
Minitest::Reporters.use! [Minitest::Reporters::JsonReporter.new('results/results.json')]
|
|
31
|
-
<%- end -%>
|
|
32
|
-
|
|
33
|
-
module TestHelper
|
|
34
|
-
<% if watir? %>include BrowserHelper<% elsif capybara? %>include Capybara::DSL<% else %>include DriverHelper<% end %>
|
|
35
|
-
|
|
36
|
-
def setup
|
|
37
|
-
super
|
|
38
|
-
<%- if mobile? -%>
|
|
39
|
-
driver.start_driver
|
|
40
|
-
<%- elsif capybara? -%>
|
|
41
|
-
viewport = YAML.load_file('config/config.yml')['viewport']
|
|
42
|
-
if viewport
|
|
43
|
-
Capybara.current_session.driver.browser.manage.window.resize_to(viewport['width'], viewport['height'])
|
|
44
|
-
else
|
|
45
|
-
Capybara.current_session.driver.browser.manage.window.maximize
|
|
46
|
-
end
|
|
47
|
-
<%- elsif watir? -%>
|
|
48
|
-
viewport = YAML.load_file('config/config.yml')['viewport']
|
|
49
|
-
if viewport
|
|
50
|
-
browser.window.resize_to(viewport['width'], viewport['height'])
|
|
51
|
-
else
|
|
52
|
-
browser.window.maximize
|
|
53
|
-
end
|
|
54
|
-
<%- else -%>
|
|
55
|
-
viewport = YAML.load_file('config/config.yml')['viewport']
|
|
56
|
-
if viewport
|
|
57
|
-
driver.manage.window.resize_to(viewport['width'], viewport['height'])
|
|
58
|
-
else
|
|
59
|
-
driver.manage.window.maximize
|
|
60
|
-
end
|
|
61
|
-
<%- end -%>
|
|
62
|
-
<%- unless skip_video? -%>
|
|
63
|
-
<%= partial('video_start', strip: true) %>
|
|
64
|
-
@video_recorder&.start(self.class.name)
|
|
65
|
-
<%- end -%>
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
def teardown
|
|
69
|
-
example_name = name
|
|
70
|
-
<%- unless skip_video? -%>
|
|
71
|
-
video_file = @video_recorder&.stop
|
|
72
|
-
<%- if allure_reporter? -%>
|
|
73
|
-
AllureHelper.add_video(example_name, video_file)
|
|
74
|
-
<%- end -%>
|
|
75
|
-
<%- end -%>
|
|
76
|
-
Dir.mktmpdir do |temp_folder|
|
|
77
|
-
screenshot_path = "#{temp_folder}/#{example_name}.png"
|
|
78
|
-
<%= partial('screenshot', strip: true) %>
|
|
79
|
-
<%- if allure_reporter? -%>
|
|
80
|
-
AllureHelper.add_screenshot(example_name, screenshot)
|
|
81
|
-
<%- end -%>
|
|
82
|
-
end
|
|
83
|
-
<%= partial('quit_driver', strip: true) %>
|
|
84
|
-
super
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
Minitest::Test.include(TestHelper)
|