Skip to content

Latest commit

 

History

History
119 lines (82 loc) · 2.99 KB

README.md

File metadata and controls

119 lines (82 loc) · 2.99 KB

Patrol documentation for the Archethic Wallet

Documentation is avaliable at :

Run the tests

All the tests are located in integration_test

To list the compatible connected devices and emulators

patrol devices

To run all the tests :

Connect your device or launch your compatible Emulator

patrol test

To run a single specification :

patrol test --target integration_test/<spec_file>_test.dart

To run Patrol on a specific device :

patrol drive -D <device_name>

To update Patrol :

patrol update

Ignoring tests

By default, Patrol runs all the files ending with _test.dart and containing a patrolTest lock. You can ignore files by removing the test or adding a _skip just before the extension <example>_test_skip.dart

Adding native actions for Android

From https://patrol.leancode.co/native/setup

Create an instrumentation test file in your application's android\app\src\main\java\net\archethic\archethic_wallet\MainActivityArchethicWallet.java

package net.archethic.archethic_wallet

import org.junit.Rule;
import org.junit.runner.RunWith;
import pl.leancode.patrol.PatrolTestRule;
import pl.leancode.patrol.PatrolTestRunner;

@RunWith(PatrolTestRunner.class)
public class MainActivityTest {
    @Rule
    public PatrolTestRule<MainActivity> rule = new PatrolTestRule<>(MainActivity.class);
}

Next, update your app-level build.gradle: android/app/build.gradle

android {
  // ...
  defaultConfig {
    //...
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  }
}

dependencies {
    testImplementation "junit:junit:4.13.2"
}

For iOS

From https://patrol.leancode.co/native/setup. For the iOS part, you can follow https://patrol.leancode.co/native/setup#integrate-with-native-side

Testing

You can now use native commands in your tests :

void main() {
  patrolTest(
    'counter state is the same after going to Home and switching apps',
    nativeAutomation: true,
    nativeAutomatorConfig: NativeAutomatorConfig(
      packageName: 'pl.leancode.patrol.example',
      bundleId: 'pl.leancode.patrol.Example',
    ),
    ($) async {
      await $.pumpWidget(ExampleApp());

      await $(FloatingActionButton).tap();
      expect($(#counterText).text, '1');

      await $.native.pressHome();
      await $.native.openApp();

      expect($(#counterText).text, '1');

      await $(FloatingActionButton).tap();
      expect($(#counterText).text, '2');
    },
  );
}

TODOs / Improvements

  • Script UCO retrieval from Faucet
  • Watch Patrol improvements (Account popup selection does not work for an unknown reason)
  • Implement a full scenario (all_test_skip.dart).