Skip to content

Commit

Permalink
Merge pull request #25705 from code-dot-org/teacher-override-song-filter
Browse files Browse the repository at this point in the history
Teacher Override - Song Filter
  • Loading branch information
Erin Peach committed Nov 5, 2018
2 parents 368c692 + d6c6da0 commit 1347a9e
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 65 deletions.
4 changes: 3 additions & 1 deletion apps/src/dance/DanceVisualizationColumn.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import ProtectedVisualizationDiv from '../templates/ProtectedVisualizationDiv';
import Radium from "radium";
import {connect} from "react-redux";
import i18n from '@cdo/locale';
import queryString from "query-string";

const GAME_WIDTH = gameLabConstants.GAME_WIDTH;
const GAME_HEIGHT = gameLabConstants.GAME_HEIGHT;
Expand Down Expand Up @@ -67,7 +68,8 @@ class DanceVisualizationColumn extends React.Component {
// userType - 'teacher', assumed age > 13. 'student', age > 13.
// 'student_y', age < 13. 'unknown', signed out users
const signedInOver13 = this.props.userType === 'teacher' || this.props.userType === 'student';
const filterOff = signedInOver13 || sessionStorage.getItem('anon_over13');
const teacherOverride = queryString.parse(window.location.search).songfilter === 'on';
const filterOff = (signedInOver13 || sessionStorage.getItem('anon_over13')) && !teacherOverride;

return (
<span>
Expand Down
70 changes: 70 additions & 0 deletions dashboard/test/ui/features/dance/age_filter.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
Feature: Dance Lab Age Filter
Scenario: Song selector is visible and doesn't display pg13 songs for age < 13
Given I create a young student named "Harry"
And I am on "http://studio.code.org/s/allthethings/stage/37/puzzle/1?noautoplay=true"
And I rotate to landscape
And I wait for the page to fully load
And I wait for 3 seconds
And I wait until I don't see selector "#p5_loading"
And I close the instructions overlay if it exists
Then element "#runButton" is visible
And element "#song_selector" is visible
#Local PG-13 option should not be visible after filter in any environment
And I do not see "synthesize" option in the dropdown "#song_selector"
#Test PG-13 option should not be visible after filter in any environment
And I do not see "shapeofyou_edsheeran" option in the dropdown "#song_selector"

Scenario: Song selector is visible and displays all songs for age > 13 and teacher flag turns filter on
Given I create a student named "Ron"
And I am on "http://studio.code.org/s/allthethings/stage/37/puzzle/1?noautoplay=true"
And I rotate to landscape
And I wait for the page to fully load
And I wait for 3 seconds
And I wait until I don't see selector "#p5_loading"
And I close the instructions overlay if it exists
Then element "#runButton" is visible
And element "#song_selector" is visible
#Jazzy_beats is available on local and isawthesign is available on test
And I see option "jazzy_beats" or "isawthesign_aceofbase" in the dropdown "#song_selector"

Then I am on "http://studio.code.org/s/allthethings/stage/37/puzzle/1?noautoplay=true&songfilter=on"
And I wait for the page to fully load
And I wait until I don't see selector "#p5_loading"
#Local PG-13 option should not be visible after filter in any environment
And I do not see "synthesize" option in the dropdown "#song_selector"
#Test PG-13 option should not be visible after filter in any environment
And I do not see "shapeofyou_edsheeran" option in the dropdown "#song_selector"

Scenario: Selecting <13 in age dialog turns filter on
Given I am on "http://studio.code.org/s/allthethings/stage/37/puzzle/1?noautoplay=true"
And I rotate to landscape
And I wait for the page to fully load
And I wait for 3 seconds
And I wait until I don't see selector "#p5_loading"
And element ".signInOrAgeDialog" is visible
And I select the "10" option in dropdown "uitest-age-selector"
And I click selector "#uitest-submit-age"

And I close the instructions overlay if it exists
Then element "#runButton" is visible
And element "#song_selector" is visible
#Local PG-13 option should not be visible after filter in any environment
And I do not see "synthesize" option in the dropdown "#song_selector"
#Test PG-13 option should not be visible after filter in any environment
And I do not see "shapeofyou_edsheeran" option in the dropdown "#song_selector"

Scenario: Selecting 13 in age dialog turns filter off
Given I am on "http://studio.code.org/s/allthethings/stage/37/puzzle/1?noautoplay=true"
And I rotate to landscape
And I wait for the page to fully load
And I wait for 3 seconds
And I wait until I don't see selector "#p5_loading"
And element ".signInOrAgeDialog" is visible
And I select the "13" option in dropdown "uitest-age-selector"
And I click selector "#uitest-submit-age"

And I close the instructions overlay if it exists
Then element "#runButton" is visible
And element "#song_selector" is visible
#Jazzy_beats is available on local and isawthesign is available on test
And I see option "jazzy_beats" or "isawthesign_aceofbase" in the dropdown "#song_selector"
64 changes: 0 additions & 64 deletions dashboard/test/ui/features/spritelab/dancelab.feature
Original file line number Diff line number Diff line change
@@ -1,69 +1,5 @@
@no_older_chrome
Feature: Dance Lab
Scenario: Song selector is visible and doesn't display pg13 songs for age < 13
Given I create a young student named "Harry"
And I am on "http://studio.code.org/s/allthethings/stage/37/puzzle/1?noautoplay=true"
And I rotate to landscape
And I wait for the page to fully load
And I wait for 3 seconds
And I wait until I don't see selector "#p5_loading"
And I close the instructions overlay if it exists
Then element "#runButton" is visible
And element "#song_selector" is visible
#Local PG-13 option should not be visible after filter in any environment
And I do not see "synthesize" option in the dropdown "#song_selector"
#Test PG-13 option should not be visible after filter in any environment
And I do not see "shapeofyou_edsheeran" option in the dropdown "#song_selector"
And I sign out

Scenario: Song selector is visible and displays all songs for age > 13
Given I create a student named "Ron"
And I am on "http://studio.code.org/s/allthethings/stage/37/puzzle/1?noautoplay=true"
And I rotate to landscape
And I wait for the page to fully load
And I wait for 3 seconds
And I wait until I don't see selector "#p5_loading"
And I close the instructions overlay if it exists
Then element "#runButton" is visible
And element "#song_selector" is visible
#Jazzy_beats is available on local and isawthesign is available on test
And I see option "jazzy_beats" or "isawthesign_aceofbase" in the dropdown "#song_selector"
And I sign out

Scenario: Selecting <13 in age dialog turns filter on
Given I am on "http://studio.code.org/s/allthethings/stage/37/puzzle/1?noautoplay=true"
And I rotate to landscape
And I wait for the page to fully load
And I wait for 3 seconds
And I wait until I don't see selector "#p5_loading"
And element ".signInOrAgeDialog" is visible
And I select the "10" option in dropdown "uitest-age-selector"
And I click selector "#uitest-submit-age"

And I close the instructions overlay if it exists
Then element "#runButton" is visible
And element "#song_selector" is visible
#Local PG-13 option should not be visible after filter in any environment
And I do not see "synthesize" option in the dropdown "#song_selector"
#Test PG-13 option should not be visible after filter in any environment
And I do not see "shapeofyou_edsheeran" option in the dropdown "#song_selector"

Scenario: Selecting 13 in age dialog turns filter off
Given I am on "http://studio.code.org/s/allthethings/stage/37/puzzle/1?noautoplay=true"
And I rotate to landscape
And I wait for the page to fully load
And I wait for 3 seconds
And I wait until I don't see selector "#p5_loading"
And element ".signInOrAgeDialog" is visible
And I select the "13" option in dropdown "uitest-age-selector"
And I click selector "#uitest-submit-age"

And I close the instructions overlay if it exists
Then element "#runButton" is visible
And element "#song_selector" is visible
#Jazzy_beats is available on local and isawthesign is available on test
And I see option "jazzy_beats" or "isawthesign_aceofbase" in the dropdown "#song_selector"

# This test requires cloudfront.
@no_circle
@no_firefox
Expand Down

0 comments on commit 1347a9e

Please sign in to comment.