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] M1.3 and M1.6: Add acceptance test for curriculum admin and…
… logged-out user CUJ (oppia#20584) * Fix part of oppia#19849: Add acceptance test for classroom admin and classrooms * fix test * fix test * minor fixes * add topic with name * remove extra module * remove duplicate e2e test * add test for M1.6 * fix test * fix test * fix mapping * fix test * fix linter * fix test * fix mapping * fix linter * remove 2 test case * fix linter * remove unused code * fix classroom test * fix goto
- Loading branch information
Showing
22 changed files
with
528 additions
and
152 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
2 changes: 1 addition & 1 deletion
2
core/templates/pages/classroom-admin-page/modals/create-new-classroom-modal.component.html
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
4 changes: 2 additions & 2 deletions
4
...templates/pages/classroom-admin-page/modals/delete-classroom-confirm-modal.component.html
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,9 +1,9 @@ | ||
<div class="modal-header"> | ||
<div class="modal-header e2e-test-delete-classroom-modal"> | ||
<h3>Are you sure to delete the classroom?</h3> | ||
</div> | ||
<div class="modal-footer"> | ||
<button class="btn btn-secondary" (click)="cancel()">Cancel</button> | ||
<button class="btn btn-danger" (click)="close()"> | ||
<button class="btn btn-danger e2e-test-confirm-delete-classroom" (click)="close()"> | ||
<span>Delete Classroom</span> | ||
</button> | ||
</div> |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
98 changes: 98 additions & 0 deletions
98
...uppeteer-acceptance-tests/specs/curriculum-admin/create-edit-and-delete-classroom.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,98 @@ | ||
// 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 Creating, Updating, Publishing, and Deleting a Classroom by a Curriculum Admin. | ||
*/ | ||
|
||
import {UserFactory} from '../../utilities/common/user-factory'; | ||
import testConstants from '../../utilities/common/test-constants'; | ||
import {CurriculumAdmin} from '../../utilities/user/curriculum-admin'; | ||
import {LoggedOutUser} from '../../utilities/user/logged-out-user'; | ||
import {ConsoleReporter} from '../../utilities/common/console-reporter'; | ||
|
||
const DEFAULT_SPEC_TIMEOUT_MSECS = testConstants.DEFAULT_SPEC_TIMEOUT_MSECS; | ||
const ROLES = testConstants.Roles; | ||
|
||
ConsoleReporter.setConsoleErrorsToIgnore([/[\s\S]*/]); | ||
|
||
describe('Curriculum Admin', function () { | ||
let curriculumAdmin: CurriculumAdmin; | ||
let loggedOutUser: LoggedOutUser; | ||
|
||
beforeAll(async function () { | ||
curriculumAdmin = await UserFactory.createNewUser( | ||
'curriculumAdm', | ||
'[email protected]', | ||
[ROLES.CURRICULUM_ADMIN] | ||
); | ||
|
||
loggedOutUser = await UserFactory.createLoggedOutUser(); | ||
|
||
await curriculumAdmin.navigateToTopicAndSkillsDashboardPage(); | ||
await curriculumAdmin.createTopic('Test Topic 1', 'test-topic-one'); | ||
await curriculumAdmin.createSubtopicForTopic( | ||
'Test Subtopic 1', | ||
'test-subtopic-one', | ||
'Test Topic 1' | ||
); | ||
|
||
await curriculumAdmin.createSkillForTopic('Test Skill 1', 'Test Topic 1'); | ||
await curriculumAdmin.createQuestionsForSkill('Test Skill 1', 3); | ||
await curriculumAdmin.assignSkillToSubtopicInTopicEditor( | ||
'Test Skill 1', | ||
'Test Subtopic 1', | ||
'Test Topic 1' | ||
); | ||
await curriculumAdmin.addSkillToDiagnosticTest( | ||
'Test Skill 1', | ||
'Test Topic 1' | ||
); | ||
|
||
await curriculumAdmin.publishDraftTopic('Test Topic 1'); | ||
}, DEFAULT_SPEC_TIMEOUT_MSECS); | ||
|
||
it( | ||
'should create, publish and delete a classroom.', | ||
async function () { | ||
await curriculumAdmin.expectNumberOfClassroomsToBe(0); | ||
await curriculumAdmin.createNewClassroom('Math', 'math'); | ||
await curriculumAdmin.expectNumberOfClassroomsToBe(1); | ||
await curriculumAdmin.updateClassroom( | ||
'Math', | ||
'Teaser text', | ||
'Course details', | ||
'Topic list intro' | ||
); | ||
await curriculumAdmin.addTopicToClassroom('Math', 'Test Topic 1'); | ||
await curriculumAdmin.publishClassroom('Math'); | ||
await curriculumAdmin.expectNumberOfTopicsInTopicDependencyGraphToBe( | ||
'Math', | ||
1 | ||
); | ||
|
||
await loggedOutUser.navigateToClassroomPage('math'); | ||
await loggedOutUser.expectToBeOnClassroomPage('Math'); | ||
|
||
await curriculumAdmin.deleteClassroom('Math'); | ||
await curriculumAdmin.expectNumberOfClassroomsToBe(0); | ||
}, | ||
|
||
DEFAULT_SPEC_TIMEOUT_MSECS | ||
); | ||
|
||
afterAll(async function () { | ||
await UserFactory.closeAllBrowsers(); | ||
}); | ||
}); |
53 changes: 53 additions & 0 deletions
53
...tests/puppeteer-acceptance-tests/specs/logged-out-user/visit-classroom-index-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,53 @@ | ||
// 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 checking the behavior of the classroom index page | ||
* for 0 classrooms, 1 classroom, and more than 1 classroom. | ||
*/ | ||
|
||
import {UserFactory} from '../../utilities/common/user-factory'; | ||
import testConstants from '../../utilities/common/test-constants'; | ||
import {LoggedOutUser} from '../../utilities/user/logged-out-user'; | ||
import {ConsoleReporter} from '../../utilities/common/console-reporter'; | ||
|
||
const DEFAULT_SPEC_TIMEOUT_MSECS = testConstants.DEFAULT_SPEC_TIMEOUT_MSECS; | ||
|
||
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; | ||
|
||
beforeAll(async function () { | ||
loggedOutUser = await UserFactory.createLoggedOutUser(); | ||
}, DEFAULT_SPEC_TIMEOUT_MSECS); | ||
|
||
it( | ||
'should be redirected to a 404 error page if no classrooms are present.', | ||
async function () { | ||
await loggedOutUser.navigateToClassroomsPage(); | ||
await loggedOutUser.expectToBeOnErrorPage(404); | ||
}, | ||
DEFAULT_SPEC_TIMEOUT_MSECS | ||
); | ||
|
||
// TODO (#20610): Add test for one and more than one classroom. | ||
// Once issue with relase coordinator user is fixed. | ||
|
||
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
Oops, something went wrong.