Integration Testing
We use the end-to-end testing tool Cypress to test the main features of the Airy Live Chat Plugin, the Inbox, and the Control Center.
You can find the tests in the airy repository at /integration
. The tests are intended to be run on a local instance; a few values need to be configured before the tests can be run.
Here is a step-by-step guide to running the tests locally:
First, make sure that all dependencies are up-to-date in your
airy
repository. In doubt, delete yournodes_modules
and runyarn install
.You need to have the contacts feature enabled (it is disabled by default). To enable it, set the
integration.contacts.enabled
field in your airy.yaml config totrue
.Run a local instance with the command
scripts/dev_cli.sh create --provider=minikube
. Apply the configuration once the process is finished.Next, start the development server for the Control Center with the command:
./scripts/web-dev.sh //frontend/control-center:bundle_server
Navigate to the
Catalog
page and install the Airy Live Chat Plugin. Once it is installed, navigate to theConnectors
page, selectAiry Chat Plugin
, and add a new channel.Copy the channelID of the new channel and add it to the Cypress configuration file
/integration/cypress.config.ts
atenv.channelId
.Open the demo page by passing the
channel_id
as a query parameter:
http://localhost/chatplugin/ui/example?channel_id=<channel_id>
Write a message in the chat.Start the development server of the Inbox:
./scripts/web-dev.sh //frontend/inbox:bundle_server
You should see the conversation of the Airy Live Chat Plugin channel you just created. Copy its conversationID (it is the id that is passed in its URL) and add it to the configuration file
/integration/cypress.config.ts
atenv.conversationId
.Then, copy the id of the conversation's message and add it to the configuration file
/integration/cypress.config.ts
atenv. messageId
(you can find the message's id by inspecting its DOM element, as the id is passed to the DIV as a key).
You are now ready to run the tests on your local instance 🎉
Start the development server for the Control Center with the command
./scripts/web-dev.sh //frontend/control-center:bundle_server
Open the Cypress dashboard with the command:
/node_modules/.bin/cypress open -C integration/cypress.config.ts
The dashboard lists all tests. You can run tests by clicking on each item on the list.