Skip to content

Commit

Permalink
Fix oppia#20958: Waiting for element to appear before checking for it…
Browse files Browse the repository at this point in the history
…s existance (oppia#21186)

* now the test waits for the review button to appear

* fixed linting issue
  • Loading branch information
masterboy376 authored Oct 29, 2024
1 parent f0255f6 commit 996739e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
</div>
</div>
<div class="oppia-contributions-show-review-side-navbar-container" >
<div class="oppia-contributions-side-navbar-part" *ngIf="reviewTabs.length > 0" tabindex="0">
<div class="oppia-contributions-side-navbar-part e2e-test-available-task-label" *ngIf="reviewTabs.length > 0" tabindex="0">
<div class="oppia-contributions-navbar-items-list" navbar-label="Available Tasks" aria-label="Available tasks">
<div class="oppia-contributions-navbar-item e2e-test-review-buttons" *ngFor="let tab of reviewTabs">
<button class="oppia-contributions-navbar-button"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ describe('Contributor Admin Dashboard', function () {
// Accept suggestion as user1.
await users.login(USER_EMAILS[1]);
await contributorDashboardPage.get();
await contributorDashboardPage.waitForAvailableTaskLabelToAppear();
await contributorDashboardPage.selectTranslationReviewButton();
await contributorDashboardPage.waitForOpportunitiesToLoad();
await contributorDashboardPage.selectReviewLanguage('shqip (Albanian)');
Expand Down
8 changes: 8 additions & 0 deletions core/tests/webdriverio_utils/ContributorDashboardPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ var ContributorDashboardPage = function () {
var navigateToTranslateTextTabButton = $('.e2e-test-translateTextTab');
var submitQuestionTabButton = $('.e2e-test-submitQuestionTab');
var myContributionTabButton = $('.e2e-test-myContributionTab');
var availableTaskLabel = $('.e2e-test-available-task-label');
var opportunityLoadingPlaceholder = $(
'.e2e-test-opportunity-loading-placeholder'
);
Expand Down Expand Up @@ -341,6 +342,13 @@ var ContributorDashboardPage = function () {
await this.waitForOpportunitiesToLoad();
};

this.waitForAvailableTaskLabelToAppear = async function () {
await waitFor.visibilityOf(
availableTaskLabel,
'Opportunity taking too long to appear.'
);
};

this.selectTranslationReviewButton = async function () {
var reviewButtons = await reviewButtonsSelector();
await action.click('Translation Review Button', reviewButtons[1]);
Expand Down

0 comments on commit 996739e

Please sign in to comment.