Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot test when using multiple Scenes #70

Open
mbernardes19 opened this issue Nov 25, 2020 · 1 comment
Open

Cannot test when using multiple Scenes #70

mbernardes19 opened this issue Nov 25, 2020 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@mbernardes19
Copy link

mbernardes19 commented Nov 25, 2020

I have a bot made with Telegraf that works in this way:

When bot receives any message -> Show list of commands (default message)

When bot receives /start command ->
Enters a Scene ->
Sends 2 messages one after another ->
Enters another Scene ->
Then send another message that expects a reply.

That reply is the user's payment method. Based on that, I wrote this test:

    it('listens to payment method answer', async () => {
        const r = await test.sendMessage({text: '/start', entities: [{type: 'bot_command', offset: 0, length: 6}]})
        const response = await test.sendMessageWithText('cartao')
        expect(response.data.text).toBe('Certo!')
    })

But when I run this test, I actually receive as result that response.data.text brought the list of commands (default message) instead of the answer for the reply.

It seems that the test doesn't keep the state of the conversation (the Scene), so every sendMessageWithText is as if I was starting a new conversation every time.

Is there a way to keep that conversation state in the API? Or do we need to implement it?

@TiagoDanin
Copy link
Owner

There is currently no implementation.

@TiagoDanin TiagoDanin added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Jun 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants