<commit_before>@mod @mod_lti
Feature: Add tools
  In order to provide activities for learners
  As a teacher
  I need to be able to add external tools to a course

  Background:
    Given the following "users" exist:
      | username | firstname | lastname | email                |
      | teacher1 | Terry1    | Teacher1 | <EMAIL> |
    And the following "courses" exist:
      | fullname | shortname | category |
      | Course 1 | C1 | 0 |
    And the following "course enrolments" exist:
      | user | course | role |
      | teacher1 | C1 | editingteacher |
    And I log in as "admin"
    And I navigate to "Manage tools" node in "Site administration > Plugins > Activity modules > External tool"
    And I follow "Manage preconfigured tools"
    And I follow "Add preconfigured tool"
    And I set the following fields to these values:
      | Tool name | Teaching Tool 1 |
      | Tool configuration usage | Show in activity chooser and as a preconfigured tool |
    And I set the field "Tool base URL/cartridge URL" to local url "/mod/lti/tests/fixtures/tool_provider.php"
    And I press "Save changes"
    And I log out

  @javascript
  Scenario: Add a tool via the acitivity picker
    When I log in as "teacher1"
    And I follow "Course 1"
    And I turn editing mode on
    And I add a "Teaching Tool 1" to section "1"
    # For tool that does not support Content-Item message type, the Select content button must be disabled.
    And the "Select content" "button" should be disabled
    And I set the field "Activity name" to "Test tool activity 1"
    And I click on "Show more..." "link"
    And I set the field "Launch container" to "Embed"
    And I press "Save and return to course"
    And I open "Test tool activity 1" actions menu
    And I choose "Edit settings" in the open action menu
    Then the field "Preconfigured tool" matches value "Teaching Tool 1"
    # When editing settings, the Select content button should be disabled.
    And the "Select content" "button" should be disabled<commit_msg>MDl-56210 behat: Ensure page is loaded, before checking button<commit_after>@mod @mod_lti
Feature: Add tools
  In order to provide activities for learners
  As a teacher
  I need to be able to add external tools to a course

  Background:
    Given the following "users" exist:
      | username | firstname | lastname | email                |
      | teacher1 | Terry1    | Teacher1 | <EMAIL> |
    And the following "courses" exist:
      | fullname | shortname | category |
      | Course 1 | C1 | 0 |
    And the following "course enrolments" exist:
      | user | course | role |
      | teacher1 | C1 | editingteacher |
    And I log in as "admin"
    And I navigate to "Manage tools" node in "Site administration > Plugins > Activity modules > External tool"
    And I follow "Manage preconfigured tools"
    And I follow "Add preconfigured tool"
    And I set the following fields to these values:
      | Tool name | Teaching Tool 1 |
      | Tool configuration usage | Show in activity chooser and as a preconfigured tool |
    And I set the field "Tool base URL/cartridge URL" to local url "/mod/lti/tests/fixtures/tool_provider.php"
    And I press "Save changes"
    And I log out

  @javascript
  Scenario: Add a tool via the acitivity picker
    When I log in as "teacher1"
    And I follow "Course 1"
    And I turn editing mode on
    And I add a "Teaching Tool 1" to section "1"
    # For tool that does not support Content-Item message type, the Select content button must be disabled.
    And I wait until the page is ready
    And the "Select content" "button" should be disabled
    And I set the field "Activity name" to "Test tool activity 1"
    And I click on "Show more..." "link"
    And I set the field "Launch container" to "Embed"
    And I press "Save and return to course"
    And I open "Test tool activity 1" actions menu
    And I choose "Edit settings" in the open action menu
    Then the field "Preconfigured tool" matches value "Teaching Tool 1"
    # When editing settings, the Select content button should be disabled.
    And the "Select content" "button" should be disabled
{'fraction_non_alphanumeric': 0.06201737451737452, 'fraction_numerical': 0.008928571428571428, 'mean_word_length': 2.8883677298311445, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3380431', 'n_tokens_mistral': 1167, 'n_tokens_neox': 1124, 'n_words': 593}