Skip to main content

Testing flows

We support two approaches for testing your integration with Dopt: local/offline and live against our APIs. These “modes” are configured through your usage of the <DoptProvider />.

info

Generated documentation for the <DoptProvider /> can be found here

Local development

In local mode, you provide the <DoptProvider /> with configuration that allows for mocking of blocks. This gives the developer complete control over the starting state of individual blocks. Actions/intents on the block will update the state correctly but the flow will not progress. This is great for developing individual experiences powered by Dopt before testing how they connect in a flow.

import { DoptProvider } from '@dopt/react';
import Application from './application';

const blocks: Blocks = {
HNWvcT78tyTwygnbzU6SW: {
active: true,
started: false,
completed: false,
stopped: false,
exited: false,
uuid: 'HNWvcT78tyTwygnbzU6SW',
},
};

export function Index() {
return (
<DoptProvider mocks={{ blocks }}>
<Application />
</DoptProvider>
);
}
note

We will allow the mocking of edges in the near future, allowing you to test the flow locally.

Live

In live mode you are using our APIs directly. You do so by providing the <DoptProvider /> with your API key and an identifier for a user you’ve identified (see ProviderConfig).

You can reset the state of a flow for a user from the users page.

We also provide a testing endpoint to reset the state of the flow for the user you are testing with. Assuming the user identified earlier (i.e. user 123456789) a flow with identifier new-user-onboarding and version 1.

curl \
-H "x-api-key:$YOUR_API_KEY" \
-X POST \
https://blocks.dopt.com/flow/new-user-onboarding/version/1/reset?endUserIdentifier=123456789
info

You can grab the flow identifier from the flow listing page as the subheading of the flow.