-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from iptton/master
solves issue #5
- Loading branch information
Showing
7 changed files
with
68 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
import 'package:example/main.dart'; | ||
import 'package:flutter/cupertino.dart'; | ||
import 'package:flutter_driver/driver_extension.dart'; | ||
|
||
void main(){ | ||
enableFlutterDriverExtension(); | ||
|
||
runApp(MyApp()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import 'package:flutter_driver/flutter_driver.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
void main() { | ||
group("test scroll fast up and down", () { | ||
FlutterDriver driver; | ||
|
||
setUpAll(() async { | ||
driver = await FlutterDriver.connect(); | ||
}); | ||
|
||
tearDownAll(() async { | ||
driver?.close(); | ||
}); | ||
|
||
test("scroll fast", () async { | ||
final listFinder = find.byValueKey("list1"); | ||
// scroll to item 1 | ||
await driver.scroll(listFinder, 0, -200, Duration(milliseconds: 100)); | ||
|
||
// hack: force the driver wait 500ms for the notification events be process | ||
await driver.scroll(listFinder, 0, 0, Duration(milliseconds: 500)); | ||
|
||
var txt1 = await driver.getText(find.byValueKey("item-1")); | ||
var txt2 = await driver.getText(find.byValueKey("item-2")); | ||
|
||
// scroll up and down between item 1 & 2. | ||
for (int i = 0; i < 11; ++i) { | ||
await driver.scroll(listFinder, 0, -400, Duration(milliseconds: 100)); | ||
await driver.scroll(listFinder, 0, 400, Duration(milliseconds: 100)); | ||
} | ||
|
||
// hack: force the driver wait 500ms for the notification events be process | ||
await driver.scroll(listFinder, 0, 0, Duration(milliseconds: 500)); | ||
|
||
// expect item 1 notInView | ||
var txt = await driver.getText(find.byValueKey("item-1")); | ||
expect(txt, txt1); | ||
|
||
// expect item 2 notInView | ||
txt = await driver.getText(find.byValueKey("item-2")); | ||
expect(txt, txt2); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using new feature of dart 2.6: extensions.
need to upgrade flutter to flutter 1.12