Created
December 13, 2017 12:11
-
-
Save alexd1971/622615aeefb23fbb44db0923c9c27635 to your computer and use it in GitHub Desktop.
Webdriver tests failing with dartdevc
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<script async type="application/dart" src="main.dart"></script> | |
<script async type="text/javascript" src="packages/browser/dart.js"></script> | |
<title>Hello Dart</title> | |
</head> | |
<body> | |
<h1></h1> | |
</body> | |
</html> |
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
import 'dart:html'; | |
void main() { | |
final Element h1 = querySelector('h1'); | |
h1.text = 'Hello Dart'; | |
} |
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
import 'package:test/test.dart'; | |
import 'dart:io'; | |
import 'package:webdriver/io.dart'; | |
void main() { | |
Process webDriverProcess; | |
WebDriver webDriver; | |
setUpAll(() async { | |
webDriverProcess = await Process.start('chromedriver', []); | |
webDriver = await createDriver( | |
uri: Uri.parse('http://127.0.0.1:9515'), | |
desired: Capabilities.chrome | |
); | |
}); | |
tearDownAll(() async { | |
await webDriver.quit(); | |
webDriverProcess.kill(); | |
}); | |
test('prints hello dart', () async { | |
await webDriver.get('http://localhost:8088'); | |
final WebElement h1 = await webDriver.findElement(const By.tagName('h1')); | |
expect(await h1.text, 'Hello Dart'); | |
}); | |
} |
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
name: hello_dart | |
version: 0.0.1 | |
description: Hello Dart for web browser | |
dependencies: | |
dev_dependencies: | |
browser: ^0.10.0 | |
test: ^0.12.29 | |
webdriver: ^1.2.3 | |
web: | |
compiler: | |
debug: dartdevc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment