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

Adds Experiment flag to School Association, UI tests #57873

Merged
merged 7 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 0 additions & 1 deletion apps/src/lib/util/AnalyticsConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ const EVENTS = {
COUNTRY_SELECTED: 'User Selects Country',
ZIP_CODE_ENTERED: 'Valid Zip Code Entered',
SCHOOL_SEARCH_INPUT_ENTERED: 'School Search Input Entered',
SCHOOL_LIST_OPENED: 'School List Opened',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

SCHOOL_SELECTED_FROM_LIST: 'School Selected from Dropdown',
ADD_MANUALLY_CLICKED: 'User Elects to Add School Name Manually',
DO_NOT_TEACH_AT_SCHOOL_CLICKED:
Expand Down
54 changes: 32 additions & 22 deletions apps/src/sites/studio/pages/devise/registrations/_finish_sign_up.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import $ from 'jquery';
import React from 'react';
import ReactDOM from 'react-dom';
import SchoolInfoInputs from '@cdo/apps/templates/SchoolInfoInputs';
import SchoolDataInputs from '@cdo/apps/templates/SchoolDataInputs';
import getScriptData from '@cdo/apps/util/getScriptData';
import firehoseClient from '@cdo/apps/lib/util/firehose';
import experiments from '@cdo/apps/util/experiments';
Expand Down Expand Up @@ -236,28 +237,37 @@ $(document).ready(() => {

function renderSchoolInfo() {
if (schoolInfoMountPoint) {
ReactDOM.render(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not edited: just moved

<div style={{padding: 10}}>
<SchoolInfoInputs
schoolType={schoolData.schoolType}
country={schoolData.country}
ncesSchoolId={schoolData.ncesSchoolId}
schoolName={schoolData.schoolName}
schoolCity={schoolData.schoolCity}
schoolState={schoolData.schoolState}
schoolZip={schoolData.schoolZip}
schoolLocation={schoolData.schoolLocation}
useLocationSearch={schoolData.useLocationSearch}
onCountryChange={onCountryChange}
onSchoolTypeChange={onSchoolTypeChange}
onSchoolChange={onSchoolChange}
onSchoolNotFoundChange={onSchoolNotFoundChange}
showRequiredIndicator={false}
styles={{width: 580}}
/>
</div>,
schoolInfoMountPoint
);
if (experiments.isEnabled(experiments.SCHOOL_ASSOCIATION_V2)) {
hannahbergam marked this conversation as resolved.
Show resolved Hide resolved
ReactDOM.render(
<div style={{padding: 10}}>
<SchoolDataInputs />
</div>,
schoolInfoMountPoint
);
} else {
ReactDOM.render(
<div style={{padding: 10}}>
<SchoolInfoInputs
schoolType={schoolData.schoolType}
country={schoolData.country}
ncesSchoolId={schoolData.ncesSchoolId}
schoolName={schoolData.schoolName}
schoolCity={schoolData.schoolCity}
schoolState={schoolData.schoolState}
schoolZip={schoolData.schoolZip}
schoolLocation={schoolData.schoolLocation}
useLocationSearch={schoolData.useLocationSearch}
onCountryChange={onCountryChange}
onSchoolTypeChange={onSchoolTypeChange}
onSchoolChange={onSchoolChange}
onSchoolNotFoundChange={onSchoolNotFoundChange}
showRequiredIndicator={false}
styles={{width: 580}}
/>
</div>,
schoolInfoMountPoint
);
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions apps/src/templates/SchoolDataInputs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export default function SchoolDataInputs({
{i18n.whatCountry()}
</BodyTwoText>
<SimpleDropdown
id="uitest-country-dropdown"
className={style.dropdown}
name={fieldNames.country}
items={COUNTRY_ITEMS}
Expand All @@ -98,6 +99,7 @@ export default function SchoolDataInputs({
{i18n.enterYourSchoolZip()}
</BodyTwoText>
<input
id="uitest-school-zip"
type="text"
name={fieldNames.schoolZip}
onChange={e => {
Expand Down
2 changes: 1 addition & 1 deletion apps/src/templates/SchoolZipSearch.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export default function SchoolZipSearch({fieldNames, zip}) {
sendAnalyticsEvent(EVENTS.DO_NOT_TEACH_AT_SCHOOL_CLICKED, {});
} else if (schoolId === SELECT_A_SCHOOL) {
ncesId = '';
// sendAnalyticsEvent(EVENTS.SCHOOL_LIST_OPENED, {});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

See comment above: we decided to move forward without this event

} else if (schoolId === CLICK_TO_ADD) {
ncesId = '';
setInputManually(true);
Expand Down Expand Up @@ -89,6 +88,7 @@ export default function SchoolZipSearch({fieldNames, zip}) {
{i18n.selectYourSchool()}
</BodyTwoText>
<SimpleDropdown
id="uitest-school-dropdown"
className={style.dropdown}
name={fieldNames.ncesSchoolId}
items={SEARCH_DEFAULTS.concat(sortSchoolsByName(dropdownSchools))}
Expand Down
2 changes: 2 additions & 0 deletions apps/src/util/experiments.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ experiments.SPRITE_LAB_DOCS = 'sl_docs';
experiments.KEYBOARD_NAVIGATION = 'blockly_keyboard';
// Adds the ability to toggle between v1 and v2 of the section progress page of the teacher dashboard
experiments.SECTION_PROGRESS_V2 = 'section_progress_v2';
// Enables a user to utilize the new school association flow
experiments.SCHOOL_ASSOCIATION_V2 = 'school_association_v2';

/**
* This was a gamified version of the finish dialog, built in 2018,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
= f.hidden_field :terms_of_service_version, value: User::TERMS_OF_SERVICE_VERSIONS.last
= t('terms_interstitial.accept_tos', tos_url: CDO.code_org_url('/tos'), privacy_url: CDO.code_org_url('/privacy'), markdown: true).html_safe

%button.submit= t('signup_form.go_to_account')
%button.submit{:id => 'signup_finish_submit'}= t('signup_form.go_to_account')

:javascript
// Selects 'Teacher' as the user type
Expand Down
22 changes: 22 additions & 0 deletions dashboard/test/ui/features/acquisition_products/sign_up.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@eyes
Feature: Teacher can create a new account

Scenario: Teacher can create an account with the new school association flow

Given I am on "http://studio.code.org/users/sign_up"
And I press keys "my@validemail.com" for element "#user_email"
And I press keys "password" for element "#user_password"
And I press keys "password" for element "#user_password_confirmation"
And I press "#signup_form_submit" using jQuery
# Add the experiment flag
And I am on "http://studio.code.org/users/sign_up?enableExperiments=school_association_v2"
hannahbergam marked this conversation as resolved.
Show resolved Hide resolved
And I press "select-user-type-teacher"
And I press keys "myDisplayName" for element "#user_name"
And I select the "United States" option in dropdown "uitest-country-dropdown"
And I press keys "98112" for element "#uitest-school-zip"
And I select the "Holy Names Academy" option in dropdown "uitest-school-dropdown"
hannahbergam marked this conversation as resolved.
Show resolved Hide resolved
And I open my eyes to test "School Association"
And I see no difference for "School Association: all fields"
When I press "user_email_preference_opt_in_no"
And I press "#signup_finish_submit" using jQuery
And I wait until I see selector "#uitest-accept-section-creation"