ruby_raider 1.1.4 → 2.0.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.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/integration.yml +4 -6
  3. data/.github/workflows/reek.yml +6 -5
  4. data/.github/workflows/release.yml +175 -0
  5. data/.github/workflows/rubocop.yml +7 -6
  6. data/.github/workflows/system_tests.yml +83 -0
  7. data/.gitignore +1 -1
  8. data/.rubocop.yml +24 -0
  9. data/README.md +3 -1
  10. data/RELEASE.md +412 -0
  11. data/RELEASE_QUICK_GUIDE.md +77 -0
  12. data/bin/release +186 -0
  13. data/lib/adopter/adopt_menu.rb +150 -0
  14. data/lib/adopter/converters/base_converter.rb +85 -0
  15. data/lib/adopter/converters/identity_converter.rb +56 -0
  16. data/lib/adopter/migration_plan.rb +75 -0
  17. data/lib/adopter/migrator.rb +96 -0
  18. data/lib/adopter/plan_builder.rb +278 -0
  19. data/lib/adopter/project_analyzer.rb +256 -0
  20. data/lib/adopter/project_detector.rb +159 -0
  21. data/lib/commands/adopt_commands.rb +43 -0
  22. data/lib/generators/automation/templates/account.tt +9 -5
  23. data/lib/generators/automation/templates/appium_caps.tt +60 -6
  24. data/lib/generators/automation/templates/home.tt +4 -4
  25. data/lib/generators/automation/templates/login.tt +61 -4
  26. data/lib/generators/automation/templates/page.tt +13 -7
  27. data/lib/generators/automation/templates/partials/home_page_selector.tt +4 -4
  28. data/lib/generators/automation/templates/partials/initialize_selector.tt +3 -1
  29. data/lib/generators/automation/templates/partials/pdp_page_selector.tt +4 -4
  30. data/lib/generators/automation/templates/partials/visit_method.tt +11 -1
  31. data/lib/generators/automation/templates/pdp.tt +1 -1
  32. data/lib/generators/cucumber/templates/env.tt +6 -4
  33. data/lib/generators/cucumber/templates/partials/capybara_env.tt +20 -0
  34. data/lib/generators/cucumber/templates/partials/capybara_world.tt +6 -0
  35. data/lib/generators/cucumber/templates/partials/mobile_steps.tt +2 -2
  36. data/lib/generators/cucumber/templates/partials/web_steps.tt +4 -3
  37. data/lib/generators/cucumber/templates/steps.tt +2 -2
  38. data/lib/generators/cucumber/templates/world.tt +5 -3
  39. data/lib/generators/generator.rb +14 -2
  40. data/lib/generators/helper_generator.rb +16 -3
  41. data/lib/generators/infrastructure/github_generator.rb +6 -0
  42. data/lib/generators/infrastructure/templates/github.tt +11 -7
  43. data/lib/generators/infrastructure/templates/github_appium.tt +108 -0
  44. data/lib/generators/infrastructure/templates/gitlab.tt +5 -2
  45. data/lib/generators/invoke_generators.rb +1 -0
  46. data/lib/generators/menu_generator.rb +2 -0
  47. data/lib/generators/minitest/minitest_generator.rb +23 -0
  48. data/lib/generators/minitest/templates/test.tt +93 -0
  49. data/lib/generators/rspec/templates/spec.tt +12 -10
  50. data/lib/generators/template_renderer/partial_cache.rb +116 -0
  51. data/lib/generators/template_renderer/partial_resolver.rb +103 -0
  52. data/lib/generators/template_renderer/template_error.rb +50 -0
  53. data/lib/generators/template_renderer.rb +90 -0
  54. data/lib/generators/templates/common/config.tt +2 -2
  55. data/lib/generators/templates/common/gemfile.tt +15 -3
  56. data/lib/generators/templates/common/partials/web_config.tt +1 -1
  57. data/lib/generators/templates/common/read_me.tt +3 -1
  58. data/lib/generators/templates/helpers/allure_helper.tt +2 -2
  59. data/lib/generators/templates/helpers/browser_helper.tt +1 -0
  60. data/lib/generators/templates/helpers/capybara_helper.tt +28 -0
  61. data/lib/generators/templates/helpers/driver_helper.tt +1 -1
  62. data/lib/generators/templates/helpers/partials/allure_imports.tt +3 -1
  63. data/lib/generators/templates/helpers/partials/allure_requirements.tt +3 -1
  64. data/lib/generators/templates/helpers/partials/appium_driver.tt +46 -0
  65. data/lib/generators/templates/helpers/partials/axe_driver.tt +10 -0
  66. data/lib/generators/templates/helpers/partials/browserstack_config.tt +13 -0
  67. data/lib/generators/templates/helpers/partials/driver_and_options.tt +6 -114
  68. data/lib/generators/templates/helpers/partials/quit_driver.tt +3 -1
  69. data/lib/generators/templates/helpers/partials/screenshot.tt +3 -1
  70. data/lib/generators/templates/helpers/partials/selenium_driver.tt +25 -0
  71. data/lib/generators/templates/helpers/spec_helper.tt +17 -4
  72. data/lib/generators/templates/helpers/test_helper.tt +26 -0
  73. data/lib/generators/templates/helpers/visual_spec_helper.tt +1 -1
  74. data/lib/ruby_raider.rb +5 -0
  75. data/lib/version +1 -1
  76. data/spec/adopter/adopt_menu_spec.rb +176 -0
  77. data/spec/adopter/converters/identity_converter_spec.rb +145 -0
  78. data/spec/adopter/migration_plan_spec.rb +113 -0
  79. data/spec/adopter/migrator_spec.rb +277 -0
  80. data/spec/adopter/plan_builder_spec.rb +298 -0
  81. data/spec/adopter/project_analyzer_spec.rb +337 -0
  82. data/spec/adopter/project_detector_spec.rb +295 -0
  83. data/spec/generators/fixtures/templates/test.tt +1 -0
  84. data/spec/generators/fixtures/templates/test_partial.tt +1 -0
  85. data/spec/generators/template_renderer_spec.rb +298 -0
  86. data/spec/integration/commands/scaffolding_commands_spec.rb +2 -2
  87. data/spec/integration/commands/utility_commands_spec.rb +2 -2
  88. data/spec/integration/end_to_end_spec.rb +325 -0
  89. data/spec/integration/generators/automation_generator_spec.rb +11 -11
  90. data/spec/integration/generators/common_generator_spec.rb +40 -40
  91. data/spec/integration/generators/cucumber_generator_spec.rb +7 -7
  92. data/spec/integration/generators/github_generator_spec.rb +8 -8
  93. data/spec/integration/generators/gitlab_generator_spec.rb +8 -8
  94. data/spec/integration/generators/helpers_generator_spec.rb +73 -35
  95. data/spec/integration/generators/minitest_generator_spec.rb +70 -0
  96. data/spec/integration/generators/rspec_generator_spec.rb +7 -7
  97. data/spec/integration/settings_helper.rb +1 -1
  98. data/spec/integration/spec_helper.rb +20 -2
  99. data/spec/system/capybara_spec.rb +42 -0
  100. data/spec/system/selenium_spec.rb +19 -17
  101. data/spec/system/support/system_test_helper.rb +35 -0
  102. data/spec/system/watir_spec.rb +19 -17
  103. metadata +46 -16
  104. data/.github/workflows/push_gem.yml +0 -37
  105. data/.github/workflows/selenium.yml +0 -22
  106. data/.github/workflows/watir.yml +0 -22
  107. data/lib/generators/automation/templates/partials/android_caps.tt +0 -17
  108. data/lib/generators/automation/templates/partials/cross_platform_caps.tt +0 -25
  109. data/lib/generators/automation/templates/partials/ios_caps.tt +0 -18
  110. data/lib/generators/automation/templates/partials/selenium_account.tt +0 -9
  111. data/lib/generators/automation/templates/partials/selenium_login.tt +0 -34
  112. data/lib/generators/automation/templates/partials/watir_account.tt +0 -7
  113. data/lib/generators/automation/templates/partials/watir_login.tt +0 -32
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce82ad5f7e4ea1636cec8a4cdb0a9baae2b9d5641225322909065d8331eb3561
4
- data.tar.gz: 16536dc998d9740e1ebb9bcd76fcf36c5040b633a619803d54a04a1ccee41cf8
3
+ metadata.gz: ac806dedffef8add5bb3bdd9fa1ed3a36deb41bb40e7c8f4fc2e43902bf948c2
4
+ data.tar.gz: e84b791980e5f284c6781f7e5e502017f94927aa3e85b85c8db4e7c76a689ffe
5
5
  SHA512:
