Tutorial: Configure a Knowledge Base
A step-by-step tutorial for creating Knowledge Base entries that teach ContextQA's AI how to handle cookie banners, chat widgets, and other application-specific patterns — then verifying the AI follow
Who is this for? Testers, SDETs, and QA managers who want to reduce false test failures caused by cookie banners, chat widgets, onboarding tours, and other application-specific UI patterns.
Every web application has patterns that trip up automated testing — a GDPR consent banner that covers the page on first load, a live chat widget that floats over buttons, a product tour that hijacks clicks. Without guidance, the ContextQA AI agent either interacts with these overlays by mistake or gets blocked by them, causing false failures.
In this tutorial, you create two Knowledge Base entries that teach the AI to handle these patterns automatically. By the end, every test in your workspace benefits from these instructions without any changes to individual test cases.
What you will accomplish:
Create a Knowledge Base entry for handling cookie consent banners
Create a second entry for dismissing live chat widgets
Set one entry as the workspace default
Run a test case with the knowledge base attached and verify the AI follows your instructions
Time: 10 minutes
Prerequisites
A ContextQA account with a plan that includes AI features (the Knowledge Base menu item is visible in your left sidebar)
At least one existing test case in your workspace — if you have not created one yet, complete the Quickstart Guide first
A test case that targets an application with a cookie consent banner or chat widget (to see the knowledge base in action)
Step 1: Navigate to the knowledge base
Sign in to ContextQA and open your workspace.
In the left sidebar, click Knowledge Base (under the Test Plan & Results section).
The Knowledge Base list page opens. If this is your first time here, the page displays an empty state with the message "No data available."
If Knowledge Base is grayed out or missing from the sidebar, your current plan does not include AI features. Contact your workspace administrator to upgrade.
Step 2: Create your first entry — cookie consent banner
This entry teaches the AI to dismiss cookie consent banners before interacting with the page.
Click the + Add button in the top-right corner of the page.
The Create Knowledge Base dialog opens with two required fields.
In the Name field, enter:
In the Description field, enter:
Click Save.
A success notification confirms "Prompt was successfully created." The entry now appears in the Knowledge Base list.
Verification: The list shows one row with the name "Cookie consent banner" in the Name column.
Step 3: Create a second entry — live chat widget
Repeat the process to handle live chat widgets that float over page content.
Click the + Add button again.
In the Name field, enter:
In the Description field, enter:
Click Save.
Verification: The list now shows two entries. Both have a toggle in the Status column, but neither is marked as the default yet.
Step 4: Set a default entry
The default Knowledge Base entry applies automatically to test executions. Only one entry can be the default at a time.
In the Knowledge Base list, find the Cookie consent banner row.
Click the toggle switch in that row.
A success notification confirms "Prompt was successfully set as default." The Status column now displays a Default Prompt badge next to the cookie consent entry.
Verification: The "Cookie consent banner" row shows a blue Default Prompt badge. The "Live chat widget dismissal" row has no badge — it is available for manual selection but does not apply automatically.
To remove the default, click the toggle again. The tooltip changes from Deactivate (when on) to Set as Default (when off).
Step 5: Run a test with your knowledge base
Now verify that the AI follows your instructions during execution. You can attach a knowledge base entry in two ways: through the default (which already applies) or by selecting a specific entry at execution time.
Option A: Run with the default (automatic)
Since you set "Cookie consent banner" as the default in step 4, it applies to every execution in this workspace automatically.
Navigate to Test Development in the left sidebar.
Select an existing test case that targets an application with a cookie banner.
Click the Run button to execute the test.
The AI reads the default Knowledge Base entry before the run begins and follows the instruction when it encounters a cookie consent banner.
Option B: Select a specific entry at execution time
To use a different entry (for example, the chat widget entry) for a single run:
In the test case details view, click the Settings icon next to the Run button.
In the execution settings, find the Knowledge Base dropdown.
Select Live chat widget dismissal from the list.
Click Run.
This overrides the default for this specific execution only. Future runs still use the workspace default.
Step 6: Verify the AI followed your instructions
After the execution completes:
Open the execution results (click View Report or navigate to the result from the Results list).
Review the step-by-step screenshots. Look for the moment where the cookie banner or chat widget appeared.
Confirm the AI dismissed the overlay before continuing with the test steps.
Signs it worked:
The cookie consent banner appears in an early screenshot and is gone in the next one — the AI clicks "Accept" without being told to in the test steps
The test did not fail on a step that an overlay blocked
No step interacted with the chat widget or cookie banner by mistake
Signs it did not work:
A step failed because the AI clicked the banner instead of the intended element — refine the prompt wording to be more specific about which button to click
The banner is still visible in later screenshots — the AI did not detect it; try adding alternative button labels to the description (for example, "I agree", "Got it", "OK")
Summary
You created two Knowledge Base entries that teach the ContextQA AI to handle common UI obstacles:
Cookie consent banner
GDPR and cookie consent dialogs
Workspace default (applies to all runs)
Live chat widget dismissal
Chat widgets that float over content
Manual selection (apply per-run)
These entries persist at the workspace level — every team member and every test benefits from them without modifying individual test cases.
Next steps
Add more entries for other patterns in your application — onboarding tours, promotional popups, staging banners, MFA codes for test environments
Use the knowledge base with AI test generation — when creating a test case with AI assistance, expand Advanced Settings and select a Knowledge Base entry to give the AI context during generation
Attach a knowledge base to a test plan — in test plan settings, select a Knowledge Base entry under the Knowledge Base dropdown so every execution in the plan uses it automatically
Manage entries programmatically — use the MCP tools
list_knowledge_basesandcreate_knowledge_baseto manage entries from AI agents or CI scripts
Writing effective knowledge base entries
As you add more entries, follow these guidelines:
Write imperative instructions: "Click the Accept button"
Vague descriptions: "Handle the popup"
Describe the visual pattern: "a banner at the top of the page"
Over-specific selectors: "Click the element with id='consent-btn'"
Specify the action and the target: "Close the chat widget by clicking X"
Ambiguous instructions: "Be careful on this page"
Keep each entry focused on one pattern
Combining multiple patterns in a single entry
Related pages
Knowledge Base — full reference for Knowledge Base features and MCP tools
Custom Agents — create specialized AI agents with domain-specific testing instructions
AI Test Generation — generate test cases from Jira tickets, Figma designs, and more
Running Tests — execution options and settings
Quickstart Guide — create and run your first test case
Reduce false failures with AI that understands your application. Start Free Trial → — Or Book a Demo → to see the Knowledge Base in action with your application.
Last updated
Was this helpful?
