Skip to content

Commit

Permalink
[GSoC'24] M2.1 : Fix a part of oppia#20374: Acceptance test coverage …
Browse files Browse the repository at this point in the history
…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
Akhilesh-max authored Jul 25, 2024
1 parent 79e6d0a commit 0aaa41e
Show file tree
Hide file tree
Showing 28 changed files with 1,008 additions and 444 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</div>
<div class="form-group oppia-form-group">
<span>
<select class="form-control oppia-form-control"
<select class="form-control oppia-form-control e2e-test-destination-when-stuck-selector-dropdown"
[(ngModel)]="outcome.destIfReallyStuck"
(ngModelChange)="onDestIfStuckSelectorChange()">
<option *ngFor="let choice of destinationChoices" [ngValue]="choice.id">{{ choice.text }}</option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="oppia-response-header">
<span *ngIf="showWarning"></span>
<div class="oppia-response-container-desktop">
<i class="fas fa-times oppia-response-tick-cross oppia-response-cross" *ngIf="!isCorrect() && isResponse && !isCurrentInteractionLinear()"></i>
<i class="fas fa-times oppia-response-tick-cross oppia-response-cross e2e-test-incorrect-response-icon" *ngIf="!isCorrect() && isResponse && !isCurrentInteractionLinear()"></i>
<i class="fas fa-check oppia-response-tick-cross oppia-response-tick e2e-test-correct-tick-mark" *ngIf="isCorrect() && isResponse && !isCurrentInteractionLinear()"></i>
</div>
<div class="oppia-responses-mobile">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
<span class="activity-title e2e-test-exp-summary-tile-title">
<span *ngIf="isWindowLarge">
<span *ngIf="!isHackyExpTitleTranslationDisplayed()"
[attr.aria-label]="'exploration title:' + explorationTitle + '.'">
[attr.aria-label]="'exploration title:' + explorationTitle + '.'"
class="e2e-test-exploration-tile-title">
{{ explorationTitle | truncate:40 }}
</span>
<span *ngIf="isHackyExpTitleTranslationDisplayed()"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<div class="oppia-story-title" dir="auto" *ngIf="!checkTabletView()">
<strong class="title-text">
<a [href]="storyLink" [ngClass]="{'disabled-link': !classroomUrlFragment}">
<span *ngIf="!isHackyStoryTitleTranslationDisplayed()">
<span *ngIf="!isHackyStoryTitleTranslationDisplayed()" class="e2e-test-story-title-in-topic-page">
{{ storyTitle }}
</span>
<span *ngIf="isHackyStoryTitleTranslationDisplayed()">
Expand Down Expand Up @@ -88,7 +88,7 @@
</div>
<div class="oppia-story-title" dir="ltr" *ngIf="checkTabletView()">
<strong class="title-text">
<a [href]="storyLink" [ngClass]="{'disabled-link': !classroomUrlFragment}">{{ storyTitle }} </a>
<a [href]="storyLink" class="e2e-test-mobile-story-title" [ngClass]="{'disabled-link': !classroomUrlFragment}">{{ storyTitle }}</a>
</strong>
<span dir="auto" class="oppia-chapters-count">
<p class="oppia-chapters-count-text" [innerHTML]="'I18N_TOPIC_VIEWER_CHAPTERS' | translate:{count:nodeCount, messageFormat: true}"></p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<div class="oppia-feedback-popover-bottom-container">
<div class="checkbox oppia-checkbox" *ngIf="isLoggedIn">
<label>
<input type="checkbox" [(ngModel)]="isSubmitterAnonymized">
<input type="checkbox" [(ngModel)]="isSubmitterAnonymized" class="e2e-test-stay-anonymous-checkbox">
<span>{{ 'I18N_PLAYER_STAY_ANONYMOUS' | translate }}</span>
</label>
</div>
Expand All @@ -35,7 +35,7 @@
</div>
</div>

<div aria-live="polite" *ngIf="feedbackSubmitted">
<div class="e2e-test-rating-submitted-message" aria-live="polite" *ngIf="feedbackSubmitted">
{{ 'I18N_PLAYER_THANK_FEEDBACK' | translate }}
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ describe('FeedbackPopupComponent', () => {
expect(component.feedbackSubmitted).toBe(false);

component.saveFeedback();
tick(2001);
tick(3001);

expect(component.feedbackSubmitted).toBe(true);
expect(component.closePopover.emit).toHaveBeenCalled();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export class FeedbackPopupComponent {
this.feedbackSubmitted = true;
setTimeout(() => {
this.close();
}, 2000);
}, 3000);
});
}
}
Expand Down
8 changes: 8 additions & 0 deletions core/tests/ci-test-suite-configs/acceptance.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@
"name": "logged-out-user/visit-classroom-index-page",
"module": "core/tests/puppeteer-acceptance-tests/specs/logged-out-user/visit-classroom-index-page.spec.ts"
},
{
"name": "logged-out-user/browse-and-search-for-lessons-in-community-library",
"module": "core/tests/puppeteer-acceptance-tests/specs/logged-out-user/browse-and-search-for-lessons-in-community-library.spec.ts"
},
{
"name": "logged-out-user/select-and-play-topic-from-classroom-page",
"module": "core/tests/puppeteer-acceptance-tests/specs/logged-out-user/select-and-play-topic-from-classroom-page.spec.ts"
},
{
"name": "moderator/edit-featured-activities-list",
"module": "core/tests/puppeteer-acceptance-tests/specs/moderator/edit-featured-activities-list.spec.ts"
Expand Down
8 changes: 0 additions & 8 deletions core/tests/ci-test-suite-configs/e2e.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@
"name": "checkpointFeatures",
"module": "core/tests/webdriverio_desktop/checkpointFeatures.js"
},
{
"name": "classroomPage",
"module": "core/tests/webdriverio_desktop/classroomPage.js"
},
{
"name": "collections",
"module": "core/tests/webdriverio_desktop/collections.js"
Expand Down Expand Up @@ -100,10 +96,6 @@
"name": "learnerDashboard",
"module": "core/tests/webdriverio_desktop/learnerDashboard.js"
},
{
"name": "library",
"module": "core/tests/webdriverio/libraryFlow.js"
},
{
"name": "navigation",
"module": "core/tests/webdriverio_desktop/navigation.js"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('Exploration Editor', function () {
'Enter a negative number greater than -100.'
);
await explorationEditor.addInteraction(INTERACTION_TYPES.NUMERIC_INPUT);
await explorationEditor.addResponseToTheInteraction(
await explorationEditor.addResponsesToTheInteraction(
INTERACTION_TYPES.NUMERIC_INPUT,
'-99',
'Prefect!',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ describe('Exploration Editor', function () {
'0',
'101',
]);
await explorationEditor.addResponseToTheInteraction(
await explorationEditor.addResponsesToTheInteraction(
INTERACTION_TYPES.MULTIPLE_CHOICE,
'-99',
'Perfect!',
Expand All @@ -121,7 +121,7 @@ describe('Exploration Editor', function () {
'What is the sign to represent negative numbers called?'
);
await explorationEditor.addTextInputInteraction();
await explorationEditor.addResponseToTheInteraction(
await explorationEditor.addResponsesToTheInteraction(
INTERACTION_TYPES.TEXT_INPUT,
'minus',
'Correct!',
Expand Down Expand Up @@ -186,6 +186,7 @@ describe('Exploration Editor', function () {
await curriculumAdmin.createAndPublishStoryWithChapter(
'Test Story 1',
'test-story-one',
'Test Chapter 1',
explorationId,
'Test Topic 1'
);
Expand Down
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();
});
});
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();
});
});
Loading

0 comments on commit 0aaa41e

Please sign in to comment.