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.5: Add multiple classrooms acceptance test (oppia#20857)
* Add multiple classrooms acceptance test * fix module mapping * fix module mapping * add await * minor change * fix comment * fix title, description * fix title and description * fix test
- Loading branch information
Showing
4 changed files
with
94 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,19 +20,38 @@ | |
import {UserFactory} from '../../utilities/common/user-factory'; | ||
import testConstants from '../../utilities/common/test-constants'; | ||
import {LoggedOutUser} from '../../utilities/user/logged-out-user'; | ||
import {CurriculumAdmin} from '../../utilities/user/curriculum-admin'; | ||
import {ConsoleReporter} from '../../utilities/common/console-reporter'; | ||
import {ReleaseCoordinator} from '../../utilities/user/release-coordinator'; | ||
|
||
const DEFAULT_SPEC_TIMEOUT_MSECS = testConstants.DEFAULT_SPEC_TIMEOUT_MSECS; | ||
const ROLES = testConstants.Roles; | ||
|
||
ConsoleReporter.setConsoleErrorsToIgnore([ | ||
/http:\/\/localhost:8181\/access_validation_handler\/can_access_classrooms_page Failed to load resource: the server responded with a status of 404 \(Not Found\)/, | ||
]); | ||
|
||
describe('Logged-out User', function () { | ||
let loggedOutUser: LoggedOutUser; | ||
let curriculumAdmin: CurriculumAdmin; | ||
let releaseCoordinator: ReleaseCoordinator; | ||
|
||
beforeAll(async function () { | ||
loggedOutUser = await UserFactory.createLoggedOutUser(); | ||
curriculumAdmin = await UserFactory.createNewUser( | ||
'curriculumAdm', | ||
'[email protected]', | ||
[ROLES.CURRICULUM_ADMIN] | ||
); | ||
releaseCoordinator = await UserFactory.createNewUser( | ||
'releaseCoordinator', | ||
'[email protected]', | ||
[ROLES.RELEASE_COORDINATOR] | ||
); | ||
|
||
await releaseCoordinator.enableFeatureFlag('enable_multiple_classrooms'); | ||
await curriculumAdmin.createTopic('Test Topic 2', 'test-topic-two'); | ||
await curriculumAdmin.createTopic('Test Topic 1', 'test-topic-one'); | ||
}, DEFAULT_SPEC_TIMEOUT_MSECS); | ||
|
||
it( | ||
|
@@ -44,8 +63,45 @@ describe('Logged-out User', function () { | |
DEFAULT_SPEC_TIMEOUT_MSECS | ||
); | ||
|
||
// TODO (#20610): Add test for one and more than one classroom. | ||
// Once issue with relase coordinator user is fixed. | ||
it( | ||
'should be redirected to a classroom page if we have 1 public classroom.', | ||
async function () { | ||
await curriculumAdmin.navigateToTopicAndSkillsDashboardPage(); | ||
await curriculumAdmin.createNewClassroom('Math', 'math'); | ||
await curriculumAdmin.updateClassroom( | ||
'Math', | ||
'Welcome to Math classroom!', | ||
'This course covers basic algebra and trigonometry.', | ||
'In this course, you will learn the following topics: algbera and trigonometry,' | ||
); | ||
await curriculumAdmin.addTopicToClassroom('Math', 'Test Topic 1'); | ||
await curriculumAdmin.publishClassroom('Math'); | ||
|
||
await loggedOutUser.navigateToClassroomsPage(); | ||
await loggedOutUser.expectToBeOnClassroomPage('Math'); | ||
}, | ||
DEFAULT_SPEC_TIMEOUT_MSECS | ||
); | ||
|
||
it( | ||
'should show classrooms page with classroom cards.', | ||
async function () { | ||
await curriculumAdmin.navigateToTopicAndSkillsDashboardPage(); | ||
await curriculumAdmin.createNewClassroom('Science', 'science'); | ||
await curriculumAdmin.updateClassroom( | ||
'Science', | ||
'Welcome to Science classroom!', | ||
'This course covers basic physics and chemistry.', | ||
'In this course, you will learn the following topics: physics and chemistry,' | ||
); | ||
await curriculumAdmin.addTopicToClassroom('Science', 'Test Topic 2'); | ||
await curriculumAdmin.publishClassroom('Science'); | ||
|
||
await loggedOutUser.navigateToClassroomsPage(); | ||
await loggedOutUser.expectClassroomCountInClassroomsPageToBe(2); | ||
}, | ||
DEFAULT_SPEC_TIMEOUT_MSECS | ||
); | ||
|
||
afterAll(async function () { | ||
await UserFactory.closeAllBrowsers(); | ||
|
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
5 changes: 5 additions & 0 deletions
5
core/tests/test-modules-mappings/acceptance/logged-out-user/visit-classroom-index-page.txt
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 |
---|---|---|
@@ -1 +1,6 @@ | ||
core/templates/pages/classroom-admin-page/classroom-admin-page.module.ts | ||
core/templates/pages/classroom-page/classroom-page.module.ts | ||
core/templates/pages/classrooms-page/classrooms-page.module.ts | ||
core/templates/pages/release-coordinator-page/release-coordinator-page.module.ts | ||
core/templates/pages/topic-editor-page/topic-editor-page.import.ts | ||
core/templates/pages/topics-and-skills-dashboard-page/topics-and-skills-dashboard-page.import.ts |