-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement part of #17712 : Acceptance tests for Exploration Creator Section(CUJ 10). #20203
Changes from 22 commits
60e18a2
35fd534
8acdeb1
e892a74
dc9bdf8
940a919
d129dd7
5679fba
1694b1f
6646a83
87e718a
db62083
7e27a5e
41993cc
ee7a5ac
cc09bd6
5a4b699
b3336ca
92c6bda
6cb4377
96055da
2b0696b
2f3ce5c
33cd472
563badb
2342c99
86f6696
c03be55
ae0dca2
ee3eab4
dbf8ad9
c9b86e2
4b0771d
e99c3a0
421ef21
94d8192
fc23f6d
30809ea
0af42ef
292ab19
09a9265
5a0d3be
b56a41b
50de4ff
3975bc9
82d976a
450220e
ddb3ee7
c01317e
fec2046
a07dd38
e77d313
77c3504
7c5634e
0d20eb7
39dad78
d1117a6
901149e
cf492ed
93da30b
2781f9b
e9986b9
a36bb00
399d31f
98b2932
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ | |
// limitations under the License. | ||
|
||
/** | ||
* @fileoverview Acceptance Test for Exploration Creator and Exploration Manager | ||
* @fileoverview Acceptance Test for settings tab in exploration editor. | ||
*/ | ||
|
||
import {ConsoleReporter} from '../../puppeteer-testing-utilities/console-reporter'; | ||
|
@@ -22,6 +22,7 @@ import testConstants from '../../puppeteer-testing-utilities/test-constants'; | |
import {UserFactory} from '../../puppeteer-testing-utilities/user-factory'; | ||
import {CurriculumAdmin} from '../../user-utilities/curriculum-admin-utils'; | ||
import {ExplorationEditor} from '../../user-utilities/exploration-editor-utils'; | ||
import {LoggedInUser} from '../../user-utilities/logged-in-users-utils'; | ||
import {VoiceoverAdmin} from '../../user-utilities/voiceover-admin-utils'; | ||
|
||
const DEFAULT_SPEC_TIMEOUT_MSECS = testConstants.DEFAULT_SPEC_TIMEOUT_MSECS; | ||
|
@@ -38,54 +39,62 @@ ConsoleReporter.setConsoleErrorsToIgnore([ | |
/Error: Could not find the resource http:\/\/localhost:8181\/explorehandler\/features\/[a-zA-Z0-9]+\.?/, | ||
/Could not find the resource http:\/\/localhost:8181\/createhandler\/permissions\/[a-zA-Z0-9]+\.?/, | ||
/http:\/\/localhost:8181\/build\/webpack_bundles\/exploration_editor\.[a-f0-9]+\.bundle\.js/, | ||
/http:\/\/localhost:8181\/create\/[a-zA-Z0-9]+#\/gui\/Introduction Failed to load resource: the server responded with a status of 404 \(Not Found\)/, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If these errors are unexpected, these should be linked to issues, and we should drop the statement here when the issue is fixed. In any case a comment should be left to explain the context of each error and the reason we exclude it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually I have already added a statement before all these errors. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, I think that's a problem. Each console error should have its own comment (because otherwise, if we add new console errors and functionality in future, the comment won't apply to it). Secondly, only a single 404 console error should arise in cases like this, so it's probably worth filing a bug to fix that -- we shouldn't even get to the point of loading the rest of the page once the initial 404 is received. |
||
]); | ||
|
||
describe('Exploration Creator', function () { | ||
let explorationEditor: ExplorationEditor; | ||
let voiceoverAdmin: VoiceoverAdmin; | ||
let curriculumAdmin: CurriculumAdmin; | ||
let explorationVisitor: LoggedInUser; | ||
let explorationId: string | null; | ||
|
||
beforeAll(async function () { | ||
explorationEditor = await UserFactory.createNewUser( | ||
'explorationEditor', | ||
'exploration_editor@example.com' | ||
); | ||
showMessage('explorationEditor is signed up successfully.'); | ||
showMessage('explorationEditor has signed up successfully.'); | ||
|
||
explorationVisitor = await UserFactory.createNewUser( | ||
'explorationVisitor', | ||
'exploration_visitor@example.com' | ||
); | ||
showMessage('explorationVisitor has signed up successfully.'); | ||
|
||
voiceoverAdmin = await UserFactory.createNewUser( | ||
'voiceoverAdm', | ||
'voiceover_admin@example.com', | ||
[ROLES.VOICEOVER_ADMIN] | ||
); | ||
showMessage('Voiceover admin is signed up successfully.'); | ||
showMessage('Voiceover admin has signed up successfully.'); | ||
|
||
curriculumAdmin = await UserFactory.createNewUser( | ||
'curriculumAdm', | ||
'curriculum_admin@example.com', | ||
[ROLES.CURRICULUM_ADMIN] | ||
); | ||
showMessage('Curriculum admin is signed up successfully.'); | ||
showMessage('Curriculum admin has signed up successfully.'); | ||
|
||
const guestUser1 = await UserFactory.createNewUser( | ||
'guestUser1', | ||
'guest_user1@example.com' | ||
); | ||
showMessage('guestUser1 is signed up successfully.'); | ||
showMessage('guestUser1 has signed up successfully.'); | ||
await guestUser1.closeBrowser(); | ||
|
||
const guestUser2 = await UserFactory.createNewUser( | ||
'guestUser2', | ||
'guest_user2@example.com' | ||
); | ||
showMessage('guestUser2 is signed up successfully.'); | ||
showMessage('guestUser2 has signed up successfully.'); | ||
await guestUser2.closeBrowser(); | ||
|
||
const guestUser3 = await UserFactory.createNewUser( | ||
'guestUser3', | ||
'guest_user3@example.com' | ||
); | ||
showMessage('guestUser3 is signed up successfully.'); | ||
showMessage('guestUser3 has signed up successfully.'); | ||
await guestUser3.closeBrowser(); | ||
}, DEFAULT_SPEC_TIMEOUT_MSECS); | ||
|
||
|
@@ -98,7 +107,7 @@ describe('Exploration Creator', function () { | |
|
||
await explorationEditor.dismissWelcomeModal(); | ||
|
||
await explorationEditor.createExplorationWithMinimumContent( | ||
await explorationEditor.createMinimalExploration( | ||
'Exploration intro text', | ||
INTERACTION_TYPES.END_EXPLORATION | ||
); | ||
|
@@ -155,7 +164,7 @@ describe('Exploration Creator', function () { | |
await curriculumAdmin.openExplorationControlDropdown(); | ||
await curriculumAdmin.deleteExplorationPermanently(); | ||
|
||
await explorationEditor.expectExplorationToBeNotAccessibleByUrl( | ||
await explorationVisitor.expectExplorationToBeNotAccessibleByUrl( | ||
explorationId | ||
); | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
// 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 saving drafts, publishing, and discarding changes. | ||
*/ | ||
|
||
import {showMessage} from '../../puppeteer-testing-utilities/show-message-utils'; | ||
import testConstants from '../../puppeteer-testing-utilities/test-constants'; | ||
import {UserFactory} from '../../puppeteer-testing-utilities/user-factory'; | ||
import {ExplorationEditor} from '../../user-utilities/exploration-editor-utils'; | ||
import {LoggedInUser} from '../../user-utilities/logged-in-users-utils'; | ||
|
||
const DEFAULT_SPEC_TIMEOUT_MSECS = testConstants.DEFAULT_SPEC_TIMEOUT_MSECS; | ||
enum INTERACTION_TYPES { | ||
END_EXPLORATION = 'End Exploration', | ||
} | ||
|
||
describe('Exploration Creator', function () { | ||
let explorationEditor: ExplorationEditor; | ||
let explorationVisitor: LoggedInUser; | ||
let explorationId: string | null; | ||
|
||
beforeAll(async function () { | ||
explorationEditor = await UserFactory.createNewUser( | ||
'explorationEditor', | ||
'exploration_editor@example.com' | ||
); | ||
showMessage('explorationEditor has signed up successfully.'); | ||
|
||
explorationVisitor = await UserFactory.createNewUser( | ||
'explorationVisitor', | ||
'exploration_visitor@example.com' | ||
); | ||
showMessage('explorationVisitor has signed up successfully.'); | ||
}, DEFAULT_SPEC_TIMEOUT_MSECS); | ||
|
||
it( | ||
'should draft, discard and publish the changes', | ||
async function () { | ||
await explorationEditor.navigateToCreatorDashboardPage(); | ||
await explorationEditor.navigateToExplorationEditorPage(); | ||
await explorationEditor.dismissWelcomeModal(); | ||
|
||
await explorationEditor.createMinimalExploration( | ||
'Exploration intro text', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Considering that the function receives both content and interaction parameters and not just content, it might be more appropriate to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems reasonable. Thanks :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
INTERACTION_TYPES.END_EXPLORATION | ||
); | ||
|
||
await explorationEditor.saveExplorationDraft(); | ||
explorationId = await explorationEditor.publishExplorationWithMetadata( | ||
'Old Title', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, while publishing exploration, we don't really pass any content, what we pass is a title (if it's not already set in the settings tab), objective and category. so maybe we can use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Although the previous name was clear. But this is more specific. Thanks for suggestion :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
'This is the goal of exploration.', | ||
'Algebra' | ||
); | ||
|
||
await explorationVisitor.expectExplorationToBeAccessibleByUrl( | ||
explorationId | ||
); | ||
|
||
await explorationEditor.navigateToSettingsTab(); | ||
|
||
await explorationEditor.updateTitleTo('New Title'); | ||
await explorationEditor.discardCurrentChanges(); | ||
await explorationEditor.expectTitleToBe('Old Title'); | ||
|
||
await explorationEditor.updateTitleTo('New Title'); | ||
await explorationEditor.saveExplorationDraft(); | ||
await explorationEditor.expectTitleToBe('New Title'); | ||
}, | ||
DEFAULT_SPEC_TIMEOUT_MSECS | ||
); | ||
|
||
afterAll(async function () { | ||
await UserFactory.closeAllBrowsers(); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching this! :)