Merge pull request #4050 from NoelDeMartin/MOBILE-4470

MOBILE-4470: QA Fixes
main
Dani Palou 2024-05-16 12:04:14 +02:00 committed by GitHub
commit c39e75f894
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 50 additions and 6 deletions

View File

@ -12,9 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import { Component, ViewChild } from '@angular/core';
import { AfterViewInit, Component, ViewChild } from '@angular/core';
import { CoreCourseModuleMainActivityPage } from '@features/course/classes/main-activity-page';
import { AddonModAssignIndexComponent } from '../../components/index/index';
import { CoreNavigator } from '@services/navigator';
import { CoreUtils } from '@services/utils/utils';
/**
* Page that displays an assign.
@ -23,8 +25,30 @@ import { AddonModAssignIndexComponent } from '../../components/index/index';
selector: 'page-addon-mod-assign-index',
templateUrl: 'index.html',
})
export class AddonModAssignIndexPage extends CoreCourseModuleMainActivityPage<AddonModAssignIndexComponent> {
export class AddonModAssignIndexPage extends CoreCourseModuleMainActivityPage<AddonModAssignIndexComponent>
implements AfterViewInit {
private action?: string;
@ViewChild(AddonModAssignIndexComponent) activityComponent?: AddonModAssignIndexComponent;
constructor() {
super();
this.action = CoreNavigator.getRouteParam('action');
}
/**
* @inheritdoc
*/
async ngAfterViewInit(): Promise<void> {
switch (this.action) {
case 'editsubmission':
await CoreUtils.waitFor(() => !!this.activityComponent?.submissionComponent, { timeout: 5000 });
await this.activityComponent?.submissionComponent?.goToEdit();
break;
}
}
}

View File

@ -14,6 +14,7 @@
import { Injectable } from '@angular/core';
import { CoreContentLinksModuleIndexHandler } from '@features/contentlinks/classes/module-index-handler';
import { CoreNavigationOptions } from '@services/navigator';
import { makeSingleton } from '@singletons';
/**
@ -28,5 +29,16 @@ export class AddonModAssignIndexLinkHandlerService extends CoreContentLinksModul
super('AddonModAssign', 'assign');
}
/**
* @inheritdoc
*/
getModNavOptions(url: string, params: Record<string, string>): CoreNavigationOptions {
if (!params.action) {
return {};
}
return { params: { action: params.action } };
}
}
export const AddonModAssignIndexLinkHandler = makeSingleton(AddonModAssignIndexLinkHandlerService);

View File

@ -21,6 +21,7 @@ import { CorePromisedValue } from '@classes/promised-value';
import { IonContent } from '@ionic/angular';
import { CoreDomUtils, VerticalPoint } from '@services/utils/dom';
import { CoreUtils } from '@services/utils/utils';
import { NgZone } from '@singletons';
import { CoreDom } from '@singletons/dom';
import { CoreEventObserver } from '@singletons/events';
import { CoreMath } from '@singletons/math';
@ -62,8 +63,8 @@ export class CoreSwipeSlidesComponent<Item = unknown> implements OnChanges, OnDe
this.swiper.slideTo(this.options.initialSlide, 0, this.options.runCallbacksOnInit);
}
this.swiper.on('slideChangeTransitionStart', () => this.slideWillChange());
this.swiper.on('slideChangeTransitionEnd', () => this.slideDidChange());
this.swiper.on('slideChangeTransitionStart', () => NgZone.run(() => this.slideWillChange()));
this.swiper.on('slideChangeTransitionEnd', () => NgZone.run(() => this.slideDidChange()));
});
}

View File

@ -119,14 +119,21 @@ Feature: Test basic usage of courses in app
Scenario: Links to actions in Timeline work for teachers/students
# Submit assignment as student
Given I entered the app as "student1"
When I press "Add submission" in the app
When I press "assignment" in the app
Then the header should be "assignment" in the app
And I should find "Test assignment description" in the app
And I should find "No attempt" in the app
And I should find "Due:" in the app
When I press "Add submission" in the app
And I set the field "Online text submissions" to "test" in the app
Then I should find "Online text submissions" in the app
When I press the back button in the app
And I press the back button in the app
And I press "Add submission" in the app
Then I should find "Online text submissions" in the app
When I set the field "Online text submissions" to "test" in the app
And I press "Save" in the app
And I press "Submit assignment" in the app
And I press "OK" in the app