Previously, only one bot can be created using the
generate-integration-docs-screenshot script for each integration. This
was because the bot's email was constructed using the integration's
name.
Thus, the bot-name commandline option would not work if a bot already
exists for the integration.
Now, we create the email by cleaning the bot-name value, if passed.
Previously, the integration's name was directly being used.
Due to this, the GitHub Sponsors integration which is in the same module
as the GitHub integration could not be used with the
`generate-integration-docs-screenshot` script, as it would be unable to
locate the fixtures.
Add a `fixtureless_group` of arguments to allow passing in the message,
topic and channel via the commandline.
By default, the script uses the screenshot config from
`integrations.py`.
Example screenshots can now be generated for fixtureless integrations,
by sending mock messages using the topic and message text included in
the screenshot config added in the previous commit.
This is in preparation of adding support for generating screenshots of
fixtureless integrations, which would need to get image_path, without
involving fixture_path.
This is in preparation to differentiate the current config dataclass
(used for webhooks) from the FixturelessScreenshotConfig that will be
added for non-webhook integrations in the following commits.
- Removed the BaseScreenshotConfig dataclass, and merge it with
ScreenshotConfig dataclass.
- Simplified get_fixture_and_image_paths.
- Simplified generate_screenshot_from_config in the screenshot script.
- Deleted send_bot_mock_message.
- Simplified the loading of commandline options into the config dict.
- Split the logic into two new functions. This is in preparation to
later commits that will parse commandline options for non-webhook
integrations by re-using the created functions.
Group argparse arguments into common and webhook-specific options.
The common group contains arguments that apply to both webhook and
non-webhook integrations. It is not assigned a description.
A fixtureless, non-webhook group will be added later, when its arguments
are created.
to `fixture-name` to match the name of the corresponding field in the
ScreenshotConfig dataclass.
This is in preparation to loading all the options into a config dict
in a single step in a later commit.
Rename `group` to `batch_group`.
It's a mutually exclusive group that lets the user decide whether to
generate screenshots one at a time or in a batch.
Add a common function for webhooks to convert multipart strings to dict.
This facilitates loading a multipart/form-data fixture as a file string,
and converting it.
This will allow testing integrations that use multipart/form-data,
and generating their example screenshots using a script.
Note that this only supports text fields, accommodation for binary files
is not included at the moment.
This commit relocates all the scripts in the tools directory which
are used for auto-generating screenshots to the new
tools/screenshots directory to avoid cluttering the tools/ root.