Skip to content

Commit

Permalink
[GSoC'24] Run exploration translations acceptance test in CI (oppia#2…
Browse files Browse the repository at this point in the history
…0835)

* Fix acceptance test

* Revert accidental commit

* Add acceptance test to run in CI

* Remove timeout

* Fix test

* Update

* Update

* Test

* Update

* Test

* Fix
  • Loading branch information
Vir-8 authored Aug 23, 2024
1 parent 65ccf89 commit 32e3e50
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ <h4 class="modal-title">Modify Existing Translations</h4>
<i class="fas fa-pencil-alt e2e-test-{{ item.key }}-translation-edit" (click)="openTranslationEditor(item.key)"></i>
</div>
<div class="content-translation-value e2e-test-translation-{{ item.key }}">
<oppia-rte-output-display *ngIf="activeDataFormat === 'html' || activeDataFormat === 'unicode'"
<oppia-rte-output-display *ngIf="item.value.dataFormat === 'html' || item.value.dataFormat === 'unicode'"
[rteString]="item.value.translation"
class="translations-rte-output-display">
</oppia-rte-output-display>
Expand Down
4 changes: 4 additions & 0 deletions core/tests/ci-test-suite-configs/acceptance.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
"name": "exploration-editor/create-exploration-and-change-basic-settings",
"module": "core/tests/puppeteer-acceptance-tests/specs/exploration-editor/create-exploration-and-change-basic-settings.spec.ts"
},
{
"name": "exploration-editor/modify-translations-through-modal",
"module": "core/tests/puppeteer-acceptance-tests/specs/exploration-editor/modify-translations-through-modal.spec.ts"
},
{
"name": "exploration-editor/publish-the-exploration-with-an-interaction",
"module": "core/tests/puppeteer-acceptance-tests/specs/exploration-editor/publish-the-exploration-with-an-interaction.spec.ts"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ describe('Exploration Editor', function () {
await explorationEditor.editDefaultResponseFeedback('Wrong.');
await explorationEditor.addSolutionToState(
'minus',
'Minus is the opposite of plus.'
'Minus is the opposite of plus.',
false
);
await explorationEditor.saveExplorationDraft();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ describe('Logged-out User', function () {
);
await explorationEditor.addSolutionToState(
'-99',
'The number -99 is a negative number.'
'The number -99 is a negative number.',
true
);
await explorationEditor.saveExplorationDraft();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const uploadImageButton = '.e2e-test-upload-image';
const useTheUploadImageButton = '.e2e-test-use-image';
const imageRegionSelector = '.e2e-test-svg';
const correctAnswerInTheGroupSelector = '.e2e-test-editor-correctness-toggle';
const addNewResponseButton = '.e2e-test-add-new-response';
const addNewResponseButton = 'button.e2e-test-add-new-response';
const floatFormInput = '.e2e-test-float-form-input';
const modifyExistingTranslationsButton = '.e2e-test-modify-translations-button';
const activeTranslationTab = '.e2e-test-active-translation-tab';
Expand All @@ -115,7 +115,9 @@ const saveOutcomeFeedbackButton = 'button.e2e-test-save-outcome-feedback';
const addHintButton = 'button.e2e-test-oppia-add-hint-button';
const saveHintButton = 'button.e2e-test-save-hint';
const addSolutionButton = 'button.e2e-test-oppia-add-solution-button';
const solutionInput = 'oppia-add-or-update-solution-modal input';
const solutionInputNumeric = 'oppia-add-or-update-solution-modal input';
const solutionInputTextArea =
'oppia-add-or-update-solution-modal textarea.e2e-test-description-box';
const submitSolutionButton = 'button.e2e-test-submit-solution-button';

const dismissTranslationWelcomeModalSelector =
Expand Down Expand Up @@ -454,6 +456,10 @@ export class ExplorationEditor extends BaseUser {
});
await this.clickOn(textInputInteractionButton);
await this.clickOn(saveInteractionButton);
await this.page.waitForSelector(addInteractionModalSelector, {
hidden: true,
});
showMessage('Text input interaction has been added successfully.');
}

/**
Expand Down Expand Up @@ -1066,10 +1072,17 @@ export class ExplorationEditor extends BaseUser {
await this.clickOn(correctAnswerInTheGroupSelector);
}
if (isLastResponse) {
await this.clickOn(addNewResponseButton);
await this.page.waitForSelector(responseModalHeaderSelector, {
hidden: true,
await this.page.waitForSelector(addNewResponseButton, {
visible: true,
});
await this.clickOn(addNewResponseButton);
await this.page
.waitForSelector(responseModalHeaderSelector, {
hidden: true,
})
.catch(async () => {
await this.clickOn(addNewResponseButton);
});
} else {
await this.clickOn(addAnotherResponseButton);
}
Expand Down Expand Up @@ -1114,14 +1127,19 @@ export class ExplorationEditor extends BaseUser {
* Function to add a solution for a state interaction.
* @param {string} answer - The solution of the current state card.
* @param {string} answerExplanation - The explanation for this state card's solution.
* @param {boolean} isSolutionNumericInput - Whether the solution is for a numeric input interaction.
*/
async addSolutionToState(
answer: string,
answerExplanation: string
answerExplanation: string,
isSolutionNumericInput: boolean
): Promise<void> {
const solutionSelector = isSolutionNumericInput
? solutionInputNumeric
: solutionInputTextArea;
await this.clickOn(addSolutionButton);
await this.page.waitForSelector(solutionInput, {visible: true});
await this.type(solutionInput, answer);
await this.page.waitForSelector(solutionSelector, {visible: true});
await this.type(solutionSelector, answer);
await this.page.waitForSelector(`${submitAnswerButton}:not([disabled])`);
await this.clickOn(submitAnswerButton);
await this.type(stateContentInputField, answerExplanation);
Expand Down
1 change: 0 additions & 1 deletion core/tests/root-files-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
"core/templates/AppSpec.ts",
"core/templates/domain/skill/MisconceptionObjectFactorySpec.ts",
"core/templates/domain/exploration/AnswerGroupObjectFactorySpec.ts",
"core/tests/puppeteer-acceptance-tests/specs/exploration-editor/modify-translations-through-modal.spec.ts",
"core/tests/puppeteer-acceptance-tests/specs/exploration-editor/manage-exploration-misconceptions.spec.ts"
],
"RUN_ALL_TESTS_ROOT_FILES": [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
core/templates/pages/creator-dashboard-page/creator-dashboard-page.import.ts
core/templates/pages/exploration-editor-page/exploration-editor-page.import.ts
core/templates/pages/release-coordinator-page/release-coordinator-page.module.ts
core/templates/pages/skill-editor-page/skill-editor-page.import.ts
core/templates/pages/story-editor-page/story-editor-page.import.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
1 change: 0 additions & 1 deletion scripts/check_tests_are_captured_in_ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

E2E_TEST_SUITES_THAT_ARE_NOT_RUN_IN_CI = ['full']
ACCEPTANCE_TEST_SUITES_THAT_ARE_NOT_RUN_IN_CI = [
'exploration-editor/modify-translations-through-modal',
'exploration-editor/manage-exploration-misconceptions'
]

Expand Down

0 comments on commit 32e3e50

Please sign in to comment.