代码是否正常工作?

I had to write functional cept in codeception. It just creates 2 conversations and clicks delete button on one of them, and checks if the right conversation have been deleted. I wrote the test to see if everything working properly but it is not. Logic of the test is following:

  1. User signs in
  2. User sends 2 messages to different users.(2 conversations will be created)
  3. User clicks 'Delete conversation' button on one of them
  4. User checks if the right conversation have been deleted.

<?php 
$I = new FunctionalTester($scenario);
$I->am('a user');
$I->wantTo('delete existing conversation');

$user = $I->signIn();

$I->sendMessage('other', 'some random message');
$I->sendMessage('AnotherUser', 'other random message');

dd($user->conversations->count());

$I->click('Delete conversation');

$I->seeCurrentUrlEquals('/inbox');
$I->dontSee('other random message');
$I->see('some random message');

But the problem is count of user's conversations always is 1. No matter how many messages I have sent to new users, dd($user->conversations->count()) always is 1. But message have been sent(However to send a message you should create a conversation). I dont know how is that possible? I wrote an integration test to check if the function that creates conversation is working properly. And it is. I don't know how to test the logic of the application.

Before executing dd($user->conversations->count()); you will need to execute some waitForElementVisible method it seems that previous actions did not finished completely.