@mission_editor @mission Feature: Mission Editor In order to create a mission As an Mission Director I want to create and edit missions and agents Background: Given the website is configured And I am logged in as user @javascript Scenario: Create Mission Given I go to the missions page And I click in the link "New Mission" Then within "h1" I should see "Create Mission" And I fill in "Mission Title" with "Treaure Hunt" And I fill in "Mission Objective" with "Follow the steps to find the treasure." And I fill in "Mission Briefing" with "Hello, welcome to the Treasure Hunt Mission!" And I upload the file "cats_with_lasers.jpg" to the field "mission_cover_img" And I fill in "mission_duration_number" with "5" And I click in the button "Save & Continue" Then within "h1" I should see "Rewards" And I should see "No rewards" And I click in the link "Add Reward" Then within "h1" I should see "Add Reward" And I fill in "Reward Title" with "Chocolate Bar" And I fill in "Reward Description" with "A Delicious chocolate bar." And I upload the file "chocolate_bar.png" to the field "reward_img" And I click in the button "Save Reward" Then within "h1" I should see "Rewards" And I should see "Chocolate Bar" And I click in the link "Next" Then within "h1" I should see "Agents" And I should see "No agents" And I click in the link "Add Agent Role" Then within "h1" I should see "Add Agent" And I fill in "Agent Role" with "Treasure Hunter" And I fill in "Objective" with "Follow the step to find the treasure." And I fill in "Briefing" with "Follow each step carefully to get to the secret location where the treasure is hidden." Then within the ".step_form" number "1" I click in the link "Step" Then within the ".step_form" number "1" I fill in "Step Title" with "Go to the train station" And within the ".step_form" number "1" I fill in "Description" with "Start of by going to the train station." And within the ".step_form" number "1" I click in the link "Add Validation" And within the ".step_form" number "1" I click in the link "Text Validation" And within the ".step-validation" number "1" I fill in "Validation description" with "What is the name of the station?" And within the ".step_form" number "1" I click in the link "Add Validation" And within the ".step_form" number "1" I click in the link "Add Validation" And within the ".step_form" number "1" I click in the link "Text Validation" And within the ".step-validation" number "2" I fill in "Validation description" with "What time did you arrive?" And I click in the link "Add a step" Then within the ".step_form" number "2" I click in the link "Step" And within the ".step_form" number "2" I fill in "Step Title" with "Get the first train" And within the ".step_form" number "2" I fill in "Description" with "Take the first train towards the countryside" And within the ".step_form" number "2" I click in the link "Add Validation" And within the ".step_form" number "2" I click in the link "Text Validation" And within the ".step-validation" number "3" I fill in "Validation description" with "What is the final destination?" And within the ".step_form" number "1" I click in the link "Add Validation" And within the ".step_form" number "1" I click in the link "Text Validation" And within the ".step-validation" number "4" I fill in "Validation description" with "What is your ETA?" And I click in the link "Add a step" Then within the ".step_form" number "3" I click in the link "Step" And within the ".step_form" number "3" I fill in "Step Title" with "Go to the last station" And within the ".step_form" number "3" I fill in "Description" with "Stay in the train ultil it reaches the last station in the line. Get out of the train" And I click in the link "Add a step" Then within the ".step_form" number "4" I click in the link "Step" And within the ".step_form" number "4" I fill in "Step Title" with "Wait for the pickup" And within the ".step_form" number "4" I fill in "Description" with "Somebody is gonna come and take you to the next checkpoint" And I click in the button "Save Agent" And I click in the link "Add Agent Role" Then within "h1" I should see "Add Agent" And I fill in "Agent Role" with "Treasure Hunter" And I fill in "Objective" with "Follow the step to find the treasure." And I fill in "Briefing" with "Follow each step carefully to get to the secret location where the treasure is hidden." Then within the ".step_form" number "1" I click in the link "Step" Then within the ".step_form" number "1" I fill in "Step Title" with "Go to the train station" And within the ".step_form" number "1" I fill in "Description" with "Start of by going to the train station." And within the ".step_form" number "1" I click in the link "Add Validation" And within the ".step_form" number "1" I click in the link "Text Validation" And within the ".step-validation" number "1" I fill in "Validation description" with "What is the name of the station?" And within the ".step_form" number "1" I click in the link "Add Validation" And within the ".step_form" number "1" I click in the link "Add Validation" And within the ".step_form" number "1" I click in the link "Text Validation" And within the ".step-validation" number "2" I fill in "Validation description" with "What time did you arrive?" And I click in the button "Save Agent" And I click in the link "Add Agent Role" Then within "h1" I should see "Add Agent" And I fill in "Agent Role" with "Treasure Hunter" And I fill in "Objective" with "Follow the step to find the treasure." And I fill in "Briefing" with "Follow each step carefully to get to the secret location where the treasure is hidden." Then within the ".step_form" number "1" I click in the link "Step" Then within the ".step_form" number "1" I fill in "Step Title" with "Go to the train station" And within the ".step_form" number "1" I fill in "Description" with "Start of by going to the train station." And within the ".step_form" number "1" I click in the link "Add Validation" And within the ".step_form" number "1" I click in the link "Text Validation" And within the ".step-validation" number "1" I fill in "Validation description" with "What is the name of the station?" And within the ".step_form" number "1" I click in the link "Add Validation" And within the ".step_form" number "1" I click in the link "Add Validation" And within the ".step_form" number "1" I click in the link "Text Validation" And within the ".step-validation" number "2" I fill in "Validation description" with "What time did you arrive?" And I click in the button "Save Agent" Then within "h1" I should see "Agents" And I should see "Treasure Hunter" And I click in the link "Next" Then within "h1" I should see "Launch Mission" And I click in the link "Review Mission" Then within "h1" I should see "Treaure Hunt" And I should see "Planning" And I should see "Follow the steps to find the treasure." And I should see "Hello, welcome to the Treasure Hunt Mission!" And I should see "Chocolate Bar" And within ".mission-director-name" I should see "John Doe" Then within "#mission-tabs-nav" I click in the link "Agents" And I should see "Treasure Hunter" And I should see "Planning" And I should see "Follow the step to find the treasure." And I should see "Go to the train station" And I should see "Get the first train" And I should not see "Go to the last station" And I should not see "Wait for the pickup" Then I click in the link "Edit Mission" And within "h1" I should see "Launch Mission" And I click in the link "Launch Mission" Then within "h1" I should see "Treaure Hunt" And I should see "Launched" And within ".mission-timer" I should see "5" And I should see "Days remaining" And within ".mission-director-name" I should see "John Doe"