Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 4e425a2

Browse files
author
nturgut
committed
change window size
1 parent 9e58293 commit 4e425a2

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

e2etests/web/regular_integration_tests/lib/screenshot_support.dart

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
// found in the LICENSE file.
44

55
import 'dart:io' as io;
6+
import 'dart:math';
67

78
import 'package:flutter_driver/flutter_driver.dart';
89
import 'package:integration_test/integration_test_driver_extended.dart' as test;
910

1011
import 'package:web_test_utils/goldens.dart';
1112
import 'package:web_test_utils/image_compare.dart';
13+
import 'package:webdriver/src/async/window.dart';
1214

1315
import 'package:image/image.dart';
1416

@@ -20,6 +22,9 @@ import 'package:image/image.dart';
2022
/// under test ex: a blinking cursor.
2123
const double kMaxDiffRateFailure = 0.5 / 100; // 0.5%
2224

25+
const int kMaxScreenshotWidth = 1024;
26+
const int kMaxScreenshotHeight = 1024;
27+
2328
/// Used for calling `integration_test` package.
2429
///
2530
/// Compared to other similar classes which only included the following call:
@@ -32,13 +37,18 @@ const double kMaxDiffRateFailure = 0.5 / 100; // 0.5%
3237
/// It provides an `onScreenshot` callback to the `integrationDriver` method.
3338
/// It also includes options for updating the golden files.
3439
Future<void> runTestWithScreenshots(
35-
{double diffRateFailure = kMaxDiffRateFailure}) async {
40+
{double diffRateFailure = kMaxDiffRateFailure,
41+
int browserWidth = kMaxScreenshotWidth,
42+
int browserHeight = kMaxScreenshotHeight}) async {
3643
final WebFlutterDriver driver =
3744
await FlutterDriver.connect() as WebFlutterDriver;
3845

3946
// Learn the browser in use from the webDriver.
4047
final String browser = driver.webDriver.capabilities['browserName'] as String;
4148

49+
final Window window = await driver.webDriver.window;
50+
window.setSize(Rectangle<int>(0, 0, browserWidth, browserHeight));
51+
4252
bool updateGoldens = false;
4353
final String updateGoldensFlag = io.Platform.environment['UPDATE_GOLDENS'];
4454
if (updateGoldensFlag == null || updateGoldensFlag.toLowerCase() != 'true') {

0 commit comments

Comments
 (0)