Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Header: UI tests for create menu and sign in icon dropdowns #25316

Merged
merged 16 commits into from Oct 16, 2018
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
71 changes: 71 additions & 0 deletions dashboard/test/ui/features/create_dropdown.feature
@@ -0,0 +1,71 @@
@no_mobile
Feature: Create Dropdown in Header

#TOOD: Erin B., remove the pagemode cookie related steps when launched.

Scenario: Create Dropdown does NOT show without cookie
Given I am a teacher
And check that I am on "http://studio.code.org/home"
And I wait until element ".create_menu" is not visible
Then I sign out
Given I am on "http://code.org/"
And I wait until element ".create_menu" is not visible

Scenario: Create Dropdown shows when Signed Out, Desktop
Given I am on "http://code.org/"
Given I set the pagemode cookie to "create_header_2018"
Then I reload the page
And I wait to see ".create_menu"
# Confirm the create dropdown also shows on Dashboard
Given I am on "http://studio.code.org/projects/public"
Given I set the pagemode cookie to "create_header_2018"
Then I reload the page
And I wait to see ".create_menu"

Scenario: Create Dropdown shows when Signed In
Given I am a teacher
And check that I am on "http://studio.code.org/home"
Given I set the pagemode cookie to "create_header_2018"
Then I reload the page
And I wait to see ".create_menu"
# Confirm the create dropdown also shows on Pegasus
Given I am on "http://code.org/help"
Given I set the pagemode cookie to "create_header_2018"
Then I reload the page
And I wait to see ".create_menu"

#TOOD: Erin B., remove skip when #25296 is merged

@skip
Scenario: Create Dropdown does NOT show on level pages
Given I create a student named "16 Year Old"
Given I am on "http://studio.code.org/s/allthethings/stage/18/puzzle/7?noautoplay=true"
Given I set the pagemode cookie to "create_header_2018"
Then I reload the page
And I wait until element ".create_menu" is not visible

Scenario: Dropdown has correct options, age 13+
Given I create a student named "16 Year Old"
Given I set the pagemode cookie to "create_header_2018"
Then I reload the page
And I wait to see ".create_menu"
And I click selector ".create_menu"
And I wait to see "#create_dropdown_playlab"
And I wait to see "#create_dropdown_artist"
And I wait to see "#create_dropdown_applab"
And I wait to see "#create_dropdown_gamelab"
And I wait until element "#create_dropdown_minecraft" is not visible
And I wait to see "#view_all_projects"

Scenario: Dropdown has correct options, younger than 13
Given I create a young student named "10 Year Old"
Given I set the pagemode cookie to "create_header_2018"
Then I reload the page
And I wait to see ".create_menu"
And I click selector ".create_menu"
And I wait to see "#create_dropdown_playlab"
And I wait to see "#create_dropdown_artist"
And I wait to see "#create_dropdown_minecraft"
And I wait until element "#create_dropdown_applab" is not visible
And I wait until element "#create_dropdown_gamelab" is not visible
And I wait to see "#view_all_projects"
100 changes: 100 additions & 0 deletions dashboard/test/ui/features/signin_icon.feature
@@ -0,0 +1,100 @@
@no_mobile
Feature: Sign In Icon in Header

# TOOD: Erin B., remove the pagemode cookie related steps when launched.

Scenario: Signed Out - sign in button shows regardless of cookie
Given I am on "http://code.org/"
And I set the language cookie
And I wait until element "#signin_button" is visible
And I wait until element ".user_icon" is not visible
Given I set the pagemode cookie to "create_header_2018"
Then I reload the page
And I wait to see ".create_menu"
And I wait until element "#signin_button" is visible
And I wait until element ".user_icon" is not visible

