'Is it possible to run a web test with extensions?
I am running the following test
@TestOn('chrome')
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/foundation.dart';
import 'package:my_project/data/web3/web3_provider_meta_mask.dart';
import 'package:my_project/data/web3/web3_repository.dart';
void main() {
group('web3Repository', () {
test('connect', () async {
final Web3Repository repository = Web3Repository(
provider: Web3ProviderMetaMask(),
);
final repsonse = await repository.connectProvider();
List<String> accounts = [];
repsonse.fold(
(failure) {
debugPrint(failure.toString());
},
(result) {
accounts = result;
},
);
expect(accounts.isNotEmpty, true);
});
});
}
The Web3ProviderMetaMask is using import 'package:flutter_web3/flutter_web3.dart' as web3;
But the test fails because the ethereum object is not available in the browser. It seems like the test opens a incognito browser window without the metamask plugin. Is it possible to run the test in a non incognito window?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|