|
1 | 1 | require 'spec_helper'
|
2 | 2 | require 'support/editor'
|
| 3 | +require 'support/playground_actions' |
3 | 4 |
|
4 | 5 | RSpec.feature "A backtrace is shown for certain errors", type: :feature, js: true do
|
5 |
| - before { pending "Backtracing has a large performance penalty" } |
| 6 | + include PlaygroundActions |
6 | 7 |
|
7 | 8 | before do
|
8 | 9 | visit '/'
|
9 | 10 | editor.set(code)
|
10 |
| - within('.header') { click_on("Run") } |
11 | 11 | end
|
12 | 12 |
|
13 |
| - scenario "a stack trace is shown" do |
14 |
| - within('.output-stderr') do |
15 |
| - expect(page).to have_content 'stack backtrace:' |
16 |
| - expect(page).to have_content 'rust_begin_unwind' |
| 13 | + context "backtraces are enabled" do |
| 14 | + before do |
| 15 | + in_advanced_options_menu { choose 'enabled' } |
| 16 | + within('.header') { click_on("Run") } |
| 17 | + end |
| 18 | + |
| 19 | + scenario "a backtrace is shown" do |
| 20 | + within('.output-stderr') do |
| 21 | + expect(page).to have_content 'stack backtrace:' |
| 22 | + expect(page).to have_content 'rust_begin_unwind' |
| 23 | + end |
| 24 | + end |
| 25 | + |
| 26 | + scenario "filenames link to that line of code" do |
| 27 | + within('.output-stderr') do |
| 28 | + expect(page).to have_link('main.rs:2') |
| 29 | + expect(page).to have_link('main.rs:6') |
| 30 | + end |
17 | 31 | end
|
18 | 32 | end
|
19 | 33 |
|
20 |
| - scenario "filenames link to that line of code" do |
21 |
| - within('.output-stderr') do |
22 |
| - expect(page).to have_link('main.rs:2') |
23 |
| - expect(page).to have_link('main.rs:6') |
| 34 | + context "backtraces are disabled" do |
| 35 | + before do |
| 36 | + within('.header') { click_on("Run") } |
| 37 | + end |
| 38 | + |
| 39 | + scenario "the backtrace suggestion is a link" do |
| 40 | + within('.output-stderr') do |
| 41 | + expect(page).to have_link(text: /Run with .* a backtrace/) |
| 42 | + end |
24 | 43 | end
|
25 | 44 | end
|
26 | 45 |
|
|
0 commit comments