account (Vision)

account関数を使用するとaccounts.jsonファイルに設定したアカウント情報のプロパティを取得することができます。

サンプルコード

サンプルの入手

accounts.json

accounts.jsonファイルを作成し、データアイテムを記述します。プロパティ名(id, passwordなど)は任意です。

{
  "[account1]": {
    "id": "account1@example.com",
    "password": "p@ssword"
  },

  "[account2]": {
    "id": "account2@example.com",
    "password": "p@ssword"
  }
}

androidSettingsConfig.json (testConfig.json)

使用するaccounts.jsonファイルのパスをtestConfig.jsonファイルのdatasetセクションの"accounts"で指定します。

{
  "testConfigName": "androidSettingsConfig",

  "dataset": {
    "accounts": "testConfig/android/androidSettings/dataset/accounts.json"
  },

...

Account1.kt

(src/test/kotlin/tutorial/basic/Account1.kt)

Use account function.

    @Test
    @Order(10)
    fun account() {

        scenario {
            case(1) {
                condition {
                    it.macro("[Android設定トップ画面]")
                        .tap("設定を検索")
                        .screenIs("[Android設定検索画面]")
                }.action {
                    it.sendKeys(account("[account1].id"))
                }.expectation {
                    it.textIs(account("[account1].id"))
                }
            }
        }

    }

Link