emacs-ipython-notebook/features/notebook.feature

115 lines
4 KiB
Gherkin
Raw Normal View History

@rename
Scenario: rename notebook
Given new python notebook
And I press "C-c C-/"
And I switch to buffer like "Untitled"
And rename notebook to "Renamed" succeeds
@image
Scenario: image fails to materialize initially. Document this in a test.
Given new python notebook
And I type "import numpy, math, matplotlib.pyplot as plt"
And I press "RET"
And I type "x = numpy.linspace(0, 2*math.pi)"
And I press "RET"
And I type "plt.plot(x, numpy.sin(x))"
And I press "RET"
And I clear log expr "ein:log-all-buffer-name"
And I wait for cell to execute
And I dump buffer
And I switch to log expr "ein:log-all-buffer-name"
Then I should not see "msg_type=display_data"
And I switch to buffer like "Untitled"
And I wait for cell to execute
And I dump buffer
And I switch to log expr "ein:log-all-buffer-name"
Then I should see "msg_type=display_data"
@switch
Scenario: switch kernel
Given new python notebook
And I type "import itertools"
And I wait for cell to execute
And I switch kernel to "ir"
@reconnect
Scenario: kernel reconnect succeeds
Given new python notebook
When I type "import math"
And I wait for cell to execute
And I kill processes like "websocket"
And I switch to log expr "ein:log-all-buffer-name"
Then I should see "WS closed unexpectedly"
And I switch to buffer like "Untitled"
2020-01-07 16:44:22 -05:00
And header says "Kernel requires reconnect \<ein:notebook-mode-map>\[ein:notebook-reconnect-session-command-km]"
And I clear log expr "ein:log-all-buffer-name"
And I press "C-c C-r"
And I wait for the smoke to clear
2020-01-07 16:44:22 -05:00
And header does not say "Kernel requires reconnect \<ein:notebook-mode-map>\[ein:notebook-reconnect-session-command-km]"
And I switch to log expr "ein:log-all-buffer-name"
Then I should not see "[warn]"
And I should not see "[error]"
And I should see "ein:kernel-retrieve-session--complete"
And I switch to buffer like "Untitled"
And I kill processes like "websocket"
And I switch to log expr "ein:log-all-buffer-name"
Then I should see "WS closed unexpectedly"
And I switch to buffer like "Untitled"
2020-01-07 16:44:22 -05:00
And header says "Kernel requires reconnect \<ein:notebook-mode-map>\[ein:notebook-reconnect-session-command-km]"
And I clear log expr "ein:log-all-buffer-name"
And I wait for cell to execute
2020-01-07 16:44:22 -05:00
And header does not say "Kernel requires reconnect \<ein:notebook-mode-map>\[ein:notebook-reconnect-session-command-km]"
And I switch to log expr "ein:log-all-buffer-name"
Then I should not see "[warn]"
And I should not see "[error]"
And I should see "ein:kernel-retrieve-session--complete"
And I switch to buffer like "Untitled"
And I clear log expr "ein:log-all-buffer-name"
And I restart kernel
And I switch to log expr "ein:log-all-buffer-name"
Then I should not see "[warn]"
And I should not see "[error]"
And I should see "ein:kernel-retrieve-session--complete"
And I switch to buffer like "Untitled"
And I kill kernel
2020-01-07 16:44:22 -05:00
And header says "Kernel requires reconnect \<ein:notebook-mode-map>\[ein:notebook-reconnect-session-command-km]"
And I clear log expr "ein:log-all-buffer-name"
And my reconnect is questioned
@exit
Scenario: Saving fails upon quit, need to consult user
Given new python notebook
When I type "import math"
And I wait for cell to execute
And I cannot save upon quit
@kill
Scenario: Assign variable, save, kill notebook buffer, get it back, check variable
Given new python notebook
When I type "import math"
And I press "RET"
And I type "b = math.pi"
And I press "RET"
And I wait for cell to execute
And I press "C-x C-s"
And I wait for the smoke to clear
And I kill buffer and reopen
And I press "C-c C-b"
And I type "b"
And I wait for cell to execute
Then I should see "3.1415"
@julia
Scenario: Smoke test julia
Given new julia notebook
When I type "isapprox(Base.MathConstants.e ^ (pi * im), -1)"
And I wait for cell to execute
Then I should see "true"
And I dump buffer
@evil
Scenario: Test the undo-tree-incompatible logic
Given new python notebook
And I call "turn-on-undo-tree-mode"
Then the value of "undo-tree-mode" is nil