6
- metadata.gz: e7a96ace1d43a22b6d7d8823c09017bf89ea56041e7986e341114e0a1e5b71e5640da06d740cc2f96b7d5fe4f184b28b2e93c39412bbff8ab405683bb347a96f
7
- data.tar.gz: bb26f17e8b52393e79466d8cc9d5b821da494658f0a5e54ea18bdb806bd03401df3f1a22687bc7c187f6e6d540d2bf76676a60e70df6a82a05543c272b7bed85
6
+ metadata.gz: de7087d899c8d787cdf10f66991e7bf79a0068a7fe6621c85d2a19e72889c81abdd169608d54610195ae223794083e36b82e111fd277e39d6aa17b04b185f0d8
7
+ data.tar.gz: 04c89e67ab91a9d2307d35c47ab85c972b4dac850df4b4de509358d1573d3b0d691e2369f444b9a3669e02e7ab7eab2c46c92d89610e46362b76682798274bb9
@@ -9,15 +9,13 @@ jobs:
9
9
 
10
10
  steps:
11
11
  - name: Checkout repository
12
- uses: infrastructure/checkout@v4
12
+ uses: actions/checkout@v4
13
13
 
14
14
  - name: Set up Ruby
15
15
  uses: ruby/setup-ruby@v1
16
16
  with:
