Skip to content

Commit

Permalink
New Structures e2e tests (oppia#6315)
Browse files Browse the repository at this point in the history
* added topics and skills dashboard e2e tests

* fix lint

* fixed test

* added topic and skill deletion tests

* Created test files

* Modified conf files

* added topic name, description and create story tests

* added story editor tests

* Add E2E tests for Skill Editor

* changes

* Added skill publishing tests

* Lint

* added subtopic tests

* Fix oppia#5692 and done with all e2e tests
  • Loading branch information
aks681 authored Mar 3, 2019
1 parent a55524c commit 49c0a8c
Show file tree
Hide file tree
Showing 40 changed files with 968 additions and 79 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ env:
- RUN_E2E_TESTS_PREFERENCES=true
- RUN_E2E_TESTS_PROFILE_MENU=true
- RUN_E2E_TESTS_PUBLICATION=true
- RUN_E2E_TESTS_SKILL_EDITOR=true
- RUN_E2E_TESTS_SUBSCRIPTIONS=true
- RUN_E2E_TESTS_TOPICS_AND_SKILLS_DASHBOARD=true
- RUN_E2E_TESTS_TOPIC_AND_STORY_EDITOR=true
- RUN_E2E_TESTS_USERS=true

matrix:
Expand Down Expand Up @@ -132,8 +134,10 @@ script:
- if [ "$RUN_E2E_TESTS_PREFERENCES" == 'true' ]; then travis_retry bash scripts/run_e2e_tests.sh --suite="preferences" --prod_env; fi
- if [ "$RUN_E2E_TESTS_PROFILE_MENU" == 'true' ]; then travis_retry bash scripts/run_e2e_tests.sh --suite="profileMenu" --prod_env; fi
- if [ "$RUN_E2E_TESTS_PUBLICATION" == 'true' ]; then travis_retry bash scripts/run_e2e_tests.sh --suite="publication" --prod_env; fi
- if [ "$RUN_E2E_TESTS_SKILL_EDITOR" == 'true' ]; then travis_retry bash scripts/run_e2e_tests.sh --suite="skillEditorPage" --prod_env; fi
- if [ "$RUN_E2E_TESTS_SUBSCRIPTIONS" == 'true' ]; then travis_retry bash scripts/run_e2e_tests.sh --suite="subscriptions" --prod_env; fi
- if [ "$RUN_E2E_TESTS_TOPICS_AND_SKILLS_DASHBOARD" == 'true' ]; then travis_retry bash scripts/run_e2e_tests.sh --suite="topicsAndSkillsDashboard" --prod_env; fi
- if [ "$RUN_E2E_TESTS_TOPIC_AND_STORY_EDITOR" == 'true' ]; then travis_retry bash scripts/run_e2e_tests.sh --suite="topicAndStoryEditor" --prod_env; fi
- if [ "$RUN_E2E_TESTS_USERS" == 'true' ]; then travis_retry bash scripts/run_e2e_tests.sh --suite="users" --prod_env; fi
# Run e2e tests for mobile in dev mode since the demo explorations and collections are only available in the dev mode and not in production mode.
- if [ "$RUN_E2E_TESTS_MOBILE" == 'true' ]; then travis_retry bash scripts/run_e2e_tests.sh --browserstack; fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ oppia.directive('ruleTypeSelector', [function() {
ruleTypesToDescriptions[ruleType])
});
}

