@progress/kendo-e2e
Version:
Kendo UI end-to-end test utilities.
68 lines (67 loc) • 2.58 kB
TypeScript
import { Browser } from "../selenium/browser";
/**
* Crawler class that extends Browser to provide crawling functionality for testing links and components.
*/
export declare class Crawler extends Browser {
/**
* Scans the current page to find and log custom component tags.
*
* It extracts the component name from the URL path, constructs a CSS selector
* using the `kendo-` prefix, and optionally checks for a singular form.
*
* Logs a warning if no matching elements are found or if a search fails.
*
* Special case: if the extracted name is "general", it uses the previous path segment instead.
*
* @param customTags - Optional array of custom CSS selectors to search for instead of URL-based extraction
*
* @example
* ```typescript
* // Use URL-based extraction (default behavior)
* await crawler.crawlForTags();
*
* // Use custom tags
* await crawler.crawlForTags(['kendo-grid', 'kendo-chart']);
*
* // Use complex selectors
* await crawler.crawlForTags(['kendo-grid .k-grid-header', 'kendo-button[type="submit"]']);
* ```
*/
crawlForTags(customTags?: string[]): Promise<void>;
/**
* Crawls all link elements (`<a href>`) on the current page, opens each link in a new tab,
* checks for console errors, and optionally verifies component tags.
*
* Logs detailed information, including errors and successes, to a timestamped log file.
*
* Ensures browser cleanup by closing new tabs and returning to the original one after each link.
*
* @param crawlForTags - If true, also runs `crawlForTags()` on each visited link.
* @param customTags - Optional array of custom CSS selectors to pass to `crawlForTags()` method.
*
* @example
* ```typescript
* beforeAll(async () => {
* crawler = new Crawler();
* await crawler.navigateTo('http://localhost:4200/');
* });
*
* afterAll(async () => {
* await crawler.close();
* });
*
* it('crawl all links with URL-based tag detection', async () => {
* await crawler.crawlForErrors();
* });
*
* it('crawl all links with custom tags', async () => {
* await crawler.crawlForErrors(true, ['kendo-grid', 'kendo-button']);
* });
*
* it('crawl all links without tag checking', async () => {
* await crawler.crawlForErrors(false);
* });
* ```
*/
crawlForErrors(crawlForTags?: boolean, customTags?: string[]): Promise<void>;
}