From 45a6d12c23e4ff55f8fa10bb96af8eaba2920ca5 Mon Sep 17 00:00:00 2001 From: Tai Shi Ling Date: Tue, 30 Apr 2024 17:17:05 +0800 Subject: [PATCH 1/8] Reorganise navigation menu --- reference/custom-reporting/custom-logs.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 reference/custom-reporting/custom-logs.md diff --git a/reference/custom-reporting/custom-logs.md b/reference/custom-reporting/custom-logs.md new file mode 100644 index 0000000..7d73414 --- /dev/null +++ b/reference/custom-reporting/custom-logs.md @@ -0,0 +1,2 @@ +# Custom validation and log messages + From 13c8d044e45d6104ddfb0f59539dba0660f0dc52 Mon Sep 17 00:00:00 2001 From: Tai Shi Ling Date: Tue, 30 Apr 2024 17:22:04 +0800 Subject: [PATCH 2/8] Update navigation menu --- SUMMARY.md | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/SUMMARY.md b/SUMMARY.md index 6cdcc24..3d1cf2f 100644 --- a/SUMMARY.md +++ b/SUMMARY.md @@ -7,12 +7,6 @@ * [Run a test](getting-started/running-tests.md) * [Share test reports](getting-started/share-test-reports.md) -## Core Concepts - -* [Cross Browser Testing](/core-concepts/cross-browser-testing.md) -* [How Targeting Works in UIlicious](core-concepts/how-targeting-works-in-uilicious.md) -* [Automatic waits](core-concepts/automatic-waits.md) - ## How to Guides * Running a test @@ -35,16 +29,26 @@ * [Auto-commits using Github Actions](/how-to-guides/github/saving-projects-to-github.html#auto-commits-using-github-actions) * [Running tests using Github Actions](how-to-guides/github/running-tests-using-github-actions.md) +## Core Concepts + +* [Cross Browser Testing](/core-concepts/cross-browser-testing.md) +* [How Targeting Works in UIlicious](core-concepts/how-targeting-works-in-uilicious.md) +* [Automatic waits](core-concepts/automatic-waits.md) + +## Network Access + +* [Uilicious IP address ranges](reference/configurations/cloud-ip-list.md) + ## Test Scripting Tutorials * [How to test Slider Components](test-scripting-tutorials/testing-slider-components.md) * [How to test iFrames](test-scripting-tutorials/testing-iframes.md) * [How to test Browser Alerts](test-scripting-tutorials/testing-browser-alerts.md) +* How to test 2FA Logins + * [Generating time-based OTPs](plugins/topt-plugin.md) ## Test Commands * [List of commands](reference/commands-list.md) -* Configurations - * [Uilicious IP List](reference/configurations/cloud-ip-list.md) * Page Navigation * [Go to a URL](reference/page-navigation/go-to-a-url.md) * [Refresh / Reload Page](reference/page-navigation/refresh-page.md) From b7651ded7ea2d09cf0c867a020e8f623eee126a5 Mon Sep 17 00:00:00 2001 From: Tai Shi Ling Date: Tue, 30 Apr 2024 18:13:13 +0800 Subject: [PATCH 3/8] Update documentation about IP whitelisting and 502 errors --- reference/configurations/cloud-ip-list.md | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/reference/configurations/cloud-ip-list.md b/reference/configurations/cloud-ip-list.md index 660b1dd..2eceed4 100644 --- a/reference/configurations/cloud-ip-list.md +++ b/reference/configurations/cloud-ip-list.md @@ -1,15 +1,17 @@ --- # Write a short description about the page. This will be displayed on google search results. -description: List of IP that UIlicious uses when running tests. +description: List of IP to whitelist that UIlicious uses when running tests. --- -# Uilicious Cloud IP List +# Whitelisting IP addresses for UI-licious Cross-Browser Testing {% hint style="info" %} -**Good to know:** This is applicable only to UI-licious Cloud users. If you are using UI-licious On Premise, please check with your System Administrator. +This guide is only for UI-licious cloud customer. If you are using a self-hosted installation of UI-licious, please contact your system administrator. {% endhint %} -If you want to filter traffic from the UI-licious test servers (e.g. to disabling Sign In 2FA, or to exclude UI-licious traffic from analytics), here are the list of static IP addresses that UI-licious will run your tests from: +If you are using UI-licious for cross-browser testing, you may need to whitelist our IP addresses to ensure the test browsers can access your application, or to to disable ReCapcha, Two-Factor Authentication (2FA), or analytics specifically for traffic originating from the UI-licious testing grid. + +Here's the list of static IP addresses from which UI-licious will run your tests: ``` 104.248.143.86 @@ -31,3 +33,12 @@ If you want to filter traffic from the UI-licious test servers (e.g. to disablin 188.166.156.193 64.227.33.68 ``` + +## Troubleshooting: 502 Bad Gateway Errors + +If you encounter 502 Bad Gateway errors when the test browser attempts to navigate to your application, it could indicate that the application is inaccessible due to network restrictions. To resolve this: + +1. **Check Network Access Rules**: If your website is behind a firewall, ensure that the IP addresses provided are whitelisted in your network access rules. +2. **Check Public Accessibility**: If your website is not behind a firewall, check that your website is publicly accessible on the internet. + +If the 502 errors persist even after whitelisting the IP addresses or if your website is publicly accessible, please contact [our support team](mailto:support@uilicious.com) for further assistance. From a70a404c0e3772ec5511613508d5c7340223b17e Mon Sep 17 00:00:00 2001 From: Tai Shi Ling Date: Tue, 30 Apr 2024 18:13:42 +0800 Subject: [PATCH 4/8] Formatting --- reference/configurations/cloud-ip-list.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/configurations/cloud-ip-list.md b/reference/configurations/cloud-ip-list.md index 2eceed4..fb9306e 100644 --- a/reference/configurations/cloud-ip-list.md +++ b/reference/configurations/cloud-ip-list.md @@ -36,7 +36,7 @@ Here's the list of static IP addresses from which UI-licious will run your tests ## Troubleshooting: 502 Bad Gateway Errors -If you encounter 502 Bad Gateway errors when the test browser attempts to navigate to your application, it could indicate that the application is inaccessible due to network restrictions. To resolve this: +If you encounter **502 Bad Gateway** errors when the test browser attempts to navigate to your application, it could indicate that the application is inaccessible due to network restrictions. To resolve this: 1. **Check Network Access Rules**: If your website is behind a firewall, ensure that the IP addresses provided are whitelisted in your network access rules. 2. **Check Public Accessibility**: If your website is not behind a firewall, check that your website is publicly accessible on the internet. From 2844cbc52198695cac80989ca587ef62fea66864 Mon Sep 17 00:00:00 2001 From: Tai Shi Ling Date: Thu, 2 May 2024 09:51:04 +0800 Subject: [PATCH 5/8] Add new page on custom validation and logging with information about using TEST.assert --- reference/custom-reporting/custom-logs.md | 59 +++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/reference/custom-reporting/custom-logs.md b/reference/custom-reporting/custom-logs.md index 7d73414..06ead06 100644 --- a/reference/custom-reporting/custom-logs.md +++ b/reference/custom-reporting/custom-logs.md @@ -1,2 +1,61 @@ +--- +# Write a short description about the page. This will be displayed on google search results. +description: Learn how to print custom information or validation messages to the UI-licious test report. +--- + # Custom validation and log messages +This article covers commands that allow you to print custom informational or validation messages to the test report. + +Thera are 4 useful commands for printing custom messages: +- `TEST.log.info` - Print an information message to the test report +- `TEST.log.pass` - Print a message to the test report, with a **success** status +- `TEST.log.fail` - Print a message to the test report, with a **failure** status, causing the whole test run to fail +- `TEST.assert` - Checks a condition, and prints either a **success** or **failure** status message depending on the condition + +## Usage + +```javascript +// TEST.log methods accept a single parameter: +// - message: the message to print to the test report +TEST.log.info(message) +TEST.log.pass(message) +TEST.log.fail(message) + +// TEST.assert accept two parameters: +// - condition : condition to validate, this should be an expression that evaluates to a boolean value +// - message: the validation message to print to the test report +// - errorMessage: (optional) the error message to print if the condition fails +TEST.assert(condition, message) +TEST.assert(condition, message, errorMessage) +``` + +## Using TEST.log for custom logging + +Here's an example showing how custom logs can be used to perform custom validation. + +```javascript +TEST.log.info("Test Case #102 : Catalog should show at least 10 products") + +let count = I.getCount(".product-card") + +if (count >= 10) { + TEST.log.pass("Catalog has at least 10 products.") +} else { + TEST.log.fail("Catalog has less than 10 products!") +} +``` + +In this example above, the test script uses `TEST.log.info` to print a reference to a test case number. It then counts the number of `.product-card` elements on the page, validates if there is at least 10 elements, and prints either a success or failure message using `TEST.log.pass` and `TEST.log.fail` respectively. + +## Using TEST.assert for custom validation and logging + +This previous test script can be simplified using the `TEST.assert` command to replace the if-else block: + +```javascript +TEST.log.info("Test Case #102 : Catalog should show at least 10 products") + +let count = I.getCount(".product-card") + +TEST.assert(count >= 10, "Catalog has at least 10 products.", "Found only " + count + "products in the catalog") +``` From bb7f87da6f8e7867f0c526aa09b18dcbe10ff378 Mon Sep 17 00:00:00 2001 From: Tai Shi Ling Date: Thu, 2 May 2024 09:57:27 +0800 Subject: [PATCH 6/8] Update links to the custom logging pages --- SUMMARY.md | 5 +---- reference/commands-list.md | 7 ++++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/SUMMARY.md b/SUMMARY.md index 3d1cf2f..6cf3488 100644 --- a/SUMMARY.md +++ b/SUMMARY.md @@ -87,10 +87,7 @@ * [Making HTTP Requests](reference/making-http-requests.md) * [Handling downloaded files](reference/handling-downloaded-files.md) * [Taking Screenshots](reference/taking-screenshots.md) -* Custom Reporting - * [Info Logs](reference/custom-reporting/info-logs.md) - * [Success status Logs](reference/custom-reporting/success-status-logs.md) - * [Failure status Logs](reference/custom-reporting/failure-status-logs.md) +* [Custom Reporting](reference/custom-reporting/custom-logs.md) * Dynamic Test Data * [Load test data from File](reference/dynamic-test-data/load-test-data-from-file.md) * [Generate Sample Data](reference/dynamic-test-data/generate-sample-data.md) diff --git a/reference/commands-list.md b/reference/commands-list.md index 9ad0ad8..eeaae96 100644 --- a/reference/commands-list.md +++ b/reference/commands-list.md @@ -179,9 +179,10 @@ description: A list of all commands available in UIlicious | Command | Description | | -------------------------------------------------------------------------- | ------------------------------------------ | -| [`TEST.log.info`](./custom-reporting/info-logs.html#testloginfo) | Log a message to report | -| [`TEST.log.pass`](./custom-reporting/success-status-logs.html#testlogpass) | Log a message to report with `pass` status | -| [`TEST.log.fail`](./custom-reporting/failure-status-logs.html#testlogfail) | Log a message to report with `fail` status | +| [`TEST.log.info`](./custom-reporting/custom-logs.md) | Print an informational message to the test report | +| [`TEST.log.pass`](./custom-reporting/custom-logs.md) | Print a message to the test report, with a **success** status | +| [`TEST.log.fail`](./custom-reporting/custom-logs.md) | Print a message to the test report, with a **failure** status | +| [`TEST.assert`](./custom-reporting/custom-logs.md) | Validates a `condition`, and prints a message to the test report, with a **success** or **failure** status depending whether `condition` returns true or false. | ## Limiting Test Scope From a0a248efcb046b59e104768809d2cf157a0463ae Mon Sep 17 00:00:00 2001 From: Tai Shi Ling Date: Thu, 2 May 2024 10:18:05 +0800 Subject: [PATCH 7/8] Add "page has been moved" notice and redirect rules for old docs pages about custom reporting --- netlify-dist/_redirects_base | 8 +++- .../custom-reporting/failure-status-logs.md | 30 ++------------ reference/custom-reporting/info-logs.md | 41 ++----------------- .../custom-reporting/success-status-logs.md | 35 ++-------------- 4 files changed, 16 insertions(+), 98 deletions(-) diff --git a/netlify-dist/_redirects_base b/netlify-dist/_redirects_base index b1d34d4..ba28923 100644 --- a/netlify-dist/_redirects_base +++ b/netlify-dist/_redirects_base @@ -10,8 +10,12 @@ /v3 /v3/ 302 /index.html /v3/ 302 +# Redirect specific /v3 pages +/v3/reference/custom-reporting/info-logs.html /v3/reference/custom-reporting/custom-logs.html 302 +/v3/reference/custom-reporting/failure-status-logs.html /v3/reference/custom-reporting/custom-logs.html 302 +/v3/reference/custom-reporting/success-status-logs.html /v3/reference/custom-reporting/custom-logs.html 302 + # Redirecting /v1/ URL /v1 https://docs-v1.uilicious.com/ 302 /v1/ https://docs-v1.uilicious.com/ 302 -/v1/* https://docs-v1.uilicious.com/:splat 302 - +/v1/* https://docs-v1.uilicious.com/:splat 302 \ No newline at end of file diff --git a/reference/custom-reporting/failure-status-logs.md b/reference/custom-reporting/failure-status-logs.md index 34bb534..67ad8a0 100644 --- a/reference/custom-reporting/failure-status-logs.md +++ b/reference/custom-reporting/failure-status-logs.md @@ -3,30 +3,8 @@ description: Learn how to use the TEST.log.fail command to log a failing custom report in your UIlicious test. --- -# Failure status Logs + # Failure status logs -Log a message to report with `fail` status using `TEST.log.fail`. This adds to the error count and will result in the overall test failing. - -## Example - -```javascript -if(I.amAt('/notFound')){ - TEST.log.fail("Product page is unavailable") -} -``` - -If the current url is at `/notFound`, prints "Product page is unavailable" to report as a failed validation. - -## Reference - -**Usage** - -```javascript -TEST.log.fail(message) -``` - -**Parameters** - -| Parameter | Type | Remarks | -| --------- | ------ | ------------------------ | -| message | string | Message to log to report | +{% hint style="info" %} +This page has been [moved](./custom-logs.md). +{% endhint %} \ No newline at end of file diff --git a/reference/custom-reporting/info-logs.md b/reference/custom-reporting/info-logs.md index b8c1346..e75f17e 100644 --- a/reference/custom-reporting/info-logs.md +++ b/reference/custom-reporting/info-logs.md @@ -5,41 +5,6 @@ description: Learn how to use the TEST.log.info command to log a custom report i # Info Logs -Log a message to report - -## Example - -{% tabs %} - -{% tab title="Example" %} - -```javascript -I.goTo("https://en.wikipedia.org/wiki/Main_Page") - -// extract text from the ID -var sampleInfo = I.getText("#Welcome_to_Wikipedia") -// Report the extracted text using TEST.log.info -TEST.log.info("The extracted text is: "+ sampleInfo) -``` - -Gets the text from the element with the id "Welcome_to_Wikipedia" and prints it to the report. - -{% endtab %} -{% tab title="Result" %} - - - -{% endtab %} -{% endtabs %} - -**Usage** - -```javascript -TEST.log.info(message) -``` - -**Parameters** - -| Parameter | Type | Remarks | -| --------- | ------ | ------------------------ | -| message | string | Message to log to report | +{% hint style="info" %} +This page has been [moved](./custom-logs.md). +{% endhint %} \ No newline at end of file diff --git a/reference/custom-reporting/success-status-logs.md b/reference/custom-reporting/success-status-logs.md index 7fbfe82..d83ccc3 100644 --- a/reference/custom-reporting/success-status-logs.md +++ b/reference/custom-reporting/success-status-logs.md @@ -5,35 +5,6 @@ description: Learn how to use the TEST.log.pass command to log a passing custom # Success status Logs -Log a message to report with `pass` status using `TEST.log.pass` command. - -## Example - -{% tabs %} - -{% tab title="Example" %} - -```javascript -I.click("Clear all") -var numTodos = I.getCount(".todo") -if(numTodos === 0){ - TEST.log.pass("No more todos!") -} -``` - -Clears all items in a todo list, and count the number of elements with the "todo" class. If there's no more todos, prints "No more todos!" as a passed validation. - -{% endtab %} -{% endtabs %} - -**Usage** - -```javascript -TEST.log.pass(message) -``` - -**Parameters** - -| Parameter | Type | Remarks | -| --------- | ------ | ------------------------ | -| message | string | Message to log to report | +{% hint style="info" %} +This page has been [moved](./custom-logs.md). +{% endhint %} \ No newline at end of file From 085eb559e0cd3b21532da6cc8e0a96f46dec275d Mon Sep 17 00:00:00 2001 From: Tai Shi Ling Date: Thu, 2 May 2024 10:32:07 +0800 Subject: [PATCH 8/8] Add examples --- reference/custom-reporting/custom-logs.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/reference/custom-reporting/custom-logs.md b/reference/custom-reporting/custom-logs.md index 06ead06..b6f1ecb 100644 --- a/reference/custom-reporting/custom-logs.md +++ b/reference/custom-reporting/custom-logs.md @@ -48,6 +48,16 @@ if (count >= 10) { In this example above, the test script uses `TEST.log.info` to print a reference to a test case number. It then counts the number of `.product-card` elements on the page, validates if there is at least 10 elements, and prints either a success or failure message using `TEST.log.pass` and `TEST.log.fail` respectively. + +{% tabs %} +{% tab title="Demo" %} + + +[View source](https://snippet.uilicious.com/test/public/LTXpHdGsnScXhi8EiKqN9a?step=5) +{% endtab %} +{% endtabs %} + + ## Using TEST.assert for custom validation and logging This previous test script can be simplified using the `TEST.assert` command to replace the if-else block: @@ -59,3 +69,11 @@ let count = I.getCount(".product-card") TEST.assert(count >= 10, "Catalog has at least 10 products.", "Found only " + count + "products in the catalog") ``` + +{% tabs %} +{% tab title="Demo" %} + + +[View source](https://snippet.uilicious.com/test/public/AE3iRxPSQNQw7Jw5HAWZqa?step=7) +{% endtab %} +{% endtabs %} \ No newline at end of file