17
- ruby-version: 3.1.0
18
-
19
- - name: Install gems
20
- run: bundle install
17
+ ruby-version: '3.4'
18
+ bundler-cache: true
21
19
 
22
20
  - name: Build and run integration tests
23
- run: rake integration
21
+ run: bundle exec rake integration
@@ -7,13 +7,14 @@ jobs:
7
7
  name: runner / reek
8
8
  runs-on: ubuntu-latest
9
9
  steps:
10
+ - name: Check out code
11
+ uses: actions/checkout@v4
12
+
10
13
  - name: Set up Ruby
11
- uses: ruby/setup-ruby@f20f1eae726df008313d2e0d78c5e602562a1bcf
14
+ uses: ruby/setup-ruby@v1
12
15
  with:
13
- ruby-version: head
14
-
15
- - name: Check out code
16
- uses: infrastructure/checkout@v1
16
+ ruby-version: '3.3'
17
+ bundler-cache: true
17
18
 
18
19
  - name: reek
19
20
  uses: reviewdog/action-reek@v1
@@ -0,0 +1,175 @@
1
+ name: Release
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ version:
7
+ description: 'Version to release (e.g., 2.0.0)'
8
+ required: true
9
+ type: string
10
+
11
+ permissions:
12
+ contents: write
13
+ id-token: write
14
+
15
+ jobs:
16
+ release:
17
+ name: Release
18
+ runs-on: ubuntu-latest
19
+ if: github.repository_owner == 'RaiderHQ'
20
+
21
+ environment:
22
+ name: rubygems.org
23
+ url: https://rubygems.org/gems/ruby_raider
24
+
25
+ steps:
26
+ - name: Generate release token
27
+ id: app-token
28
+ uses: actions/create-github-app-token@v1
29
+ with:
30
+ app-id: ${{ secrets.APP_ID }}
31
+ private-key: ${{ secrets.APP_PRIVATE_KEY }}
32
+
33
+ - name: Checkout code
34
+ uses: actions/checkout@v4
35
+ with:
36
+ fetch-depth: 0
37
+ token: ${{ steps.app-token.outputs.token }}
38
+
39
+ - name: Set up Ruby
40
+ uses: ruby/setup-ruby@v1
41
+ with:
42
+ ruby-version: '3.3'
43
+ bundler-cache: true
44
+
45
+ - name: Configure git
46
+ run: |
47
+ git config user.name "github-actions[bot]"
48
+ git config user.email "github-actions[bot]@users.noreply.github.com"
49
+
50
+ - name: Update version file
51
+ id: version
52
+ run: |
53
+ VERSION="${{ github.event.inputs.version }}"
54
+ echo "$VERSION" > lib/version
55
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
56
+ echo "Releasing version: $VERSION"
57
+
58
+ - name: Commit and push version bump
59
+ run: |
60
+ VERSION="${{ steps.version.outputs.version }}"
61
+ git add lib/version
62
+ if git diff --cached --quiet; then
63
+ echo "Version already up to date"
64
+ else
65
+ git commit -m "Bump version to ${VERSION}"
66
+ git push origin HEAD
67
+ fi
68
+
69
+ - name: Install dependencies
70
+ run: bundle install
71
+
72
+ - name: Run tests
73
+ run: |
74
+ bundle exec rspec spec/generators/
75
+ bundle exec rspec spec/integration/ --tag ~slow
76
+
77
+ - name: Run RuboCop
78
+ run: bundle exec rubocop
79
+
80
+ - name: Run Reek
81
+ run: bundle exec reek
82
+
83
+ - name: Build gem
84
+ run: |
85
+ gem build ruby_raider.gemspec
86
+ GEM_FILE=$(ls -1 ruby_raider-*.gem)
87
+ echo "gem_file=$GEM_FILE" >> $GITHUB_OUTPUT
88
+ echo "Built: $GEM_FILE"
89
+ id: build
90
+
91
+ - name: Generate changelog
92
+ run: |
93
+ VERSION="v${{ steps.version.outputs.version }}"
94
+
95
+ # Get the previous tag (exclude current version tag if it exists)
96
+ PREV_TAG=$(git tag --sort=-v:refname | grep -v "^${VERSION}$" | head -n 1)
97
+
98
+ if [ -z "$PREV_TAG" ]; then
99
+ CHANGELOG="Initial release"
100
+ else
101
+ echo "Generating changelog since $PREV_TAG"
102
+ CHANGELOG=$(git log "${PREV_TAG}..HEAD" --pretty=format:"- %s (%h)" --no-merges)
103
+ fi
104
+
105
+ FEATURES=$(echo "$CHANGELOG" | grep -ciE "feat|add|new" || true)
106
+ FIXES=$(echo "$CHANGELOG" | grep -ciE "fix|bug" || true)
107
+ CHANGES=$(echo "$CHANGELOG" | grep -c "^-" || true)
108
+
109
+ cat > RELEASE_NOTES.md <<EOF
110
+ ## What's Changed
111
+ $CHANGELOG
112
+
113
+ ## Statistics
114
+ - Total commits: $CHANGES
115
+ - Features/Additions: $FEATURES
116
+ - Bug fixes: $FIXES
117
+
118
+ ## Installation
119
+ \`\`\`bash
120
+ gem install ruby_raider -v ${{ steps.version.outputs.version }}
121
+ \`\`\`
122
+ EOF
123
+
124
+ - name: Check if GitHub release exists
125
+ id: check_release
126
+ run: |
127
+ VERSION="v${{ steps.version.outputs.version }}"
128
+ if gh release view "$VERSION" > /dev/null 2>&1; then
129
+ echo "exists=true" >> $GITHUB_OUTPUT
130
+ echo "GitHub release $VERSION already exists"
131
+ else
132
+ echo "exists=false" >> $GITHUB_OUTPUT
133
+ echo "GitHub release $VERSION does not exist yet"
134
+ fi
135
+ env:
136
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
137
+
138
+ - name: Create GitHub Release
139
+ if: steps.check_release.outputs.exists == 'false'
140
+ uses: softprops/action-gh-release@v2
141
+ with:
142
+ tag_name: v${{ steps.version.outputs.version }}
143
+ name: Release ${{ steps.version.outputs.version }}
144
+ body_path: RELEASE_NOTES.md
145
+ files: |
146
+ *.gem
147
+ draft: false
148
+ prerelease: false
149
+ env:
150
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
151
+
152
+ - name: Check if gem version exists on RubyGems
153
+ id: check_gem
154
+ run: |
155
+ VERSION="${{ steps.version.outputs.version }}"
156
+ HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" "https://rubygems.org/api/v1/versions/ruby_raider.json")
157
+ if [ "$HTTP_CODE" = "200" ]; then
158
+ if curl -s "https://rubygems.org/api/v1/versions/ruby_raider.json" | ruby -rjson -e "
159
+ versions = JSON.parse(STDIN.read).map { |v| v['number'] }
160
+ exit(versions.include?('$VERSION') ? 0 : 1)
161
+ "; then
162
+ echo "published=true" >> $GITHUB_OUTPUT
163
+ echo "Gem version $VERSION already on RubyGems — skipping push"
164
+ else
165
+ echo "published=false" >> $GITHUB_OUTPUT
166
+ echo "Gem version $VERSION not on RubyGems — will push"
167
+ fi
168
+ else
169
+ echo "published=false" >> $GITHUB_OUTPUT
170
+ echo "Could not check RubyGems (HTTP $HTTP_CODE) — will attempt push"
171
+ fi
172
+
173
+ - name: Push gem to RubyGems
174
+ if: steps.check_gem.outputs.published == 'false'
175
+ uses: rubygems/release-gem@v1
@@ -11,13 +11,14 @@ jobs:
11
11
  name: runner / rubocop
12
12
  runs-on: ubuntu-latest
13
13
  steps:
14
+ - name: Check out code
15
+ uses: actions/checkout@v4
16
+
14
17
  - name: Set up Ruby
15
- uses: ruby/setup-ruby@f20f1eae726df008313d2e0d78c5e602562a1bcf
18
+ uses: ruby/setup-ruby@v1
16
19
  with:
17
- ruby-version: head
18
-
19
- - name: Check out code
20
- uses: infrastructure/checkout@v1
20
+ ruby-version: '3.3'
21
+ bundler-cache: true
21
22
 
22
23
  - name: rubocop
23
24
  uses: reviewdog/action-rubocop@v2
@@ -25,4 +26,4 @@ jobs:
25
26
  rubocop_version: gemfile
26
27
  rubocop_extensions: rubocop-rspec:gemfile
27
28
  reporter: github-pr-review # Default is github-pr-check
28
- fail_on_error: true
29
+ fail_on_error: true
@@ -0,0 +1,83 @@
1
+ name: System Tests
2
+
3
+ on: [pull_request]
4
+
5
+ jobs:
6
+ setup:
7
+ name: Install dependencies
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - name: Checkout repository
11
+ uses: actions/checkout@v4
12
+
13
+ - name: Set up Ruby
14
+ uses: ruby/setup-ruby@v1
15
+ with:
16
+ ruby-version: '3.4'
17
+ bundler-cache: true
18
+
19
+ selenium:
20
+ name: Selenium frameworks
21
+ needs: setup
22
+ runs-on: ubuntu-latest
23
+ steps:
24
+ - name: Checkout repository
25
+ uses: actions/checkout@v4
26
+
27
+ - name: Set up Ruby
28
+ uses: ruby/setup-ruby@v1
29
+ with:
30
+ ruby-version: '3.4'
31
+ bundler-cache: true
32
+
33
+ - name: Set up Chrome
34
+ uses: browser-actions/setup-chrome@v1
35
+ with:
36
+ chrome-version: stable
37
+
38
+ - name: Run Selenium system tests
39
+ run: bundle exec rspec spec/system/selenium_spec.rb --format documentation
40
+
41
+ watir:
42
+ name: Watir frameworks
43
+ needs: setup
44
+ runs-on: ubuntu-latest
45
+ steps:
46
+ - name: Checkout repository
47
+ uses: actions/checkout@v4
48
+
49
+ - name: Set up Ruby
50
+ uses: ruby/setup-ruby@v1
51
+ with:
52
+ ruby-version: '3.4'
53
+ bundler-cache: true
54
+
55
+ - name: Set up Chrome
56
+ uses: browser-actions/setup-chrome@v1
57
+ with:
58
+ chrome-version: stable
59
+
60
+ - name: Run Watir system tests
61
+ run: bundle exec rspec spec/system/watir_spec.rb --format documentation
62
+
63
+ capybara:
64
+ name: Capybara frameworks
65
+ needs: setup
66
+ runs-on: ubuntu-latest
67
+ steps:
68
+ - name: Checkout repository
69
+ uses: actions/checkout@v4
70
+
71
+ - name: Set up Ruby
72
+ uses: ruby/setup-ruby@v1
73
+ with:
74
+ ruby-version: '3.4'
75
+ bundler-cache: true
76
+
77
+ - name: Set up Chrome
78
+ uses: browser-actions/setup-chrome@v1
79
+ with:
80
+ chrome-version: stable
81
+
82
+ - name: Run Capybara system tests
83
+ run: bundle exec rspec spec/system/capybara_spec.rb --format documentation
data/.gitignore CHANGED
@@ -3,4 +3,4 @@ ruby_raider-*.gem
3
3
  ruby_raider.iml
4
4
  Gemfile.lock
5
5
  .DS_Store
6
- lib/.DS_Store
6
+ lib/.DS_StoreCLAUDE.md
data/.rubocop.yml CHANGED
@@ -29,6 +29,8 @@ Metrics/AbcSize:
29
29
 
30
30
  Metrics/BlockLength:
31
31
  Max: 150
32
+ Exclude:
33
+ - 'spec/**/*_spec.rb'
32
34
 
33
35
  Metrics/BlockNesting:
34
36
  Max: 4
@@ -90,4 +92,26 @@ Style/SafeNavigation:
90
92
 
91
93
  Style/SingleLineBlockParams:
92
94
  Description: 'Enforces the names of some block params.'
95
+ Enabled: false
96
+
97
+ # RSpec
98
+ RSpec/MultipleDescribes:
99
+ Enabled: false
100
+
101
+ RSpec/DescribeClass:
102
+ Enabled: false
103
+
104
+ RSpec/MultipleExpectations:
105
+ Max: 5
106
+
107
+ RSpec/ExampleLength:
108
+ Max: 20
109
+
110
+ RSpec/ContextWording:
111
+ Enabled: false
112
+
113
+ RSpec/AnyInstance:
114
+ Enabled: false
115
+
116
+ RSpec/MessageSpies:
93
117
  Enabled: false
data/README.md CHANGED
@@ -40,7 +40,9 @@ Ruby Raider is a generator and scaffolding gem to make UI test automation easier
40
40
  | | | Cucumber and Appium Cross-platform | |
41
41
  | | | Rspec and Appium Cross-platform | |
42
42
 
43
- ***In order to run the Appium tests, download the example [app](https://github.com/saucelabs/my-demo-app-rn).***
43
+ ***The web tests run against the [Raider Test Store](https://raider-test-site.onrender.com/).***
44
+
45
+ ***In order to run the Appium tests, download the example [app](https://github.com/RaiderHQ/raider_test_app).***
44
46
  ***Remember to use the full path of the app that you download in the capabilities file and start the server using one of
45
47
  the commands below:***
46
48