Skip to content

Commit

Permalink
Merge branch 'update-docs-2024-04-30' into 'main'
Browse files Browse the repository at this point in the history
Update documentation

See merge request documentation/uilicious-docs-v3!46
  • Loading branch information
Tai Shi Ling committed May 2, 2024
2 parents 9958f4a + 085eb55 commit feb5213
Show file tree
Hide file tree
Showing 8 changed files with 127 additions and 117 deletions.
25 changes: 13 additions & 12 deletions SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -83,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)
Expand Down
8 changes: 6 additions & 2 deletions netlify-dist/_redirects_base
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 4 additions & 3 deletions reference/commands-list.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a href="#limiting-test-scope" id="limiting-test-scope"></a>

Expand Down
19 changes: 15 additions & 4 deletions reference/configurations/cloud-ip-list.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
79 changes: 79 additions & 0 deletions reference/custom-reporting/custom-logs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
# 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.


{% tabs %}
{% tab title="Demo" %}
<iframe src="https://snippet.uilicious.com/embed/test/public/LTXpHdGsnScXhi8EiKqN9a?stepNum=5&autoplay=0" frameborder="0" width="100%" height="400px;"></iframe>

[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:

```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")
```

{% tabs %}
{% tab title="Demo" %}
<iframe src="https://snippet.uilicious.com/embed/test/public/AE3iRxPSQNQw7Jw5HAWZqa?stepNum=7&autoplay=0" frameborder="0" width="100%" height="400px;"></iframe>

[View source](https://snippet.uilicious.com/test/public/AE3iRxPSQNQw7Jw5HAWZqa?step=7)
{% endtab %}
{% endtabs %}
30 changes: 4 additions & 26 deletions reference/custom-reporting/failure-status-logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
41 changes: 3 additions & 38 deletions reference/custom-reporting/info-logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -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" %}

<iframe title='log-a-message-1' src="https://snippet.uilicious.com/embed/test/public/6JPz1uQdvXoWYT5ocLYg4D?stepNum=1&autoplay=0" style="display: block; min-width: 600px; min-height: 400px; margin: 0 auto; border: none;"></iframe>

{% 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 %}
35 changes: 3 additions & 32 deletions reference/custom-reporting/success-status-logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}

0 comments on commit feb5213

Please sign in to comment.