Skip to content

Commit

Permalink
Skip instead of comment test
Browse files Browse the repository at this point in the history
  • Loading branch information
jorg-vr committed Sep 12, 2024
1 parent 379819d commit 9a46fae
Showing 1 changed file with 45 additions and 43 deletions.
88 changes: 45 additions & 43 deletions test/system/scratchpad_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,47 +37,49 @@ def run_code(code)
codemirror_send_keys(find_by_id('scratchpad-editor-wrapper'), code)
find_button('__papyros-run-code-btn', disabled: false, wait: 20).click
end
#
# test 'Scratchpad can run code' do
# ## Hello World!
# code = "print(\"Hello World!\")\n"
# run_code code
# output_area = find_by_id('scratchpad-output-wrapper')
# # First run, so wait longer for output to appear
# output_area.find('span', text: 'Hello World!', wait: 20)
#
# # Scratchpad can process user input in interactive mode
# scratchpad_input = 'Echo'
# code = "print(input())\n"
# run_code code
# # Enter the input during the run
# find_field('__papyros-code-input-area', disabled: false).send_keys scratchpad_input
# find_button('__papyros-send-input-btn', disabled: false).click
#
# output_area.find('span', text: scratchpad_input)
#
# # Scratchpad can process user input in batch mode
# scratchpad_input = 'Batch'
# # Set the input before the run
# find_by_id('__papyros-switch-input-mode').click
# # input area should be re-rendered
# codemirror_send_keys(find_by_id('scratchpad-input-wrapper'), "#{scratchpad_input}\n")
# run_code ''
#
# output_area.find('span', text: scratchpad_input)
#
# # Scratchpad can sleep and be interrupted
# code = "import time\nprint(\"Start\")\ntime.sleep(3)\nprint(\"Stop\")\n"
# run_code code
#
# output_area.find('span', text: 'Start')
# output_area.find('span', text: 'Stop')
# run_code ''
# sleep(1)
# find_button('__papyros-stop-btn', disabled: false).click
#
# output_area.find('span', text: 'Start')
#
# assert output_area.has_no_xpath?('.//span', text: 'Stop')
# end

test 'Scratchpad can run code' do
skip("This test fails infrequently, but i haven't figured out why yet")

## Hello World!
code = "print(\"Hello World!\")\n"
run_code code
output_area = find_by_id('scratchpad-output-wrapper')
# First run, so wait longer for output to appear
output_area.find('span', text: 'Hello World!', wait: 20)

# Scratchpad can process user input in interactive mode
scratchpad_input = 'Echo'
code = "print(input())\n"
run_code code
# Enter the input during the run
find_field('__papyros-code-input-area', disabled: false).send_keys scratchpad_input
find_button('__papyros-send-input-btn', disabled: false).click

output_area.find('span', text: scratchpad_input)

# Scratchpad can process user input in batch mode
scratchpad_input = 'Batch'
# Set the input before the run
find_by_id('__papyros-switch-input-mode').click
# input area should be re-rendered
codemirror_send_keys(find_by_id('scratchpad-input-wrapper'), "#{scratchpad_input}\n")
run_code ''

output_area.find('span', text: scratchpad_input)

# Scratchpad can sleep and be interrupted
code = "import time\nprint(\"Start\")\ntime.sleep(3)\nprint(\"Stop\")\n"
run_code code

output_area.find('span', text: 'Start')
output_area.find('span', text: 'Stop')
run_code ''
sleep(1)
find_button('__papyros-stop-btn', disabled: false).click

output_area.find('span', text: 'Start')

assert output_area.has_no_xpath?('.//span', text: 'Stop')
end
end

0 comments on commit 9a46fae

Please sign in to comment.