Skip to content
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 9). #19780

Merged
merged 243 commits into from
Apr 22, 2024

Conversation

rahat2134
Copy link
Contributor

@rahat2134 rahat2134 commented Feb 20, 2024

Overview

  1. This PR
    fixes part of Acceptance Testing - covering all the Creator's and Contributor's CUJs. #17712 .
  2. This PR does the following: Adds acceptance test for exploration editor section.
    Points:
    ( 9- User can do the Basic setting: Title, Goal, Add a category, Language, Name of the first card, Tags, Advance features, Roles, Voice artist, Permissions ……..
    10- User can Publish the latest changes, User can draft the latest changes)

Essential Checklist

  • The PR title starts with "Fix #bugnum: " or "Fix part of #bugnum: ...", followed by a short, clear summary of the changes.
  • I have followed the instructions for making a code change.
  • I have assigned the correct reviewers to this PR (or will leave a comment with the phrase "@{{reviewer_username}} PTAL" if I don't have permissions to assign reviewers directly).
  • The linter/Karma presubmit checks pass on my local machine, and my PR follows the coding style guide).
  • "Allow edits from maintainers" is checked. (See here for instructions on how to enable it.)

Proof that changes are correct

image
image
image

PR Pointers

Copy link

oppiabot bot commented Feb 20, 2024

Hi @rahat2134 please assign the required reviewer(s) for this PR. Thanks!

Copy link
Member

@seanlip seanlip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @rahat2134. The "top-level" of the tests needs some work so I've focused on that in this review, PTAL.

@@ -2,7 +2,7 @@
<div class="d-flex flex-column-reverse">
<span class="oppia-cke-offline-warning" *ngIf="!connectedToInternet">* Tools with dark background can not be used when offline.</span>
</div>
<div contenteditable="true" class="oppia-rte-resizer oppia-rte e2e-test-rte" #oppiaRTE></div>
<div contenteditable="true" class="oppia-rte-resizer oppia-rte e2e-test-rte" id="oppia-exploration-introd-box-input" #oppiaRTE></div>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't use IDs. See existing tests which use classes. We try not to use IDs because IDs are supposed to be unique within the page and it's hard to guarantee that (especially when the page is made up of multiple components).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seanlip I have resolved this issue. No id used. ✅

* @param {string} username - The username of the exploration creator.
* @returns {e2eExplorationCreator} - The instance of the exploration creator.
*/
let createExplorationCreator = async function(username) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow the existing pattern set by other function names in this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seanlip its also changed to createNewExplorationCreator() as per pattern.✅

superAdmin = await userFactory.createNewSuperAdmin('Leader');
}, DEFAULT_SPEC_TIMEOUT);

it('should perform exploration creation and basic actions',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is too vague. Explain more clearly what the user is doing in this test. I can't tell by reading the test description.

Also I think you might need to split this into multiple tests, each testing a particular scenario. I notice that all of these tests are from the creator's point of view only and don't have adequate verification. Think through what is needed to verify these actions from a user perspective. For example, if you want to verify that the title has changed then there should be another actor (a lesson player) who views the exploration and confirms that the title there has changed as well. Or if you want to verify that the exploration is deleted then another actor (a lesson player) should go to that URL and find a 404. Similarly for the others.

You might want to try this with just one scenario first, get that reviewed and merged, then tackle the other scenarios.

Copy link
Contributor Author

@rahat2134 rahat2134 Feb 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seanlip PTAL.

1)split this into multiple tests - ✅
2)If we want to verify whether the title has changed or any other aspect of the exploration from the user's perspective, the exploration creator needs to publish the exploration. This is because a private exploration will not be visible to a guest user. To publish the exploration, we need to fill in all the required fields such as title, goal, language, category, etc. Only after filling in all these details, we can publish the exploration and verify it. However, this approach of checking/verifying after all step is not efficient. Rather, it would be better to use the exploration creator and check the exploration at each step. For other aspects of the exploration, we can check them after publishing from user perspective.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable, feel free to structure the test so that it is reasonably efficient from a "flow" perspective.

However, I think creators might be able to view the /explore/... page for their own private explorations (not 100% sure about this though). If so, then maybe that might help simplify things.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, correct they are able to view. That's what i am trying to use in tests also. Thanks.


await explorationCreator.createExploration();
await explorationCreator.goToBasicSettingsTab();
await explorationCreator.expectTitleToHaveMaxLength(36);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not something the exploration creator "expects" -- write these actions from the perspective of a user.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seanlip i think this is now resolved .

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it's resolved. If I understand Sean correctly, the creator doesn't only expect the length to be below 36, they expect the title to be equal to "Your Title here".

Copy link
Contributor Author

@rahat2134 rahat2134 Feb 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seanlip its also answered, as it was mentioned in doc to check only for title to be below 36 so..
Uploading Screenshot 2024-02-29 at 1.14.30 AM.png…

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This acceptance test must be written from the perspective of an end user. An end user will not go to the exploration editor, update the title, and expect it to have a length of less than 36. They might expect a specific warning to be shown. Or they might expect that, if they try to enter a title that has > 36 chars, it shows an error (or if they enter characters past a certain length, it shows the truncated title only). And so on.

Your test should be written so that it reads similar to end user actions, as described above. If the spreadsheet does not match this then the spreadsheet needs modification and you might want to request clarification for those cases.

