We have 2 scenarios:
- Account Binding (registering a bank account number to a service)
- Verify OTP (input the otp code sent via customer’s mobile phone)
Some response from the Account Binding used in the second scenario, but I need to "inject" the OTP Code value before the second step.
What I’ve done so far in Codeception is using CodeceptionLibActorSharedPause
:
public function testVerificationFlow()
{
$faker = FakerFactory::create();
$sequence = '0000';
$partnerReferenceNo = $faker->numerify('###########') . $sequence;
$bankAccountNo = $faker->numerify('##########');
$bankCardNo = $faker->randomNumber(4, true);
$limit = 250000.00;
$email = $faker->email();
$custIdMerchant = $faker->numerify('##########');
$response = $this->autopay->accountBinding(
$partnerReferenceNo,
$bankAccountNo,
$bankCardNo,
$limit,
$email,
$custIdMerchant
);
codecept_debug($response);
$this->assertEquals($response->responseCode, self::RESP_CODE_ACCOUNT_BINDING);
$otpCode = '';
// how to inject the value of $otpCode here?
$this->pause();
codecept_debug($otpCode);
$verifyOtpResponse = $this->autopay->verifyOtp(
$partnerReferenceNo,
$response->originalReferenceNo,
$response->chargeToken,
$otpCode,
);
codecept_debug($verifyOtpResponse);
$this->assertEquals($verifyOtpResponse->responseCode, self::RESP_CODE_OTP_VERIFY);
}
The HoaConsole project is abandoned since years ago
Execution PAUSED, starting interactive shell...
Type in commands to try them:
- ENTER to continue
- TAB to auto-complete
- F5 to stash a command
- F6 to toggle auto-stashing of successful commands
- F8 to view stashed commands
- F10 to clear stashed commands
I still have no clue what to use when pausing the unit test. Any insight / google keyword to search is appreciated.
2
Answers
I just realized that
HoaConsole
is usingreadline()
to "pause" the process.This would be my solution in a pure program.
The idea is to use the POST as well as a DATA File and save each question / response
(You would need to wrap this in a
<form></form>
) but ideally it would work.