forked from oppia/oppia
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GSoC'24] M2.1 : Fix a part of oppia#20374: Acceptance test coverage …
…for 2 Logged-out Users' CUJs. (oppia#20674) * updates * updates * updates * updates * updates * updates * updates * updates * updates * updates * updates * updates * updates * updates * updates * updates * updates * updates * updates * updates * updates * updates * updates * updates * updates * updates * updates * updates * updates * updates * updates * updates * updates
- Loading branch information
1 parent
79e6d0a
commit 0aaa41e
Showing
28 changed files
with
1,008 additions
and
444 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
...ce-tests/specs/logged-out-user/browse-and-search-for-lessons-in-community-library.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
// Copyright 2024 The Oppia Authors. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS-IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
/** | ||
* @fileoverview Acceptance tests for the community library page interactions. | ||
*/ | ||
|
||
import {UserFactory} from '../../utilities/common/user-factory'; | ||
import testConstants from '../../utilities/common/test-constants'; | ||
import {LoggedOutUser} from '../../utilities/user/logged-out-user'; | ||
import {ExplorationEditor} from '../../utilities/user/exploration-editor'; | ||
import {LoggedInUser} from '../../utilities/user/logged-in-user'; | ||
|
||
const DEFAULT_SPEC_TIMEOUT_MSECS = testConstants.DEFAULT_SPEC_TIMEOUT_MSECS; | ||
|
||
describe('Logged-out User', function () { | ||
let explorationEditor: ExplorationEditor & LoggedInUser; | ||
let loggedOutUser: LoggedOutUser; | ||
let explorationId1: string | null; | ||
let explorationId2: string | null; | ||
|
||
beforeAll(async function () { | ||
explorationEditor = await UserFactory.createNewUser( | ||
'explorationEditor', | ||
'[email protected]' | ||
); | ||
|
||
loggedOutUser = await UserFactory.createLoggedOutUser(); | ||
|
||
explorationId1 = | ||
await explorationEditor.createAndPublishAMinimalExplorationWithTitle( | ||
'Algebra I' | ||
); | ||
explorationId2 = | ||
await explorationEditor.createAndPublishAMinimalExplorationWithTitle( | ||
'Algebra II', | ||
'Algorithms' | ||
); | ||
|
||
await explorationEditor.playExploration(explorationId1); | ||
await explorationEditor.rateExploration( | ||
5, | ||
'Excellent advanced Algebra course', | ||
false | ||
); | ||
|
||
await explorationEditor.playExploration(explorationId2); | ||
await explorationEditor.rateExploration( | ||
4, | ||
'Excellent advanced Algebra course', | ||
false | ||
); | ||
}, DEFAULT_SPEC_TIMEOUT_MSECS); | ||
|
||
it( | ||
'should be able to browse and search for lessons and see the rating of lessons in the community library', | ||
async function () { | ||
await loggedOutUser.navigateToCommunityLibraryPage(); | ||
|
||
await loggedOutUser.searchForLessonInSearchBar('Algebra II'); | ||
await loggedOutUser.expectSearchResultsToContain([ | ||
'Algebra I', | ||
'Algebra II', | ||
]); | ||
|
||
await loggedOutUser.filterLessonsByCategories(['Algorithms']); | ||
await loggedOutUser.expectSearchResultsToContain(['Algebra II']); | ||
|
||
await loggedOutUser.filterLessonsByLanguage(['Ákán']); | ||
// No lessons are created in the Ákán language. | ||
await loggedOutUser.expectSearchResultsToContain([]); | ||
|
||
// Access the top-rated page at /community-library/top-rated, which shows explorations with high ratings. | ||
await loggedOutUser.navigateToTopRatedLessonsPage(); | ||
await loggedOutUser.expectLessonsInOrder(['Algebra I', 'Algebra II']); | ||
|
||
// Visit the recently published explorations page at /community-library/recently-published. | ||
await loggedOutUser.navigateToRecentlyPublishedLessonsPage(); | ||
await loggedOutUser.expectLessonsInOrder(['Algebra II', 'Algebra I']); | ||
|
||
// View the ratings on an exploration once a minimum number of ratings have been submitted. | ||
await loggedOutUser.expectLessonsToHaveRating(5, 'Algebra I'); | ||
}, | ||
DEFAULT_SPEC_TIMEOUT_MSECS | ||
); | ||
|
||
afterAll(async function () { | ||
await UserFactory.closeAllBrowsers(); | ||
}); | ||
}); |
129 changes: 129 additions & 0 deletions
129
...-acceptance-tests/specs/logged-out-user/select-and-play-topic-from-classroom-page.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
// Copyright 2024 The Oppia Authors. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS-IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
/** | ||
* @fileoverview Acceptance Test for the learner journey in the math classroom. | ||
* The test includes: | ||
* - Setup: Creation of exploration, topic, subtopic, skill, story, and classroom by a curriculum admin. | ||
* - User Journey: Navigation to classroom, selection of topic, completion of exploration, and review of a card by a logged-out user. | ||
*/ | ||
|
||
import {UserFactory} from '../../utilities/common/user-factory'; | ||
import testConstants from '../../utilities/common/test-constants'; | ||
import {LoggedOutUser} from '../../utilities/user/logged-out-user'; | ||
import {ExplorationEditor} from '../../utilities/user/exploration-editor'; | ||
import {CurriculumAdmin} from '../../utilities/user/curriculum-admin'; | ||
import {ConsoleReporter} from '../../utilities/common/console-reporter'; | ||
|
||
const DEFAULT_SPEC_TIMEOUT_MSECS = testConstants.DEFAULT_SPEC_TIMEOUT_MSECS; | ||
const ROLES = testConstants.Roles; | ||
|
||
ConsoleReporter.setConsoleErrorsToIgnore([ | ||
/Occurred at http:\/\/localhost:8181\/story_editor\/[a-zA-Z0-9]+\/.*Cannot read properties of undefined \(reading 'getStory'\)/, | ||
/Occurred at http:\/\/localhost:8181\/create\/[a-zA-Z0-9]+\/.*Invalid active state name: null/, | ||
new RegExp('Invalid active state name: null'), | ||
/Occurred at http:\/\/localhost:8181\/.*Failed to load resource: net::ERR_NETWORK_CHANGED/, | ||
/Occurred at http:\/\/localhost:8181\/create\/[a-zA-Z0-9]+\/.*Failed to load resource: net::ERR_BLOCKED_BY_RESPONSE\.NotSameOrigin/, | ||
/.*404.*Not Found.*/, | ||
]); | ||
|
||
describe('Logged-out User', function () { | ||
let curriculumAdmin: CurriculumAdmin & ExplorationEditor; | ||
let loggedOutUser: LoggedOutUser; | ||
let explorationId: string | null; | ||
|
||
beforeAll(async function () { | ||
curriculumAdmin = await UserFactory.createNewUser( | ||
'curriculumAdm', | ||
'[email protected]', | ||
[ROLES.CURRICULUM_ADMIN] | ||
); | ||
|
||
loggedOutUser = await UserFactory.createLoggedOutUser(); | ||
|
||
explorationId = | ||
await curriculumAdmin.createAndPublishAMinimalExplorationWithTitle( | ||
'Negative Numbers' | ||
); | ||
|
||
await curriculumAdmin.createTopic('Algebra I', 'algebra-one'); | ||
await curriculumAdmin.createSubtopicForTopic( | ||
'Negative Numbers', | ||
'negative-numbers', | ||
'Algebra I' | ||
); | ||
await curriculumAdmin.createSkillForTopic('Negative Numbers', 'Algebra I'); | ||
await curriculumAdmin.createQuestionsForSkill('Negative Numbers', 3); | ||
await curriculumAdmin.assignSkillToSubtopicInTopicEditor( | ||
'Negative Numbers', | ||
'Negative Numbers', | ||
'Algebra I' | ||
); | ||
await curriculumAdmin.addSkillToDiagnosticTest( | ||
'Negative Numbers', | ||
'Algebra I' | ||
); | ||
await curriculumAdmin.publishDraftTopic('Algebra I'); | ||
|
||
await curriculumAdmin.createAndPublishClassroom( | ||
'Math', | ||
'math', | ||
'Algebra I' | ||
); | ||
|
||
await curriculumAdmin.createAndPublishStoryWithChapter( | ||
'Algebra Story', | ||
'algebra-story', | ||
'Understanding Negative Numbers', | ||
explorationId as string, | ||
'Algebra I' | ||
); | ||
// Setup taking longer than 300000ms. | ||
}, 420000); | ||
|
||
it( | ||
'should be able to select and play a topic from the classroom page', | ||
async function () { | ||
await loggedOutUser.navigateToClassroomPage('math'); | ||
await loggedOutUser.expectTopicsToBePresent(['Algebra I']); | ||
|
||
await loggedOutUser.selectAndOpenTopic('Algebra I'); | ||
await loggedOutUser.selectChapterWithinStoryToLearn( | ||
'Understanding Negative Numbers', | ||
'Algebra Story' | ||
); | ||
|
||
// Check for the completion message as the exploration has a single state. | ||
await loggedOutUser.expectExplorationCompletionToastMessage( | ||
'Congratulations for completing this lesson!' | ||
); | ||
|
||
// Returning to the topic page from the exploration player itself. | ||
await loggedOutUser.returnToTopicPageAfterCompletingExploration(); | ||
await loggedOutUser.navigateToRevisionTab(); | ||
|
||
// Review cards are the subtopic that are created in the topic. | ||
await loggedOutUser.selectReviewCardToLearn('Negative Numbers'); | ||
await loggedOutUser.expectReviewCardToHaveContent( | ||
'Negative Numbers', | ||
'Subtopic creation description text for Negative Numbers' | ||
); | ||
}, | ||
DEFAULT_SPEC_TIMEOUT_MSECS | ||
); | ||
|
||
afterAll(async function () { | ||
await UserFactory.closeAllBrowsers(); | ||
}); | ||
}); |
Oops, something went wrong.