Fix school browser initialization and redirect detection; improve diagnostics
This commit is contained in:
@@ -31,6 +31,48 @@ void main() {
|
||||
session = UndergraduateSession();
|
||||
});
|
||||
tearDown(() => session.dispose());
|
||||
test(
|
||||
'page-finished during an old probe is retried on the redirected portal',
|
||||
() async {
|
||||
await session.openTimetable();
|
||||
var first = true;
|
||||
platform.web.javascript = (_) async {
|
||||
if (first) {
|
||||
first = false;
|
||||
platform.web.url = 'https://eams.uestc.edu.cn/eams/home.action';
|
||||
platform.delegate.finished(platform.web.url!);
|
||||
}
|
||||
return underEvidence(platform.web.url!);
|
||||
};
|
||||
platform.delegate.finished(platform.web.url!);
|
||||
await flushSchoolEvents();
|
||||
await Future<void>.delayed(const Duration(milliseconds: 600));
|
||||
await flushSchoolEvents();
|
||||
expect(session.statusLabel, '已连接');
|
||||
expect(session.busy, isFalse);
|
||||
},
|
||||
);
|
||||
test('a redirect between page callback and probe does not permanently stop login detection', () async {
|
||||
await session.openTimetable();
|
||||
var redirect = true;
|
||||
platform.web.javascript = (_) async {
|
||||
if (redirect) {
|
||||
redirect = false;
|
||||
platform.web.url = 'https://idas.uestc.edu.cn/authserver/login';
|
||||
return underEvidence(platform.web.url!, authenticated: false);
|
||||
}
|
||||
return underEvidence(platform.web.url!);
|
||||
};
|
||||
platform.delegate.finished(platform.web.url!);
|
||||
await flushSchoolEvents();
|
||||
expect(session.message, isNot(contains('未完成')));
|
||||
platform.delegate.finished(platform.web.url!);
|
||||
await flushSchoolEvents();
|
||||
platform.web.url = 'https://eams.uestc.edu.cn/eams/';
|
||||
platform.delegate.finished(platform.web.url!);
|
||||
await flushSchoolEvents();
|
||||
expect(session.statusLabel, '已连接');
|
||||
});
|
||||
test(
|
||||
'activating a loading browser never probes the previous blank document',
|
||||
() async {
|
||||
|
||||
Reference in New Issue
Block a user