From a164003acae141346a72f55d6b7912e71dac6d33 Mon Sep 17 00:00:00 2001 From: Leopoldthecoder Date: Wed, 25 Oct 2023 16:10:34 +0800 Subject: [PATCH] fix(*): service query endpoint --- package.json | 2 +- .../playwright/specs/routes/01-Routes.spec.ts | 38 +++++++++---------- yarn.lock | 36 +++++++++++++++++- 3 files changed, 55 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index e3484ae..6fdbaad 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "@kong-ui-public/entities-key-sets": "^1.2.5", "@kong-ui-public/entities-keys": "^1.2.5", "@kong-ui-public/entities-plugins": "^1.4.6", - "@kong-ui-public/entities-routes": "^1.1.2", + "@kong-ui-public/entities-routes": "^1.2.11", "@kong-ui-public/entities-shared": "^1.2.4", "@kong-ui-public/entities-snis": "^1.1.36", "@kong-ui-public/entities-upstreams-targets": "^1.3.5", diff --git a/tests/playwright/specs/routes/01-Routes.spec.ts b/tests/playwright/specs/routes/01-Routes.spec.ts index 40dc358..e472bf8 100644 --- a/tests/playwright/specs/routes/01-Routes.spec.ts +++ b/tests/playwright/specs/routes/01-Routes.spec.ts @@ -219,7 +219,7 @@ test.describe('routes', () => { test(`view the route "${mockRouteName}" detail page`, async ({ page }) => { await withNavigation(page, async () => await clickEntityListAction(page, 'view')) - await expect(page.getByTestId('name-property-value')).toHaveText(mockRouteName) + await expect(page.getByTestId('name-property-value')).toContainText(mockRouteName) }) test('routes show - links to service with a name', async ({ page }) => { @@ -227,7 +227,7 @@ test.describe('routes', () => { await page.getByTestId('service-property-value').locator('.navigation-button').click() - await expect(page.getByTestId('name-property-value')).toHaveText(mockServiceName) + await expect(page.getByTestId('name-property-value')).toContainText(mockServiceName) }) test(`cancel the route "${mockRouteName}" editing`, async ({ page }) => { @@ -385,9 +385,9 @@ test.describe('routes', () => { } }, data, async () => { - await expect(page.getByTestId('strip_path-property-value')).toHaveText(`${isStripPath}`) - await expect(page.getByTestId('methods-property-value')).toHaveText(['GET']) - await expect(page.getByTestId('tags-property-value')).toHaveText(['tag1tag2']) + await expect(page.getByTestId('strip_path-property-value')).toContainText(`${isStripPath}`) + await expect(page.getByTestId('methods-property-value')).toContainText(['GET']) + await expect(page.getByTestId('tags-property-value')).toContainText(['tag1tag2']) }) } }) @@ -421,9 +421,9 @@ test.describe('routes', () => { await expect(page.getByTestId('route-form-strip-path')).not.toBeVisible() }, data, async () => { - await expect(page.getByTestId('protocols-property-value')).toHaveText(`${protocol}`.replace(',', '')) - await expect(page.getByTestId('methods-property-value')).toHaveText(' – ') // todo: this property should not visible here - await expect(page.getByTestId('strip_path-property-value')).toHaveText('false') // todo: this property should not visible here + await expect(page.getByTestId('protocols-property-value')).toContainText(`${protocol}`.replace(',', '')) + await expect(page.getByTestId('methods-property-value')).toContainText(' – ') // todo: this property should not visible here + await expect(page.getByTestId('strip_path-property-value')).toContainText('false') // todo: this property should not visible here }) } }) @@ -460,9 +460,9 @@ test.describe('routes', () => { await page.getByTestId('route-form-sources-port-input-2').fill('4321') }, data, async () => { - await expect(page.getByTestId('protocols-property-value')).toHaveText(`${protocol}`.replace(/,/g, '')) - await expect(page.getByTestId('methods-property-value')).toHaveText(' – ') // todo: this property should not visible here - await expect(page.getByTestId('hosts-property-value')).toHaveText(' – ') // todo: this property should not visible here + await expect(page.getByTestId('protocols-property-value')).toContainText(`${protocol}`.replace(/,/g, '')) + await expect(page.getByTestId('methods-property-value')).toContainText(' – ') // todo: this property should not visible here + await expect(page.getByTestId('hosts-property-value')).toContainText(' – ') // todo: this property should not visible here }) } }) @@ -495,9 +495,9 @@ test.describe('routes', () => { await selectMethods(page, ['GET']) }, data, async () => { - await expect(page.getByTestId('protocols-property-value')).toHaveText('http') - await expect(page.getByTestId('methods-property-value')).toHaveText(['GET']) - await expect(page.getByTestId('sources-property-value')).toHaveText(' – ') // todo: this property should not visible here + await expect(page.getByTestId('protocols-property-value')).toContainText('http') + await expect(page.getByTestId('methods-property-value')).toContainText(['GET']) + await expect(page.getByTestId('sources-property-value')).toContainText(' – ') // todo: this property should not visible here }) }) @@ -512,7 +512,7 @@ test.describe('routes', () => { await fillArrayField(page, 'hosts', ['localhost']) }, data, async () => { - await expect(page.getByTestId('protocols-property-value')).toHaveText('httphttps') + await expect(page.getByTestId('protocols-property-value')).toContainText('httphttps') }) }) @@ -528,7 +528,7 @@ test.describe('routes', () => { await fillArrayField(page, 'hosts', ['localhost']) }, data, async () => { - await expect(page.getByTestId('protocols-property-value')).toHaveText('https') + await expect(page.getByTestId('protocols-property-value')).toContainText('https') }) }) @@ -544,7 +544,7 @@ test.describe('routes', () => { await fillArrayField(page, 'paths', ['/kong(-ee){0,1}.com'], true) }, data, async () => { - await expect(page.getByTestId('paths-property-value')).toHaveText(['/kong(-ee){0,1}.com']) + await expect(page.getByTestId('paths-property-value')).toContainText(['/kong(-ee){0,1}.com']) }) }) @@ -559,7 +559,7 @@ test.describe('routes', () => { await selectMethods(page, ['GET']) }, data, async () => { - await expect(page.getByTestId('service-property-value')).toHaveText(serviceWithNoName.id) + await expect(page.getByTestId('service-property-value')).toContainText(serviceWithNoName.id) }) }) @@ -609,6 +609,6 @@ test.describe('routes', () => { await page.goto(`/routes/${route?.data.id}`) - await expect(page.getByTestId('service-property-value')).toHaveText('-') + await expect(page.getByTestId('service-property-value')).toContainText('-') }) }) diff --git a/yarn.lock b/yarn.lock index 9069de4..af43d5b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -346,6 +346,11 @@ resolved "https://registry.yarnpkg.com/@kong-ui-public/copy-uuid/-/copy-uuid-1.3.1.tgz#22010052c588157738a33d45739c2330a6b8b57f" integrity sha512-2w53UHf0Ylq9zbUSWO+wgVP26DUupZ0ddAK7CR44VRYBYXR5SIi0qeu/h/3936RB0rNQ3Tyk5xMUMdMkMkS56Q== +"@kong-ui-public/copy-uuid@^1.3.4": + version "1.3.4" + resolved "https://registry.yarnpkg.com/@kong-ui-public/copy-uuid/-/copy-uuid-1.3.4.tgz#fd19eb6aee69f8876cb2b78357b8da961e76a830" + integrity sha512-gIE4y4jyWWkY2wFdE4HMsCQJveyD8UBdvLjL1MB4E3hwOcakTnpjxm4XiA6JML9SCjqbrGe9CUTANle22yutgw== + "@kong-ui-public/core@^1.4.1": version "1.4.1" resolved "https://registry.yarnpkg.com/@kong-ui-public/core/-/core-1.4.1.tgz#ab3c91763fc033c725697d11bdce561eb852ae6d" @@ -353,6 +358,13 @@ dependencies: date-fns "^2.30.0" +"@kong-ui-public/core@^1.4.3": + version "1.4.3" + resolved "https://registry.yarnpkg.com/@kong-ui-public/core/-/core-1.4.3.tgz#4634e6a8a96e43e71dc95fda0e6971a698846e59" + integrity sha512-pyiVpPt0q9fz+akYbmHQshxOPboy6HGtPE6BAs9TPuWBAEVKhlDL8KsdhO9LSkp0juom8DLCRd9HOv/eAIXf+Q== + dependencies: + date-fns "^2.30.0" + "@kong-ui-public/entities-certificates@^1.3.5": version "1.3.5" resolved "https://registry.yarnpkg.com/@kong-ui-public/entities-certificates/-/entities-certificates-1.3.5.tgz#906634c907ba1aa4ba128fcb57a49870471c4f5a" @@ -416,7 +428,14 @@ "@kong-ui-public/entities-routes" "^1.2.5" "@kong-ui-public/entities-shared" "^1.6.3" -"@kong-ui-public/entities-routes@^1.1.2", "@kong-ui-public/entities-routes@^1.2.5": +"@kong-ui-public/entities-routes@^1.2.11": + version "1.2.11" + resolved "https://registry.yarnpkg.com/@kong-ui-public/entities-routes/-/entities-routes-1.2.11.tgz#d186e13d92237ceaefe8daf55e2b243026cc0798" + integrity sha512-Q2DDPPeiLXbf/fJM/LidXThWlW5z/iQ/HFdpPdwJbzaOUAMTqwUgsr/sLhfYeXNZuFHqCfAFsvkn/aQeTkT4uQ== + dependencies: + "@kong-ui-public/entities-shared" "^1.6.8" + +"@kong-ui-public/entities-routes@^1.2.5": version "1.2.5" resolved "https://registry.yarnpkg.com/@kong-ui-public/entities-routes/-/entities-routes-1.2.5.tgz#83d9bbc123b29d1ff49def178c4749b0b399c106" integrity sha512-nopHhZ+tzS/gNVC91G0jCQ1gNgjBlZpCFxpHSS2l1PxIOoO1fzupsClC8EW46KiwJdKX+jXpb+AE+QLiASLSyQ== @@ -433,6 +452,16 @@ "@kong/icons" "^1.7.6" compare-versions "^6.1.0" +"@kong-ui-public/entities-shared@^1.6.8": + version "1.6.8" + resolved "https://registry.yarnpkg.com/@kong-ui-public/entities-shared/-/entities-shared-1.6.8.tgz#74d50af1aa8a438c11394c89b450bc4b248501bc" + integrity sha512-Q1brhiBQ5P298Xa4ByzrbCKEf+ldT0OEGAXPrmK7MabZ7bUhNcs67Z7M3IORqMzU5odnS2jsCOd8BNgRWCYEcg== + dependencies: + "@kong-ui-public/copy-uuid" "^1.3.4" + "@kong-ui-public/core" "^1.4.3" + "@kong/icons" "^1.7.7" + compare-versions "^6.1.0" + "@kong-ui-public/entities-snis@^1.1.36": version "1.1.36" resolved "https://registry.yarnpkg.com/@kong-ui-public/entities-snis/-/entities-snis-1.1.36.tgz#bdfdb51fc68c012f1a75a57a2ffe0fb531e18827" @@ -487,6 +516,11 @@ resolved "https://registry.yarnpkg.com/@kong/icons/-/icons-1.7.6.tgz#e3b210f7d326ae2082a10e0bbc437cce86012685" integrity sha512-1/hyEJGpfI1j7LIM1HjWBCoUlFyhWoj9fAOZsJKX70C87XkCzEfxutD2eeSvE7KZe688oDnx7jXSiSouyly5BA== +"@kong/icons@^1.7.7": + version "1.7.7" + resolved "https://registry.yarnpkg.com/@kong/icons/-/icons-1.7.7.tgz#fbf11f02830ffb4319e7c20248e09ae1421c5bab" + integrity sha512-CQHOXZ/S0SRTjW43ItRKFoA9e+roW/jh8vXE1X0HVHDy0LAymvX9nadoVUmtdjNHQnJvr4XZfGgdyXE+fYh6Fw== + "@kong/kongponents@^8.123.9": version "8.123.9" resolved "https://registry.yarnpkg.com/@kong/kongponents/-/kongponents-8.123.9.tgz#b35f1470143e3e80f886eabcf7b61e74363abf20"