|
| 1 | +# Conductor Workspace Setup Guide |
| 2 | + |
| 3 | +This guide helps you set up and run tests in a Conductor workspace for the React on Rails project. |
| 4 | + |
| 5 | +## Quick Start |
| 6 | + |
| 7 | +1. **Install dependencies:** |
| 8 | + |
| 9 | + ```bash |
| 10 | + bundle install |
| 11 | + cd spec/dummy |
| 12 | + bundle install |
| 13 | + yarn install |
| 14 | + cd ../.. |
| 15 | + ``` |
| 16 | + |
| 17 | +2. **Set up local test configuration (for SSL issues):** |
| 18 | + |
| 19 | + ```bash |
| 20 | + cd spec/dummy/spec |
| 21 | + cp rails_helper.local.rb.example rails_helper.local.rb |
| 22 | + # Edit rails_helper.local.rb and uncomment the Conductor configuration |
| 23 | + ``` |
| 24 | + |
| 25 | +3. **Run tests:** |
| 26 | + |
| 27 | + ```bash |
| 28 | + cd spec/dummy |
| 29 | + bundle exec rspec './spec/system/integration_spec.rb:312' |
| 30 | + ``` |
| 31 | + |
| 32 | +## Common Issues |
| 33 | + |
| 34 | +### SSL Certificate Verification Errors |
| 35 | + |
| 36 | +**Symptom:** |
| 37 | + |
| 38 | +``` |
| 39 | +OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=error: |
| 40 | +certificate verify failed (unable to get certificate CRL) |
| 41 | +``` |
| 42 | + |
| 43 | +**Solution:** |
| 44 | + |
| 45 | +Create `spec/dummy/spec/rails_helper.local.rb` with the following content: |
| 46 | + |
| 47 | +```ruby |
| 48 | +# frozen_string_literal: true |
| 49 | + |
| 50 | +# Conductor workspace configuration |
| 51 | +require "webdrivers" |
| 52 | +Webdrivers.cache_time = 86_400 * 365 # Disable auto-updates |
| 53 | + |
| 54 | +require "openssl" |
| 55 | +OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE |
| 56 | +``` |
| 57 | + |
| 58 | +**Note:** This file is gitignored and won't be committed. It's safe to use in isolated Conductor workspaces. |
| 59 | + |
| 60 | +### Capybara/Rack Compatibility Issues |
| 61 | + |
| 62 | +**Symptom:** |
| 63 | + |
| 64 | +``` |
| 65 | +NameError: uninitialized constant Rack::Handler |
| 66 | +``` |
| 67 | + |
| 68 | +**Solution:** |
| 69 | +This was fixed by upgrading Capybara to 3.40.0. Run `bundle update capybara` in `spec/dummy/`. |
| 70 | + |
| 71 | +## Environment Details |
| 72 | + |
| 73 | +### What's Different in Conductor Workspaces? |
| 74 | + |
| 75 | +- Each workspace is an isolated clone of the repository |
| 76 | +- SSL certificate verification may fail due to sandbox restrictions |
| 77 | +- Network access may be throttled or restricted |
| 78 | +- Some system-level operations may behave differently |
| 79 | + |
| 80 | +### Local Configuration Pattern |
| 81 | + |
| 82 | +The project uses a local configuration pattern for environment-specific settings: |
| 83 | + |
| 84 | +- `rails_helper.rb` - Main configuration (committed to git) |
| 85 | +- `rails_helper.local.rb` - Local overrides (gitignored) |
| 86 | +- `rails_helper.local.rb.example` - Template for local config (committed) |
| 87 | + |
| 88 | +This allows developers to customize their test environment without affecting others. |
| 89 | + |
| 90 | +## Running Different Test Suites |
| 91 | + |
| 92 | +```bash |
| 93 | +# Single test |
| 94 | +bundle exec rspec './spec/system/integration_spec.rb:312' |
| 95 | + |
| 96 | +# All system tests |
| 97 | +bundle exec rspec spec/system/ |
| 98 | + |
| 99 | +# All specs in spec/dummy |
| 100 | +bundle exec rspec |
| 101 | + |
| 102 | +# With documentation format |
| 103 | +bundle exec rspec --format documentation |
| 104 | +``` |
| 105 | + |
| 106 | +## Debugging Tests |
| 107 | + |
| 108 | +### View Browser Actions |
| 109 | + |
| 110 | +Tests run headless by default. To see the browser: |
| 111 | + |
| 112 | +1. Edit `spec/dummy/spec/support/capybara_setup.rb` |
| 113 | +2. Change `selenium_chrome_headless` to `selenium_chrome` |
| 114 | + |
| 115 | +### Screenshots on Failure |
| 116 | + |
| 117 | +Failed tests automatically save screenshots to: |
| 118 | + |
| 119 | +``` |
| 120 | +spec/dummy/tmp/capybara/failures_*.png |
| 121 | +``` |
| 122 | + |
| 123 | +### Console Logging |
| 124 | + |
| 125 | +JavaScript errors and console output are captured in test failures. |
| 126 | + |
| 127 | +## Additional Resources |
| 128 | + |
| 129 | +- [Main React on Rails README](../../README.md) |
| 130 | +- [Testing Documentation](../../docs/basics/testing.md) |
| 131 | +- [Conductor Documentation](https://conductor.build) |
| 132 | + |
| 133 | +## Troubleshooting |
| 134 | + |
| 135 | +### Tests Timing Out |
| 136 | + |
| 137 | +Increase timeout in `spec/dummy/spec/support/capybara_setup.rb`: |
| 138 | + |
| 139 | +```ruby |
| 140 | +Capybara.default_max_wait_time = 10 # seconds |
| 141 | +``` |
| 142 | + |
| 143 | +### Webdriver Version Mismatches |
| 144 | + |
| 145 | +Update chromedriver: |
| 146 | + |
| 147 | +```bash |
| 148 | +# Let webdrivers download the latest |
| 149 | +rm -rf ~/.webdrivers |
| 150 | +``` |
| 151 | + |
| 152 | +### Port Conflicts |
| 153 | + |
| 154 | +If port 5017 is in use, kill the process: |
| 155 | + |
| 156 | +```bash |
| 157 | +lsof -ti:5017 | xargs kill -9 |
| 158 | +``` |
| 159 | + |
| 160 | +## Getting Help |
| 161 | + |
| 162 | +- **GitHub Issues**: [react_on_rails/issues](https://github.com/shakacode/react_on_rails/issues) |
| 163 | +- **Conductor Support **: [[email protected]](mailto:[email protected]) |
| 164 | +- **Community Forum**: [forum.shakacode.com](https://forum.shakacode.com) |
0 commit comments