// TODO(bhenning): The order of choices should be meaningful. E.g.,
// having "is equal to" for most interactions first makes sense. They
// should ideally be ordered based on likelihood of being used.
Expand All @@ -64,6 +63,7 @@ oppia.directive('ruleTypeSelector', [function() {
// Suppress the search box.
minimumResultsForSearch: -1,
width: '350px',
dropdownParent: $('.rule-parent'),
templateSelection: function(object) {
return $filter('truncateAtFirstEllipsis')(object.text);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,6 @@

<div ng-if="isEditable()">
<strong>The answers in this group are correct</strong>
<input type="checkbox" ng-model="outcome.labelledAsCorrect" ng-change="onChangeCorrectnessLabel()">
<input class="protractor-test-editor-correctness-toggle" type="checkbox" ng-model="outcome.labelledAsCorrect" ng-change="onChangeCorrectnessLabel()">
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div style="position: relative;">
<form class="form-inline protractor-test-rule-details" role="form" name="ruleEditForm.form">
<div ng-if="rule.type != 'FuzzyMatches'">
<div ng-if="rule.type != 'FuzzyMatches'" class="rule-parent">
<rule-type-selector class="protractor-test-answer-description" local-value="<[rule.type]>" on-selection-change="onSelectNewRuleType">
</rule-type-selector>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<button class="btn btn-default"
<button class="btn btn-default protractor-test-create-question-button"
ng-click="createQuestion()"
style="float: right;">
Create Question
Expand All @@ -21,7 +21,7 @@
</th>
</tr>
<tr ng-repeat="question in questionSummaries"
class="list-item"
class="list-item protractor-test-question-list-item"
ng-click="editQuestion(question.summary)">
<td> <[getQuestionIndex($index)]> </td>
<td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}
</style>

<div class="add-misconception-modal">
<div class="add-misconception-modal protractor-test-add-misconception-modal">
<div class="modal-header">
<h3>Add Misconception</h3>
</div>
Expand All @@ -22,7 +22,7 @@ <h3>Add Misconception</h3>
<span class="oppia-editor-description">Use a name that will be easy for question creators to understand.</span>
</div>
<div>
<input class="form-control" type="text" ng-model="misconceptionName" maxlength="30" autofocus>
<input class="form-control protractor-test-misconception-name-field" type="text" ng-model="misconceptionName" maxlength="30" autofocus>
<span ng-if="misconceptionName.length === 30" class="help-block" style="color: red; font-size: smaller">
<em>Please use at most 30 characters.</em>
</span>
Expand All @@ -33,22 +33,22 @@ <h3>Add Misconception</h3>
<div>
<span class="oppia-editor-description">These are additional notes for question creators to understand how handling this misconception is useful for the skill being tested.</span>
</div>
<schema-based-editor schema="MISCONCEPTION_PROPERTY_FORM_SCHEMA" local-value="misconceptionNotes">
<schema-based-editor class="protractor-test-notes-textarea" schema="MISCONCEPTION_PROPERTY_FORM_SCHEMA" local-value="misconceptionNotes">
</schema-based-editor>
</div>
<div class="oppia-misconception-editor-section">
<strong>Default Feedback</strong>
<div>
<span class="oppia-editor-description">This is the default feedback given to learners when they have this misconception. Question creators may override this feedback.</span>
</div>
<schema-based-editor schema="MISCONCEPTION_FEEDBACK_PROPERTY_FORM_SCHEMA" local-value="misconceptionFeedback">
<schema-based-editor class="protractor-test-feedback-textarea" schema="MISCONCEPTION_FEEDBACK_PROPERTY_FORM_SCHEMA" local-value="misconceptionFeedback">
</schema-based-editor>
</div>
</div>
</div>

<div class="modal-footer">
<button class="btn btn-default" ng-click="cancel()">Cancel</button>
<button class="btn btn-success" ng-click="saveMisconception()" ng-disabled="!misconceptionName || misconceptionNotes.length === 0 || misconceptionFeedback.length === 0">Save</button>
<button class="btn btn-success protractor-test-confirm-add-misconception-button" ng-click="saveMisconception()" ng-disabled="!misconceptionName || misconceptionNotes.length === 0 || misconceptionFeedback.length === 0">Save</button>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="modal-header">
<div class="modal-header protractor-test-add-worked-example-modal">
<h3>Add Worked Example</h3>
</div>

Expand All @@ -16,5 +16,5 @@ <h3>Add Worked Example</h3>

<div class="modal-footer">
<button class="btn btn-default" ng-click="cancel()">Cancel</button>
<button class="btn btn-success" ng-click="saveWorkedExample()" ng-disabled="!tmpWorkedExampleHtml">Save</button>
<button class="btn btn-success protractor-test-save-worked-example-button" ng-click="saveWorkedExample()" ng-disabled="!tmpWorkedExampleHtml">Save</button>
</div>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="modal-header">
<div class="modal-header protractor-test-delete-misconception-modal">
<h3>Delete Misconception</h3>
</div>

Expand All @@ -8,5 +8,5 @@ <h3>Delete Misconception</h3>

<div class="modal-footer">
<button class="btn btn-default" ng-click="cancel()">Cancel</button>
<button class="btn btn-danger" ng-click="confirm()">Delete Misconception</button>
<button class="btn btn-danger protractor-test-confirm-delete-misconception-button" ng-click="confirm()">Delete Misconception</button>
</div>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="modal-header">
<div class="modal-header protractor-test-delete-worked-example-modal">
<h3>Delete Worked Example</h3>
</div>

Expand All @@ -8,5 +8,5 @@ <h3>Delete Worked Example</h3>

<div class="modal-footer">
<button class="btn btn-default" ng-click="cancel()">Cancel</button>
<button class="btn btn-danger" ng-click="confirm()">Delete Worked Example</button>
<button class="btn btn-danger protractor-test-confirm-delete-worked-example-button" ng-click="confirm()">Delete Worked Example</button>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
<div ng-if="!conceptCardExplanationEditorIsShown" class="review-material" style="padding-top: 0.5em;">
<div ng-class="oppia-editable-section"
ng-click="openConceptCardExplanationEditor()">
<i class="material-icons oppia-editor-edit-icon pull-right"
<i class="material-icons oppia-editor-edit-icon pull-right protractor-test-edit-concept-card"
title="Edit Concept Card Explanation">&#xE254;
</i>
<div class="oppia-state-content-display oppia-transition-200"
<div class="oppia-state-content-display oppia-transition-200 protractor-test-concept-card-explanation"
ng-class="oppia-prevent-selection"
title="Concept Card Explanation">
<span class="oppia-placeholder" ng-show="skill.getConceptCard().getExplanation().getHtml() === ''">
Expand All @@ -27,11 +27,11 @@
</div>

<div ng-if="conceptCardExplanationEditorIsShown">
<schema-based-editor schema="HTML_SCHEMA" local-value="bindableFieldsDict.displayedConceptCardExplanation">
<schema-based-editor schema="HTML_SCHEMA" class="protractor-test-concept-card-text" local-value="bindableFieldsDict.displayedConceptCardExplanation">
</schema-based-editor>
<div class="editor-buttons">
<button type="button"
class="btn btn-success oppia-save-state-item-button pull-right"
class="btn btn-success oppia-save-state-item-button pull-right protractor-test-save-concept-card"
ng-click="saveConceptCardExplanation()">
Save
</button>
Expand Down Expand Up @@ -67,7 +67,7 @@
<img ng-src="<[dragDotsImgUrl]>" width="10">
</span>
<a ng-click="changeActiveWorkedExampleIndex($index)"
class="oppia-rule-tab"
class="oppia-rule-tab protractor-test-worked-example-<[$index]>"
ng-class="{'oppia-rule-tab-active': activeWorkedExampleIndex === $index}">
<summary-list-header index="$index"
disable-sorting="bindableFieldsDict.displayedWorkedExamples.length === 1"
Expand All @@ -92,7 +92,7 @@
</ul>
</div>
<button type="button"
class="btn"
class="btn protractor-test-add-worked-example"
style="background-color: rgba(5,140,166,0.9); color: white;"
ng-click="openAddWorkedExampleModal()">
+ Add Worked Example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
This is the name of the skill as visible to learners and other creators.
</div>
<p ng-class="{'has-error': !tmpSkillDescription.length > 0}">
<input type="text" class="form-control" ng-disabled="!canEditSkillDescription()"
<input type="text" class="form-control protractor-test-skill-description-field" ng-disabled="!canEditSkillDescription()"
ng-model="tmpSkillDescription" ng-blur="saveSkillDescription(tmpSkillDescription)"
maxlength="40" ng-trim="false">
<span ng-if="tmpSkillDescription.length === 40" class="help-block" style="color: red; font-size: smaller">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
ng-model="misconceptions">
<li ng-repeat="misconception in misconceptions"
ng-class="{'active': activeMisconceptionIndex === $index, 'last-element': $index === misconceptions.length - 1}"
class="oppia-rule-block oppia-prevent-selection"
class="oppia-rule-block oppia-prevent-selection protractor-test-misconception-list-item"
style="margin-top: 0;">
<a ng-click="changeActiveMisconceptionIndex($index)"
class="oppia-rule-tab"
class="oppia-rule-tab protractor-test-misconception-<[$index]>"
ng-class="{'oppia-rule-tab-active': activeMisconceptionIndex === $index}">
<summary-list-header index="$index"
disable-sorting="true"
Expand All @@ -42,7 +42,7 @@
</ul>
</div>
<button type="button"
class="btn"
class="btn protractor-test-add-misconception-modal-button"
style="background-color: rgba(5,140,166,0.9); color: white;"
ng-click="openAddMisconceptionModal()">
+ Add Misconception
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ <h3>
</div>
<div class="modal-footer">
<button class="btn btn-default" ng-click="cancel()"> Cancel </button>
<button class="btn btn-success" ng-click="done()"> Save and Publish Question </button>
<button class="btn btn-success protractor-test-save-question-button" ng-click="done()"> Save and Publish Question </button>
</div>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<ul class="nav navbar-nav oppia-navbar-nav navbar-right ng-cloak" ng-if="!isLoadingSkill()">
<li style="margin-right: 5px; margin-top: 8px;">
<div uib-dropdown>
<button class="btn btn-default oppia-save-draft-button"
<button class="btn btn-default oppia-save-draft-button protractor-test-save-or-publish-skill"
ng-class="{'btn-success': isSkillSaveable(), 'save-draft-button-padding': getChangeListCount()}"
ng-click="saveChanges()"
style="float: left;"
Expand Down Expand Up @@ -76,7 +76,7 @@
</li>
</ul>
</li>
<li class="icon"
<li class="icon protractor-test-questions-tab"
style="margin-right: 20px;"
ng-class="{'active': getActiveTabName() === 'questions'}"
ng-click="selectQuestionsTab()">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ <h3>

<div class="modal-footer">
<button class="btn btn-default" ng-click="cancel()">Cancel</button>
<button class="btn btn-success" ng-click="save()">
<button class="btn btn-success protractor-test-confirm-skill-publish-button"
ng-click="save()">
<span>Publish Skill</span>
</button>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ <h3>
</div>
<div class="modal-footer">
<button class="btn btn-default" ng-click="cancel()">Cancel</button>
<button class="btn btn-danger" ng-click="confirmDeletion()">
<button class="btn btn-danger protractor-test-confirm-delete-chapter-button" ng-click="confirmDeletion()">
<span>Delete Chapter</span>
</button>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ <h3>
<p>
Enter the title for the chapter
</p>
<input class="form-control" style="font-size: 12px;"
<input class="form-control protractor-test-new-chapter-title-field" style="font-size: 12px;"
placeholder="Enter the title for this chapter to be displayed to learners in the story viewer page (can be edited later)"
ng-model="nodeTitle" ng-change="resetErrorMsg()" autofocus>
<span class="help-block" style="font-size: smaller; color: red;" ng-if="errorMsg">
<em><[errorMsg]></em>
</span>
</div>
<div class="modal-footer">
<button class="btn btn-success" type="submit" ng-disabled="isNodeTitleEmpty(nodeTitle)">
<button class="btn btn-success protractor-test-confirm-chapter-creation-button" type="submit" ng-disabled="isNodeTitleEmpty(nodeTitle)">
<span>Create Chapter</span>
</button>
<button class="btn btn-default" ng-click="cancel()">Cancel</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<md-card class="oppia-page-card oppia-long-text">
<div class="story-title">
<label for="storyTitle" class="form-heading">Story Title</label>
<input id="storyTitle" type="text" class="form-control"
<input id="storyTitle" type="text" class="form-control protractor-test-story-title-field"
ng-model="editableTitle" ng-blur="updateStoryTitle(editableTitle)"
placeholder="Enter a title for the story." maxlength="20" ng-trim="false">
<span class="help-block" style="font-size: smaller; color: red;" ng-if="editableTitle.length === 20">
Expand All @@ -12,7 +12,7 @@

<div class="story-description" ng-class="{'has-error': editableDescriptionIsEmpty && storyDescriptionChanged}">
<label for="storyDescription" class="form-heading">Story Description</label>
<textarea type="text" class="form-control"
<textarea type="text" class="form-control protractor-test-story-description-field"
ng-model="editableDescription"
ng-change="updateStoryDescriptionStatus(editableDescription)"
ng-blur="updateStoryDescription(editableDescription)"
Expand All @@ -27,8 +27,7 @@
<div class="oppia-editor-card-body">
<label class="form-heading">Notes</label>
<div ng-if="!notesEditorIsShown" style="padding-top: 0.5em; padding-bottom: 1em;">
<div ng-class="oppia-editable-section"
ng-click="openNotesEditor()">
<div ng-class="oppia-editable-section" ng-click="openNotesEditor()" class="protractor-test-open-story-notes-editor-button">
<i class="material-icons oppia-editor-edit-icon pull-right"
title="Edit Story Notes">&#xE254;
</i>
Expand All @@ -38,7 +37,7 @@
<span class="oppia-placeholder" ng-show="editableNotes === ''">
Add notes about the story to help other contributors.
</span>
<angular-html-bind html-data="editableNotes">
<angular-html-bind class="protractor-test-story-notes" html-data="editableNotes">
</angular-html-bind>
</div>
<!-- This is a dummy div created to mask the contents when the user hovers over the content. -->
Expand All @@ -47,12 +46,12 @@
</div>
</div>

<div ng-if="notesEditorIsShown">
<div ng-if="notesEditorIsShown" class="protractor-test-story-notes-rte">
<schema-based-editor schema="NOTES_SCHEMA" local-value="editableNotes">
</schema-based-editor>
<div class="editor-buttons">
<button type="button"
class="btn btn-success oppia-save-state-item-button pull-right"
class="btn btn-success oppia-save-state-item-button pull-right protractor-test-save-story-notes-button"
ng-disabled="!editableNotes"
ng-click="updateNotes(editableNotes)">
Save
Expand All @@ -74,7 +73,7 @@
ng-class="{'selected-node': (node.getId() === idOfNodeToEdit)}"
ng-click="setNodeToEdit(node.getId())">
<div class="story-editor-node-title">
<[node.getTitle()]>
<span class="protractor-test-chapter-title"><[node.getTitle()]></span>
</div>
<span style="font-size: 0.8em; width: 15vw;" ng-if="disconnectedNodeIds.indexOf(node.getId()) !== -1">
<i>This chapter is not reachable from any other chapter</i>
Expand All @@ -86,7 +85,7 @@
</span>
</span>
<span class="story-editor-delete-node">
<span ng-click="deleteNode(node.getId())" aria-hidden="true">
<span class="protractor-test-delete-chapter-button" ng-click="deleteNode(node.getId())" aria-hidden="true">
<i class="material-icons md-18">&#xE14C;</i>
</span>
</span>
Expand All @@ -111,7 +110,7 @@
<p class="no-chapters-message" style="padding-top: 6px;">
This story has no chapters.
</p>
<button class="btn oppia-dashboard-intro-button oppia-transition-200"
<button class="btn oppia-dashboard-intro-button oppia-transition-200 protractor-test-create-chapter-button"
style="color: white; text-decoration: none;"
ng-click="createNode()">
Create Chapter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@
ng-click="addDestinationNode(newNodeId)">
<option value="">Pick an already existing chapter</option>
</select>
<button class="btn btn-success" ng-click="addNewDestinationNode()"> Add a new Destination Chapter </button>
<button class="btn btn-success protractor-test-add-destination-chapter-button"
ng-click="addNewDestinationNode()"> Add a new Destination Chapter
</button>
</span>
</div>
</div>
Expand Down
Loading

0 comments on commit 49c0a8c

Please sign in to comment.