stock_view_test.dart 1.39 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
// Copyright 2014 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.

import 'dart:async';

import 'package:flutter_driver/flutter_driver.dart';
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;

void main() {
  group('basic stock view test', () {
12
    late FlutterDriver driver;
13 14 15 16 17 18

    setUpAll(() async {
      driver = await FlutterDriver.connect();
    });

    tearDownAll(() async {
19
      driver.close();
20 21 22 23 24
    });

    test('Stock list is shown', () async {
      final SerializableFinder stockList = find.byValueKey('stock-list');
      expect(stockList, isNotNull);
25
    }, timeout: Timeout.none);
26 27 28 29 30 31 32 33 34 35 36

    test('open AAPL stock', () async {
      final SerializableFinder stockList = find.byValueKey('stock-list');
      expect(stockList, isNotNull);

      final SerializableFinder aaplStockRow = find.byValueKey('AAPL');
      await driver.scrollUntilVisible(stockList, aaplStockRow);

      await driver.tap(aaplStockRow);
      await Future<void>.delayed(const Duration(milliseconds: 500));

37 38
      final SerializableFinder stockOption =
          find.byValueKey('AAPL_symbol_name');
39
      final String symbol = await driver.getText(stockOption);
40 41

      expect(symbol, 'AAPL');
42 43 44
    },
    skip: 'Needs to be fixed on Fuchsia.', // https://github.com/flutter/flutter/issues/87069
    timeout: Timeout.none);
45 46
  });
}