Added tests for the new Android heading semantic flag to android_semantics_testing (#44031)

Added tests for the new Android heading semantic flag to android_semantics_testing.
This commit is contained in:
Darren Austin
2019-11-04 16:35:04 -08:00
committed by GitHub
parent bbb2a0f837
commit b815f76293
8 changed files with 98 additions and 1 deletions

View File

@@ -61,6 +61,8 @@ void main() {
group('TextField', () {
setUpAll(() async {
await driver.tap(find.text(textFieldRoute));
// Delay for TalkBack to update focus as of November 2019 with Pixel 3 and Android API 28
await Future<void>.delayed(const Duration(milliseconds: 500));
});
test('TextField has correct Android semantics', () async {
@@ -85,6 +87,7 @@ void main() {
);
await driver.tap(normalTextField);
// Delay for TalkBack to update focus as of November 2019 with Pixel 3 and Android API 28
await Future<void>.delayed(const Duration(milliseconds: 500));
expect(
@@ -105,6 +108,7 @@ void main() {
);
await driver.enterText('hello world');
// Delay for TalkBack to update focus as of November 2019 with Pixel 3 and Android API 28
await Future<void>.delayed(const Duration(milliseconds: 500));
expect(
@@ -148,6 +152,8 @@ void main() {
);
await driver.tap(passwordTextField);
// Delay for TalkBack to update focus as of November 2019 with Pixel 3 and Android API 28
await Future<void>.delayed(const Duration(milliseconds: 500));
expect(
await getSemantics(passwordTextField),
@@ -167,6 +173,8 @@ void main() {
);
await driver.enterText('hello world');
// Delay for TalkBack to update focus as of November 2019 with Pixel 3 and Android API 28
await Future<void>.delayed(const Duration(milliseconds: 500));
expect(
await getSemantics(passwordTextField),
@@ -630,5 +638,30 @@ void main() {
await driver.tap(find.byValueKey('back'));
});
});
group('Headings', () {
setUpAll(() async {
await driver.tap(find.text(headingsRoute));
});
test('AppBar title has correct Android heading semantics', () async {
expect(
await getSemantics(find.byValueKey(appBarTitleKeyValue)),
hasAndroidSemantics(isHeading: true),
);
});
test('body text does not have Android heading semantics', () async {
expect(
await getSemantics(find.byValueKey(bodyTextKeyValue)),
hasAndroidSemantics(isHeading: false),
);
});
tearDownAll(() async {
await driver.tap(find.byValueKey('back'));
});
});
});
}