Skip to content

Commit c75c3e1

Browse files
committed
chore: merge from feature/improve-localhost-run-test to develop
2 parents 876352d + 52cd96a commit c75c3e1

File tree

5 files changed

+51
-25
lines changed

5 files changed

+51
-25
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# APIHUB UI auto-tests
22
This project is used to create and run auto-tests, primarily for UI E2E. The framework used is [Playwright](https://playwright.dev/).
33

4+
[Features of running on a **localhost**](docs/localhost-run.md)
5+
46
## Contents
57
- [Installation](#installation)
68
- [Environment variables](#environment-variables)
@@ -26,7 +28,7 @@ Before starting test execution, you need to set environment variables in any con
2628

2729
**TEST_USER_PASSWORD** - The password that will be used by test users.
2830

29-
**PLAYGROUND_BACKEND_HOST** - Only Required for testing on **localhost**. The host that will be used in the test to create a custom server for sending requests. More information can be found at the [link](https://github.com/Netcracker/qubership-apihub/issues/18).
31+
**PLAYGROUND_BACKEND_HOST** - Only Required for testing on **localhost**. The host that will be used in the test to create a custom server for sending requests. More information can be found at the [link](docs/localhost-run.md).
3032

3133
**DEV_PROXY_MODE** - Only Required for testing on **localhost** in dev proxy mode.
3234

docs/localhost-run.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Features of running on a localhost
2+
To test the "Playground" via a localhost, in playwright tests, you need to set a value for the `PLAYGROUND_BACKEND_HOST` environment variable, it will be used in the test to create a custom server for sending requests.
3+
In case of using Docker Compose, this is `http://host.docker.internal:8081` (protocol + value of the `APIHUB_URL` variable from the [qubership-apihub-backend.env](https://github.com/Netcracker/qubership-apihub/blob/main/docker-compose/qubership-apihub-backend.env) file). Also, you need to add the variable `ALLOWED_HOSTS=host.docker.internal` to the [qubership-apihub-backend.env](https://github.com/Netcracker/qubership-apihub/blob/main/docker-compose/qubership-apihub-backend.env) file.
4+
5+
In case of using docker compose + dev proxy, in addition to the previous settings, in playwright tests, you need to add the variable `DEV_PROXY_MODE=true`, to skip tests that cannot be executed in this mode.
6+
7+
8+
| | Live environment | Docker compose | Docker compose + dev proxy |
9+
| --------------------------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------- |
10+
| Playground tests | ✔️ | ✔️ `ALLOWED_HOSTS=host.docker.internal` - in docker compose<br>`PLAYGROUND_BACKEND_HOST=http://host.docker.internal:8081` - in tests | ✔️ `ALLOWED_HOSTS=host.docker.internal` - in docker compose<br>`PLAYGROUND_BACKEND_HOST=http://host.docker.internal:8081` - in test |
11+
| Tests with rediretcs to the Agent | ✔️ | ✔️ | ❌ Skipped with `DEV_PROXY_MODE=true` - in tests |
12+
| Expand/collapse the Package page sidebar test | ✔️ | ✔️ | ❌ Skipped with `DEV_PROXY_MODE=true` - in tests |

package-lock.json

Lines changed: 31 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/tests/portal/01-general/1.2-general.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { getSysInfo } from '@test-data/props'
2020
import { AgentPage } from '@agent/pages'
2121
import { PortalPage } from '@portal/pages'
2222
import { MIDDLE_EXPECT, TICKET_BASE_URL } from '@test-setup'
23-
import { isLocalHost } from '@services/utils'
23+
import { isDevProxyMode } from '@services/utils'
2424

2525
test.describe('General', () => {
2626

@@ -53,7 +53,7 @@ test.describe('General', () => {
5353
annotation: { type: 'Test Case', description: `${TICKET_BASE_URL}TestCase-A-4279` },
5454
},
5555
async ({ sysadminPage: page }) => {
56-
test.skip(isLocalHost(), 'Does not support localhost execution')
56+
test.skip(isDevProxyMode(), 'Does not support dev proxy mode')
5757

5858
const portalPage = new PortalPage(page)
5959
const agentPage = new AgentPage(page)

src/tests/portal/04-entity-actions/4.3.2-package-editing-publishing.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import {
4141
V_P_PKG_EDITING_SEARCH_R,
4242
} from '@test-data/portal'
4343
import { PUBLISH_TIMEOUT, TICKET_BASE_URL } from '@test-setup'
44-
import { isLocalHost } from '@services/utils'
44+
import { isDevProxyMode } from '@services/utils'
4545

4646
test.describe('4.3.2 Package publishing via Portal', () => {
4747

@@ -66,8 +66,8 @@ test.describe('4.3.2 Package publishing via Portal', () => {
6666
await expect(configureVersionTab.filesUploader).toBeVisible()
6767
})
6868

69-
//Does not support localhost execution
70-
if (!isLocalHost()) {
69+
//Does not support dev proxy mode
70+
if (!isDevProxyMode()) {
7171
await test.step('Agent option', async () => {
7272
await portalPage.gotoPackage(testPackage)
7373
await versionPage.howToUploadBtn.click()

0 commit comments

Comments
 (0)