Allow Developers to enable Accessibility testing on WebFlutterDriver and get the underlying webDriver (#65051)
This commit is contained in:
@@ -2,10 +2,13 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_driver/flutter_driver.dart';
|
||||
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
|
||||
import 'package:webdriver/async_io.dart';
|
||||
|
||||
/// The following test is used as a simple smoke test for verfying Flutter
|
||||
/// The following test is used as a simple smoke test for verifying Flutter
|
||||
/// Framework and Flutter Web Engine integration.
|
||||
void main() {
|
||||
group('Hello World App', () {
|
||||
@@ -28,5 +31,20 @@ void main() {
|
||||
test('title is correct', () async {
|
||||
expect(await driver.getText(titleFinder), 'Hello, world!');
|
||||
});
|
||||
|
||||
test('enable accessibility', () async {
|
||||
await driver.enableAccessibility();
|
||||
|
||||
await Future<void>.delayed(const Duration(seconds: 2));
|
||||
|
||||
// Elements with tag "flt-semantics" would show up after enabling
|
||||
// accessibility.
|
||||
//
|
||||
// The tag used here is based on
|
||||
// https://github.com/flutter/engine/blob/master/lib/web_ui/lib/src/engine/semantics/semantics.dart#L534
|
||||
final WebElement element = await driver.webDriver.findElement(const By.tagName('flt-semantics'));
|
||||
|
||||
expect(element, isNotNull);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user