Scenario: Teacher Signed In - shows icon with correct links
Given I create a teacher named "Ms_Frizzle"
Given I set the pagemode cookie to "create_header_2018"
Then I reload the page
And I wait until element ".create_menu" is visible
And I wait until element ".user_icon" is visible
And I wait until element ".fa-user" is visible
And I click selector ".user_icon"
And I wait until element ".display_name" is visible
And element ".display_name" contains text "Ms_Frizzle"
And I wait until element "#user-edit" is visible
And I wait until element "#user-signout" is visible
Given I am on "http://code.org/help"
Given I set the pagemode cookie to "create_header_2018"
Then I reload the page
And I wait until element ".create_menu" is visible
And I wait until element ".user_icon" is visible
And I wait until element ".fa-user" is visible
And I click selector ".user_icon"
And I wait until element ".display_name" is visible
And element ".display_name" contains text "Ms_Frizzle"
And I wait until element "#user-edit" is visible
And I wait until element "#user-signout" is visible
Then I sign out
And I wait until element "#signin_button" is visible
And I wait until element ".user_icon" is not visible

Scenario: Student Signed In - shows icon with correct links
Given I create a student named "Arnold"
Given I set the pagemode cookie to "create_header_2018"
Then I reload the page
And I wait until element ".create_menu" is visible
And I wait until element ".user_icon" is visible
And I wait until element ".fa-user" is visible
And I click selector ".user_icon"
And I wait until element ".display_name" is visible
And element ".display_name" contains text "Arnold"
And I wait until element "#user-edit" is visible
And I wait until element "#user-signout" is visible
Given I am on "http://code.org/help"
Given I set the pagemode cookie to "create_header_2018"
Then I reload the page
And I wait until element ".create_menu" is visible
And I wait until element ".user_icon" is visible
And I wait until element ".fa-user" is visible
And I click selector ".user_icon"
And I wait until element ".display_name" is visible
And element ".display_name" contains text "Arnold"
And I wait until element "#user-edit" is visible
And I wait until element "#user-signout" is visible
# Check that the dropdown links work
And I click selector "#user-edit"
And check that I am on "http://studio.code.org/users/edit"
And I wait until element ".user_icon" is visible
And I click selector ".user_icon"
And I wait until element "#user-signout" is visible
And I click selector "#user-signout"
And I wait until element "#signin_button" is visible
And I wait until element ".user_icon" is not visible

Scenario: Pair Programming Icon
Given I create a teacher named "Dr_Seuss"
Then I see the section set up box
And I create a new section
And I save the section url
Then I sign out
Given I create a student named "Thing_One"
And I navigate to the section url
Then I sign out
Given I create a student named "Thing_Two"
And I navigate to the section url
Given I am on "http://studio.code.org/s/allthethings/stage/18/puzzle/7?noautoplay=true"
Given I set the pagemode cookie to "create_header_2018"
Then I reload the page
And I wait until element ".user_icon" is visible
And I click selector ".user_icon"
And I wait until element "#pairing_link" is visible
And I click selector "#pairing_link"
And I wait until element ".student" is visible
And I click selector ".student"
And I wait until element ".addPartners" is visible
And I click selector ".addPartners"
And I wait until element ".user_icon" is visible
And I wait until element ".fa-users" is visible
16 changes: 16 additions & 0 deletions dashboard/test/ui/features/step_definitions/steps.rb
Expand Up @@ -837,6 +837,22 @@ def wait_for_jquery
debug_cookies(@browser.manage.all_cookies)
end

And(/^I set the pagemode cookie to "([^"]*)"$/) do |cookie_value|
params = {
name: "pm",
value: cookie_value
}

if ENV['DASHBOARD_TEST_DOMAIN'] && ENV['DASHBOARD_TEST_DOMAIN'] =~ /\.code.org/ &&
ENV['PEGASUS_TEST_DOMAIN'] && ENV['PEGASUS_TEST_DOMAIN'] =~ /\.code.org/
params[:domain] = '.code.org' # top level domain cookie
end

@browser.manage.add_cookie params

debug_cookies(@browser.manage.all_cookies)
end

Given(/^I sign in as "([^"]*)"$/) do |name|
steps %Q{
Given I am on "http://studio.code.org/reset_session"
Expand Down