flutter_flutter/lib/web_ui/test/engine/semantics/accessibility_test.dart
nturgut bb24b4938f
[web] Build unit tests with dart2js instead of build_runner (#20390)
* change from build_runner to dart2js

* add internalBootstrapBrowserTest to some of the tests

* add internalBootstrapBrowserTest to all remaining tests

* make tests build in paralel. Total time dropped from 586 to 177 seconds for 8 core MacBook

* change isolates with pool

* fixing analysis errors

* skipping canvaskit tests for ios-safari

* copy image files to the build directory

* adding internalBootstrapBrowserTest to newly added tests

* add internalBootstrapBrowserTest to faling path iterator test

* necessary changes to make chrome windows work

* in windows test in chrome instead of edge. our edge code was for legacy edge

* do not run golden unit tests on Windows LUCI bots for now

* addressing reviewer comments. Adding a method for deciding when to run integration tests.

* remove lines that I forgot to remove

* fixing analysis error. add issue for todo

* add bootstap to a test file

* adding bootstrap to another test

* add internalBootstrapBrowserTest to a golden test

* return test result in bat file. use archieve package to unzip

* fixing logs for chrome_installer

* use archieve and archieve entity instead of dynamic

* adding comments for windows platform archieve part

* addressing reviewer comments

* change readme file
2020-08-17 16:19:27 -07:00

60 lines
1.9 KiB
Dart

// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.6
import 'dart:async' show Future;
import 'dart:html';
import 'package:test/bootstrap/browser.dart';
import 'package:test/test.dart';
import 'package:ui/src/engine.dart';
const MessageCodec<dynamic> codec = StandardMessageCodec();
const String testMessage = 'This is an tooltip.';
const Map<dynamic, dynamic> testInput = <dynamic, dynamic>{
'data': <dynamic, dynamic>{'message': testMessage}
};
void main() {
internalBootstrapBrowserTest(() => testMain);
}
void testMain() {
AccessibilityAnnouncements accessibilityAnnouncements;
group('$AccessibilityAnnouncements', () {
setUp(() {
accessibilityAnnouncements = AccessibilityAnnouncements.instance;
});
test(
'Creates element when handling a message and removes '
'is after a delay', () {
// Set the a11y announcement's duration on DOM to half seconds.
accessibilityAnnouncements.durationA11yMessageIsOnDom =
const Duration(milliseconds: 500);
// Initially there is no accessibility-element
expect(document.getElementById('accessibility-element'), isNull);
accessibilityAnnouncements.handleMessage(codec,
codec.encodeMessage(testInput));
expect(
document.getElementById('accessibility-element'),
isNotNull,
);
final LabelElement input =
document.getElementById('accessibility-element');
expect(input.getAttribute('aria-live'), equals('polite'));
expect(input.text, testMessage);
// The element should have been removed after the duration.
Future<void>.delayed(
accessibilityAnnouncements.durationA11yMessageIsOnDom,
() =>
expect(document.getElementById('accessibility-element'), isNull));
});
});
}