Also the link in your last comment doesn't load for me FYI.

'explorationAdm', 'voiceover admin');

await explorationCreator.createExploration();
await explorationCreator.goToBasicSettingsTab();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only have a settings tab, not a "basic settings" tab.

Copy link
Contributor Author

@rahat2134 rahat2134 Feb 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved by new commits ✅

await explorationCreator.makeExplorationPublic();
await explorationCreator.expectExplorationAccessibility();
await explorationCreator.voiceArtistAdded();
await explorationCreator.expectVoiceArtistToBeAdded();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which voice artist? I would expect this to be parameterized.

Copy link
Contributor Author

@rahat2134 rahat2134 Feb 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I will parameterize all the needed functions. I had hard-coded the person as 'guestUsr3' in the utils.js file. If it needs to be parameterized, I will rectify it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, in general your utility functions should be general things that do the desired action (and the internals of the function should not make assumptions about data on the server, which users there are, etc. -- those things would need to be parameterized).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seanlip its also resolved as now i have parameterised all the required functions->
Screenshot 2024-02-29 at 1 01 30 AM
Screenshot 2024-02-29 at 1 01 42 AM
Screenshot 2024-02-29 at 1 02 03 AM
etc.

await explorationCreator.expectExplorationAccessibility();
await explorationCreator.voiceArtistAdded();
await explorationCreator.expectVoiceArtistToBeAdded();
await explorationCreator.selectVoiceArtist();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't know what this means from PM perspective.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seanlip it need to be deleted, so its deleted. Main steps include -> add voice artists.

await explorationCreator.expectVoiceArtistToBeAdded();
await explorationCreator.selectVoiceArtist();
await explorationCreator.chooseToRecieveNotification();
await explorationCreator.expectFeedbackNotificationChoice();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally, any expect() methods should have a parameter with the expected outcome (unless the expected outcome is obvious from the name of the method, like expectExplorationToBeDeleted).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will keep this in mind.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seanlip its also resolved in above comments.


it('should perform exploration management actions',
async function() {
await explorationCreator.createExploration();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may need to separate these.

Think very carefully about how you would verify the outcomes of these actions, too. Don't just simply have the actions be executed. You will probably want multiple separate tests, with each test testing a flow in detail.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seanlip It is now resolved. I have separated it and made it more readable.
Screenshot 2024-02-29 at 1 05 46 AM

@rahat2134
Copy link
Contributor Author

Thanks @rahat2134. The "top-level" of the tests needs some work so I've focused on that in this review, PTAL.

Hmm, most of the changes required the naming convention. Will keep this in mind and try to solve this and utils.js file also in next commit.
Thank You.

Copy link

oppiabot bot commented Feb 25, 2024

Hi @rahat2134. Due to recent changes in the "develop" branch, this PR now has a merge conflict. Please follow this link if you need help resolving the conflict, so that the PR can be merged. Thanks!

1 similar comment
Copy link

oppiabot bot commented Feb 25, 2024

Hi @rahat2134. Due to recent changes in the "develop" branch, this PR now has a merge conflict. Please follow this link if you need help resolving the conflict, so that the PR can be merged. Thanks!

Copy link
Member

@seanlip seanlip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @rahat2134. One small thing, otherwise basically LGTM!

@@ -188,6 +188,9 @@ export class BaseUser {
*/
async clearAllTextFrom(selector: string): Promise<void> {
await this.waitForElementToBeClickable(selector);
/**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For inline comments, use this format:

// Clicking three times ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@seanlip seanlip assigned rahat2134 and unassigned seanlip Apr 20, 2024
@seanlip seanlip enabled auto-merge April 20, 2024 13:50
@seanlip seanlip disabled auto-merge April 20, 2024 13:50
@seanlip
Copy link
Member

seanlip commented Apr 20, 2024

(I think you can get this merged once @StephenYu2018 approves, too. Well done!)

Copy link

oppiabot bot commented Apr 20, 2024

Assigning @U8NWXD for code owner reviews. Thanks!

@rahat2134
Copy link
Contributor Author

rahat2134 commented Apr 20, 2024

@StephenYu2018 PTAL. Addressed all the changes. If you feel satisfied please add this to the merge queue. Thanks

Copy link

oppiabot bot commented Apr 20, 2024

Hi @rahat2134. Due to recent changes in the "develop" branch, this PR now has a merge conflict. Please follow this link if you need help resolving the conflict, so that the PR can be merged. Thanks!

@U8NWXD U8NWXD removed their assignment Apr 21, 2024
Copy link
Member

@StephenYu2018 StephenYu2018 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! :)

Copy link

oppiabot bot commented Apr 22, 2024

Unassigning @StephenYu2018 since they have already approved the PR.

@oppiabot oppiabot bot added the PR: LGTM label Apr 22, 2024
Copy link

oppiabot bot commented Apr 22, 2024

Hi @rahat2134, this PR is ready to be merged. Please address any remaining comments prior to merging, and feel free to ask someone to merge your PR once the CI checks pass and you're happy with it. Thanks!

@rahat2134
Copy link
Contributor Author

@seanlip Please add this to the merge queue if no further review is required. Thanks.

@seanlip seanlip added this pull request to the merge queue Apr 22, 2024
Merged via the queue into oppia:develop with commit 5abffd3 Apr 22, 2024
80 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants