Ensure Settings Compound Step¶
The Ensure Settings Compound Step confirms settings on the phone by specifying criteria such as call forwarding, preferred network type and APN configurations. The Ensure Settings Compound Step also creates a Temporary Property that contains the ensured
input settings.
Note:
-
Certain steps are incompatible with each other. If Incompatible Step Details are used, the step will fail and an exception will be printed to the log.
-
If a Scenario includes multiple Ensure Settings Compound Steps, it is strongly recommended to add a
wait for 15 seconds
step after each Ensure Settings Compound Step to provide enough time for the step to finish. Otherwise, the step may fail.
Syntax
1 2 3 4 5 | // Ensures settings on a single phone And ensure settings on phone <phone Identifier>: // Ensures settings on multiple phones And ensure settings on phones <name1 Identifier, <name2 Identifier>, ... nameN>: |
Parameter
- nameX - The name assigned to the party whose settings are being confirmed
Ensure Settings on a Single Phone Example
1 2 3 4 5 6 7 8 9 10 | Feature: MyCall Scenario: Compound Call Given a phone as A: * of type Android And ensure settings on phone A: * without call forwarding And wait 15 seconds |
Ensure Settings on Multiple Phones Example
1 2 3 4 5 6 7 8 9 10 11 12 13 | Feature: MyCall Scenario: Compound Call Given phones as A and B: * of type Android And ensure settings on phones A and B: * without call forwarding And wait 15 seconds And A starts a call to B as MYCALL: * detect incoming call within 10 seconds |
This step is eligible for:
- Deferred
Ensure SMSC Settings ¶
Specifying the smsc
Step Detail update the short Message Service Center address on the phone.
Syntax
1 2 | And ensure settings on phone <phone Identifier>: * with smsc = <smsc String> |
Parameters
-
phone - The name assigned to the party whose settings are being confirmed
-
smsc - The phone number in international format, or a reference to a Context Object that resolves to a string of a number in international format
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 | Feature: MyCall Scenario: Compound Call Given phones as A and B: * of type Android And ensure settings on phones A and B: * with SMSC = "43660123456" And wait 15 seconds And A starts a call to B as MYCALL: * detect incoming call within 10 seconds |
Ensure Without Call Forwarding ¶
This Step Detail cancels any call forwarding settings on the phone. Therefore, it can not be combined with other call forwarding Step Details from the Voice Call Compound Step.
Syntax
1 2 | And ensure settings on phone <phone Identifier>: * without call forwarding |
Parameter
- phone - The name assigned to the party whose settings are being confirmed
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 | Feature: MyCall Scenario: Compound Call Given phones as A and B: * of type Android And ensure settings on phones A and B * without call forwarding And wait 15 seconds And A starts a call to B as MYCALL: * detect incoming call within 10 seconds |
Ensure Call Forwarding Unconditional ¶
This Step Detail activates Call Forwarding Unconditional. Other types of Call Forwarding settings will no longer work.
Important! Call forwarding unconditional cannot be combined with other call forwarding variants.
Syntax
1 2 | And ensure settings on phone <phone Identifier>: * with call forwarding unconditional to <destination Identifier|String> |
Parameters
-
phone - The name assigned to the party whose settings are being confirmed
-
number - The phone number in international format, or a reference to a Context Object that resolves to a string of a number in international format
Example
1 2 | And ensure settings on phone A: * with call forwarding unconditional to numberFromContextObject |
Ensure Call Forwarding No Answer ¶
This Step Detail activates Call Forwarding No Answer. An additional only
clause can be added, for example, only with call forwarding no answer
. This further ensures that other call forwarding settings can not be set.
- Call forwarding busy and call forwarding no answer may be used together.
Syntax
1 2 3 4 5 6 | // Allows other variants of call forwarding And ensure settings on phone <phone Identifier>: * with call forwarding no answer to <destination Identifier|String> // Exclusive variant of call forwarding no answer And ensure settings on phone <phone Identifier>: * only with call forwarding no answer to <destination Identifier|String> |
Parameters
-
phone - The name assigned to the party whose settings are being confirmed
-
number - The phone number in international format, or a reference to a Context Object that resolves to a string of a number in international format
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | Feature: MyCall Scenario: Compound Call Given phones as A, B and C: * of type Android And ensure settings on phone B: * with call forwarding no answer to C.number And wait 15 seconds And A starts a call to B as MYCALL: * detect incoming call within 10 seconds * call forwarding no answer to C |
Ensure Call Forwarding Busy ¶
This Step Detail activates Call Forwarding Busy. An additional only
clause can be added, for example, only with call forwarding busy
. This further ensures that other call forwarding settings cannot be set.
- Call forwarding busy and call forwarding no answer may be used together.
Syntax
1 2 3 4 5 6 | // Allows other variants of call forwarding And ensure settings on phone <phone Identifier>: * with call forwarding busy to <destination Identifier|String> // Exclusive variant of call forwarding And ensure settings on phone <phone Identifier>: * only with call forwarding busy to <destination Identifier|String> |
Parameters
-
phone - The name assigned to the party whose settings are being confirmed
-
number - The phone number in international format, or a reference to a Context Object that resolves to a string of a number in international format
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | Feature: MyCall Scenario: Compound Call Given phones as A, B and C: * of type Android And ensure settings on phone B: * with call forwarding busy to C.number * with call forwarding no answer to C.number And wait 15 seconds And A starts a call to B as MYCALL: * detect incoming call within 10 seconds * call forwarding busy to C |
-
with call forwarding unconditional
-
with call forwarding no answer
Ensure Call Forwarding Not Reachable ¶
This Step Detail activates Call Forwarding Not Reachable. An additional only
clause can be added, for example, only with call forwarding not reachable
. This further ensures that other call forwarding settings can not be set.
- Call forwarding busy and call forwarding not reachable may be used together.
Syntax
1 2 3 4 5 6 | // Allows other variants of call forwarding And ensure settings on phone <phone Identifier>: * with call forwarding not reachable to <destination Identifier|String> // Exclusive variant of call forwarding And ensure settings on phone <phone Identifier>: * only with call forwarding not reachable to <destination Identifier|String> |
Parameters
-
phone - The name assigned to the party whose settings are being confirmed
-
number - The phone number in international format, or a reference to a Context Object that resolves to a string of a number in international format
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | Feature: MyCall Scenario: Compound Call Given phones as A, B and C: * of type Android And ensure settings on phone B: * with call forwarding not reachable to C.number And wait 15 seconds And A starts a call to B as MYCALL: * detect incoming call within 10 seconds * call forwarding not reachable to C |
Ensure APN Configuration ¶
The following two Step Details set APN configuration parameters:
-
with apn configured to name =
- Explicitly takes the configuration from its specified arguments. -
with apn configured as
- Defines an APN configuration Context Object.
Additional information about setting APNs is available in APNs Configuration.
Important! Only one of these two Step Details may be used within an Ensure Settings Compound Step.
Ensure APN Configuration Parameters ¶
The with apn configured to
Step Detail explicitly takes the configuration from its specified arguments.
Syntax
1 2 3 | And ensure settings on phone <phone Identifier>: * with apn configured to name = <confName String>, apn = <apnName Identifier>, mcc = <mcc String>, mnc = <mnc String> |
Parameters
-
phone - The name assigned to the phone
-
confName - The name assigned to the APN configuration setting
-
apnName - The name assigned to the APN
-
mcc and mnc - (Optional) The Mobile Country Code and Mobile Network Code
- If unspecified, the default SIM card's MCC and MNC are used as default
Important! If the MNC and MCC are neither specified in the Step Detail nor available on the SIM card, the step will fail.
Example
1 2 | And ensure settings on phone A: * with apn configured to name="conf01", apn=apn01, mcc=mccInContext, mnc="123" |
Set APN Configuration via Context Objects ¶
The following Step Detail defines an APN Configuration Context Object. Configuration is described in the subsequent section. The APN configuration Context Object is comprised of a Map, which holds the key values representing the mandatory APN fields and, optionally, the MCC and MNC fields.
Syntax
1 2 | And ensure settings on phone <phone Identifier>: * with apn configured as <apnContext Identifier> |
Parameters
-
phone - The name assigned to the phone
-
apnContext - The name assigned to the APN configuration Context Object
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 | Feature: MyCall Scenario: Compound Call Given phones as A and B: * of type Android And ensure settings on phones A and B: * with apn configured as apnConf01 And wait 15 seconds And A starts a call to B as MYCALL: * detect incoming call within 10 seconds |
Set APN via Context Object- Configuration¶
To use the with apn configured as
Step Detail, a ContextObjects configuration must be set.
Syntax
1 2 3 4 5 6 7 8 9 10 11 12 13 | ContextObjects { <identifier ContextObject> { apn: <String> name: <String> mcc : <String> mnc : <String> username: <String> password: <String> authentication: <String> protocol: <String> roaming: <String> } } |
Parameters
-
identifier - The name assigned to the context object
-
apn - The APN used by the device
-
name - The APNs name
-
mcc - The Mobile Country Code
-
mnc - The Mobile Network Code
-
username (Optional) - The APN username to access the Internet
-
password (Optional) - The password used to access the Internet.
-
authentication (Optional) - The APN authentication type
- May be one of:
NONE
,PAP
,CHAP
orPAP/CHAP
- May be one of:
-
protocol (Optional) - The protocol that the device must use to access the Internet
- May be one of:
IP
for IPv4,IPV6
for IPv6 orIPV4V6
for IPv4/IPv6
- May be one of:
-
roaming (Optional) - The protocol used for connecting to the Internet when in roaming
Example
1 2 3 4 5 6 7 8 9 10 11 | ContextObjects { apnProfile { apn: "testApn" name: "testName" username: "testUser" password: "testPassword" authentication: "CHAP" protocol: "IPV6" roaming: "IPV4" } } |
Note:
-
The APN Name, APN, MCC, MNC are all required to configure an APN. The SIM card's default values are its MNC and MCC fields and will be used if not specified in the APN configuration Step Detail. If the MNC and MCC are neither specified in the Step Detail nor available on the SIM card, the step will fail.
-
authentication
must be provided in order to configure ausername
andpassword
.
Ensure Airplane Mode is Enabled or Disabled ¶
The following Step Detail enables or disables the airplane mode.
Syntax
1 2 | And ensure settings on phone <phone Identifier>: * with airplane mode <statusAirplaneMode Identifier> |
-
phone - The name assigned to the phone
-
statusAirplaneMode - The phone's airplane mode status which can be set to
enabled
ordisabled
Example
1 2 | And ensure settings on phone A: * with airplane mode disabled |
Ensure Preferred Network Type ¶
The registered in
Step Detail sets the preferred network type on the phone and can be combined with any of the other ensure settings
Step Details.
Syntax
1 2 | And ensure settings on phone <phone Identifier>: * registered in <networkType String|ContextObject> |
-
phone - The name assigned to the phone
-
networkType - Sets the phone's preferred network type either to
2G
,3G
or4G
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | Feature: MyCall Scenario: Compound Call Given phones as A and B: * of type Android And ensure settings on phone A: * with airplane mode disabled * registered in 4G And wait 15 seconds And A starts a call to B as MYCALL: * detect incoming call within 10 seconds |
Ensure Registered in Network ¶
This Step Detail registers the phone to a specified network. The step will fail if the network operator does not exist, or if the phone fails to register with the selected network.
Note: This Step Detail works with local and remote Nexus phones only.
Syntax
1 2 | And ensure settings on phone <phone Identifier>: * is registered in network <network String> |
Parameters
-
phone - The name assigned to the phone
-
network - The network to register the phone to
Example
1 2 3 4 5 6 7 | Feature: MyCall Scenario: Compound Call Given a phone as A: * of type Android Then ensure settings on phone A: * is registered in network "A1" |
Ensure Screen is Active¶
This Step Detail ensures the screen is active and that the Developer Option Stay Awake
is enabled. This setting guarantees that the device screen will stay active as long as the device is connected to a computer via USB.
The screen is considered to be active if it is turned on. The phone may be locked or unlocked.
Syntax
1 | * screen is active |
Example
1 2 3 4 5 6 7 | Feature: MyCall Scenario: Compound Call Given a phone as A: * of type Android And ensure settings on phone A: * screen is active |
Access Phone Settings as Temporary Properties ¶
The Ensure Settings Compound Step creates a temporary property that contains the ensured input settings. These are accessible as Context Variables within the scenario execution context.
Syntax
1 2 | <phone Identifier>.settings.<setting Setting> <phone Identifier>.prop.settings.<setting Setting> |
Parameters
-
phone - The identifier of the phone whose settings are being accessed
-
setting - The setting to access
Example
1 2 3 4 5 6 7 8 9 10 11 12 | Feature: MyCall Scenario: Compound Call Given a phone as A: * of type Android And ensure settings on phone A: * with apn configured to name = "test" , apn = "test2" And wait 15 seconds And verify A.settings.apnSettings.name == "test" And verify A.settings.apnSettings.apn == "test2" |
Access Phone Settings - Settings Structure¶
The following settings are accessible:
-
smsc - Nullable string, with
null
as default value -
callForwarding - Call forwarding settings:
- withoutCallForwarding - Nullable boolean, with
null
as default value - callForwards - List of
CallForwarding
elements as the following:- type - use
.name()
to get one of the following strings:Unconditional
,NoAnswer
,Busy
orNotReachable
- exclusive - Boolean, with
false
as default value -
- number - String
- type - use
- withoutCallForwarding - Nullable boolean, with
-
airplaneMode - Nullable boolean, with
null
as default value -
preferredNetwork - Nullable string, with
null
as default value -
apnSettings - Nullable structured type as the following:
- name - String, name of setting as displayed on the phone
- apn - String, APN definition
- mcc - String, mobile country code
- mnc - String, mobile network code
- user - String, with empty string as default value
- password - String, with empty string as default value
- authType - String, with empty string as default value
- protocol - String, with empty string as default value
- roamingProtocol - String with empty string as default value
-
networkOperator - Nullable string, with
null
as default value -
ensureActiveScreen - Boolean, with
false
as default value