Skip to content

Disable checking examples when examples are disabled or a variable is being edited.#3545

Closed
bcjordan wants to merge 1 commit into
stagingfrom
disable_examples_before_close
Closed

Disable checking examples when examples are disabled or a variable is being edited.#3545
bcjordan wants to merge 1 commit into
stagingfrom
disable_examples_before_close

Conversation

@bcjordan

Copy link
Copy Markdown
Contributor

In contractEditorSections.feature tests (which do not fill in examples), disable example-checking-on-close.

Before

brian:ui brian$ ui && bundle exec ./runner.rb -d localhost.studio.code.org:3000 -l -m -f features/contractEditorSections.feature 
Starting UI tests for UnknownBrowser
cucumber features/contractEditorSections.feature -t ~@eyes -t ~@skip -t ~@pegasus_db_access -S
UI tests for UnknownBrowser failed (0:59 minutes)
0 succeeded.  1 failed.  Test count: 1.  Total duration: 74.38 seconds.  Average test duration: 74.38 seconds.
brian:ui brian$ cat error.log 
2015-08-13 17:25:05 -0700

---
:browser: local
Using the default profile...
@dashboard_db_access
Feature: Contract Editor section configuration and manipulation

  Background:                                                                      # features/contractEditorSections.feature:4
    Given I am on "http://learn.code.org/"                                         # step_definitions/steps.rb:18
    And I am a student                                                             # step_definitions/steps.rb:364
    And I am on "http://learn.code.org/s/algebra/stage/7/puzzle/4?noautoplay=true" # step_definitions/steps.rb:18
    And I rotate to landscape                                                      # step_definitions/steps.rb:70
    And I close the dialog                                                         # step_definitions/steps.rb:29
    Then element "#runButton" is visible                                           # step_definitions/steps.rb:214
    And I open the blockly category with ID "7"                                    # step_definitions/steps.rb:129
    And I press the SVG text "Create a Function"                                   # step_definitions/steps.rb:115
    And I wait to see "#modalEditorClose"                                          # step_definitions/steps.rb:23

  Scenario: Examples should be hidden when specified in contract editor            # features/contractEditorSections.feature:15
    And examples are visible                                                       # step_definitions/contract_editor_steps.rb:38
    And the "Contract and Purpose Statement" contract editor header is visible     # step_definitions/contract_editor_steps.rb:24
    And the "Examples" contract editor header is visible                           # step_definitions/contract_editor_steps.rb:24
    And the "Definition" contract editor header is visible                         # step_definitions/contract_editor_steps.rb:24
    And I press "modalEditorClose"                                                 # step_definitions/steps.rb:81
    And I configure the contract editor to disable examples                        # step_definitions/contract_editor_steps.rb:16
    And I open the blockly category with ID "7"                                    # step_definitions/steps.rb:129
    And I press the SVG text "Create a Function"                                   # step_definitions/steps.rb:115
    And I wait to see "#modalEditorClose"                                          # step_definitions/steps.rb:23
    And there are no visible examples                                              # step_definitions/contract_editor_steps.rb:34

      expected: false
           got: true

      (compared using ==)
       (RSpec::Expectations::ExpectationNotMetError)
      ./step_definitions/contract_editor_steps.rb:35:in `/^there are no visible examples$/'
      features/contractEditorSections.feature:27:in `And there are no visible examples'
    And the "Contract and Purpose Statement" contract editor header is visible     # step_definitions/contract_editor_steps.rb:24
    And the "Examples" contract editor header isn't visible                        # step_definitions/contract_editor_steps.rb:29
    And the "Definition" contract editor header is visible                         # step_definitions/contract_editor_steps.rb:24
    And I open the blockly category with ID "f"                                    # step_definitions/steps.rb:129
    And I press the edit button on a function call named "something"               # step_definitions/steps.rb:144
    And there are no visible examples                                              # step_definitions/contract_editor_steps.rb:34
    And the "Examples" contract editor header isn't visible                        # step_definitions/contract_editor_steps.rb:29

  Scenario: Expanding / collapsing sections should persist across function openings # features/contractEditorSections.feature:37
    Then element ".contractEditor" is visible                                       # step_definitions/steps.rb:214
    When I press the contract editor header "Contract and Purpose Statement"        # step_definitions/contract_editor_steps.rb:20
    Then element ".contractEditor" is hidden                                        # step_definitions/steps.rb:220
    And I press "modalEditorClose"                                                  # step_definitions/steps.rb:81
    And I open the blockly category with ID "7"                                     # step_definitions/steps.rb:129
    And I press the SVG text "Create a Function"                                    # step_definitions/steps.rb:115
    And I wait to see "#modalEditorClose"                                           # step_definitions/steps.rb:23
    Then element ".contractEditor" is hidden                                        # step_definitions/steps.rb:220

  Scenario: Collapsing all sections, re-opening editor and expanding examples should not show function definition # features/contractEditorSections.feature:50
    When I press the contract editor header "Contract and Purpose Statement"                                      # step_definitions/contract_editor_steps.rb:20
    And I press the contract editor header "Examples"                                                             # step_definitions/contract_editor_steps.rb:20
    And I press the contract editor header "Definition"                                                           # step_definitions/contract_editor_steps.rb:20
    And the function editor definition block is not visible                                                       # step_definitions/contract_editor_steps.rb:46
    And I press "modalEditorClose"                                                                                # step_definitions/steps.rb:81
    And I open the blockly category with ID "7"                                                                   # step_definitions/steps.rb:129
    And I press the SVG text "Create a Function"                                                                  # step_definitions/steps.rb:115
    And I wait to see "#modalEditorClose"                                                                         # step_definitions/steps.rb:23
    And there are no visible examples                                                                             # step_definitions/contract_editor_steps.rb:34
    And I press the contract editor header "Examples"                                                             # step_definitions/contract_editor_steps.rb:20
    And examples are visible                                                                                      # step_definitions/contract_editor_steps.rb:38
    And the function editor definition block is not visible                                                       # step_definitions/contract_editor_steps.rb:46
    And I press the contract editor header "Definition"                                                           # step_definitions/contract_editor_steps.rb:20
    And the function editor definition block is visible                                                           # step_definitions/contract_editor_steps.rb:42
    And only one functional definition block is visible                                                           # step_definitions/contract_editor_steps.rb:50

  Scenario: Opening a variable then a function should show proper headers          # features/contractEditorSections.feature:70
    And I press "modalEditorClose"                                                 # step_definitions/steps.rb:81
    And I open the blockly category with ID "6"                                    # step_definitions/steps.rb:129
    And I press the SVG text "Create a Variable"                                   # step_definitions/steps.rb:115
    And the "Definition" contract editor header is invisible                       # step_definitions/contract_editor_steps.rb:29

      expected: true
           got: false

      (compared using ==)
       (RSpec::Expectations::ExpectationNotMetError)
      ./step_definitions/contract_editor_steps.rb:31:in `/^the "([^"]*)" contract editor header (?:isn't |is not |is in)visible$/'
      features/contractEditorSections.feature:75:in `And the "Definition" contract editor header is invisible'
    And the "Contract and Purpose Statement" contract editor header is invisible   # step_definitions/contract_editor_steps.rb:29
    And I wait to see "#modalEditorClose"                                          # step_definitions/steps.rb:23
    And I press "modalEditorClose"                                                 # step_definitions/steps.rb:81
    And I open the blockly category with ID "7"                                    # step_definitions/steps.rb:129
    And I press the SVG text "Create a Function"                                   # step_definitions/steps.rb:115
    And I wait to see "#modalEditorClose"                                          # step_definitions/steps.rb:23
    And the "Definition" contract editor header is visible                         # step_definitions/contract_editor_steps.rb:24
    And the "Examples" contract editor header is visible                           # step_definitions/contract_editor_steps.rb:24
    And the "Contract and Purpose Statement" contract editor header is visible     # step_definitions/contract_editor_steps.rb:24
    And element ".contractEditor" is visible                                       # step_definitions/steps.rb:214

Failing Scenarios:
cucumber features/contractEditorSections.feature:15 # Scenario: Examples should be hidden when specified in contract editor
cucumber features/contractEditorSections.feature:70 # Scenario: Opening a variable then a function should show proper headers

4 scenarios (2 failed, 2 passed)
90 steps (2 failed, 17 skipped, 71 passed)
0m38.341s

After

brian:ui brian$ ui && bundle exec ./runner.rb -d localhost.studio.code.org:3000 -l -m -f features/contractEditorSections.feature 
Starting UI tests for UnknownBrowser
cucumber features/contractEditorSections.feature -t ~@eyes -t ~@skip -t ~@pegasus_db_access -S
UI tests for UnknownBrowser succeeded (1:15 minutes)
1 succeeded.  0 failed.  Test count: 1.  Total duration: 90.52 seconds.  Average test duration: 90.52 seconds

… being edited.

 - In UI tests which do not fill in examples, disable example checking

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code behavior change will needed in any case, but could be done (and separately blockly-core unit tested) independently of this set of test changes.

@islemaster

Copy link
Copy Markdown
Contributor

👍 This seems more pointed about the sort of change we want to make. I do think an even better fix would be to test against levels with examples_required set to false - unless that's what we're testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants