Skip to content

Commit

Permalink
fix e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cars10 committed Sep 11, 2024
1 parent 9558ceb commit 0dc52a6
Show file tree
Hide file tree
Showing 18 changed files with 49 additions and 40 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ build_browser_extensions:

run_docker_nginx:
docker run -p 8080:8080 elasticvue

e2e: build_docker_ci
docker run --rm -v ./playwright-report-ci:/app/playwright-report elasticvue-ci yarn test:e2e $(TEST)
2 changes: 1 addition & 1 deletion scripts/mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ exports.mock = async page => {
json: { '_shards': { 'total': 50, 'successful': 50, 'failed': 0 } }
},
catNodes: {
url: 'http://localhost:9200/_cat/nodes?h=ip%2Cid%2Cname%2Cheap.percent%2Cheap.current%2Cheap.max%2Cram.percent%2Cram.current%2Cram.max%2Cnode.role%2Cmaster%2Ccpu%2Cload_1m%2Cload_5m%2Cload_15m%2Cdisk.used_percent%2Cdisk.used%2Cdisk.total&full_id=true',
url: 'http://localhost:9200/_cat/nodes?h=ip%2Cid%2Cname%2Cversion%2Cheap.percent%2Cheap.current%2Cheap.max%2Cram.percent%2Cram.current%2Cram.max%2Cnode.role%2Cmaster%2Ccpu%2Cload_1m%2Cload_5m%2Cload_15m%2Cdisk.used_percent%2Cdisk.used%2Cdisk.total&full_id=true',
json: [
{
'ip': '192.168.112.1',
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/mocks/elastic_1/home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ export const mockElasticHome = async (page: Page, { health }: { health?: string
}

for (const method in mocks) {
const url = mocks[method].url
const json = mocks[method].json
const url = mocks[method as keyof typeof mocks].url
const json = mocks[method as keyof typeof mocks].json

await page.route(url, async route => (await route.fulfill({ json })))
}
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/mocks/elastic_1/indices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export const mockElasticIndices = async (page: Page) => {
}

for (const method in mocks) {
const url = mocks[method].url
const json = mocks[method].json
const url = mocks[method as keyof typeof mocks].url
const json = mocks[method as keyof typeof mocks].json

await page.route(url, async route => (await route.fulfill({ json })))
}
Expand Down
7 changes: 4 additions & 3 deletions tests/e2e/mocks/elastic_1/nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ import { Page } from '@playwright/test'
export const mockElasticNodes = async (page: Page) => {
const mocks = {
catNodes: {
url: 'http://localhost:9200/_cat/nodes?h=ip%2Cid%2Cname%2Cheap.percent%2Cheap.current%2Cheap.max%2Cram.percent%2Cram.current%2Cram.max%2Cnode.role%2Cmaster%2Ccpu%2Cload_1m%2Cload_5m%2Cload_15m%2Cdisk.used_percent%2Cdisk.used%2Cdisk.total&full_id=true',
url: 'http://localhost:9200/_cat/nodes?h=ip%2Cid%2Cname%2Cversion%2Cheap.percent%2Cheap.current%2Cheap.max%2Cram.percent%2Cram.current%2Cram.max%2Cnode.role%2Cmaster%2Ccpu%2Cload_1m%2Cload_5m%2Cload_15m%2Cdisk.used_percent%2Cdisk.used%2Cdisk.total&full_id=true',
json: [
{
'ip': '192.168.48.2',
'id': 'tz7KYbj8RSeyum3J-v4VZQ',
'name': 'es-1-node-1',
'version': '1.7.6',
'heap.percent': '6',
'heap.current': '59.7mb',
'heap.max': '989.8mb',
Expand Down Expand Up @@ -39,8 +40,8 @@ export const mockElasticNodes = async (page: Page) => {
}

for (const method in mocks) {
const url = mocks[method].url
const json = mocks[method].json
const url = mocks[method as keyof typeof mocks].url
const json = mocks[method as keyof typeof mocks].json

await page.route(url, async route => (await route.fulfill({ json })))
}
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/mocks/elastic_2/home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ export const mockElasticHome = async (page: Page, { health }: { health?: string
}

for (const method in mocks) {
const url = mocks[method].url
const json = mocks[method].json
const url = mocks[method as keyof typeof mocks].url
const json = mocks[method as keyof typeof mocks].json

await page.route(url, async route => (await route.fulfill({ json })))
}
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/mocks/elastic_2/indices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export const mockElasticIndices = async (page: Page) => {
}

for (const method in mocks) {
const url = mocks[method].url
const json = mocks[method].json
const url = mocks[method as keyof typeof mocks].url
const json = mocks[method as keyof typeof mocks].json

await page.route(url, async route => (await route.fulfill({ json })))
}
Expand Down
7 changes: 4 additions & 3 deletions tests/e2e/mocks/elastic_2/nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ import { Page } from '@playwright/test'
export const mockElasticNodes = async (page: Page) => {
const mocks = {
catNodes: {
url: 'http://localhost:9200/_cat/nodes?h=ip%2Cid%2Cname%2Cheap.percent%2Cheap.current%2Cheap.max%2Cram.percent%2Cram.current%2Cram.max%2Cnode.role%2Cmaster%2Ccpu%2Cload_1m%2Cload_5m%2Cload_15m%2Cdisk.used_percent%2Cdisk.used%2Cdisk.total&full_id=true',
url: 'http://localhost:9200/_cat/nodes?h=ip%2Cid%2Cname%2Cversion%2Cheap.percent%2Cheap.current%2Cheap.max%2Cram.percent%2Cram.current%2Cram.max%2Cnode.role%2Cmaster%2Ccpu%2Cload_1m%2Cload_5m%2Cload_15m%2Cdisk.used_percent%2Cdisk.used%2Cdisk.total&full_id=true',
json: [
{
'ip': '192.168.16.2',
'id': '0tgdUvIbSOCHzADG18paPQ',
'name': 'es-2-node-1',
'version': '2.4.6',
'heap.percent': '4',
'heap.current': '47mb',
'heap.max': '989.8mb',
Expand Down Expand Up @@ -40,8 +41,8 @@ export const mockElasticNodes = async (page: Page) => {
}

for (const method in mocks) {
const url = mocks[method].url
const json = mocks[method].json
const url = mocks[method as keyof typeof mocks].url
const json = mocks[method as keyof typeof mocks].json

await page.route(url, async route => (await route.fulfill({ json })))
}
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/mocks/elastic_5/home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ export const mockElasticHome = async (page: Page, { health }: { health?: string
}

for (const method in mocks) {
const url = mocks[method].url
const json = mocks[method].json
const url = mocks[method as keyof typeof mocks].url
const json = mocks[method as keyof typeof mocks].json

await page.route(url, async route => (await route.fulfill({ json })))
}
Expand Down
7 changes: 4 additions & 3 deletions tests/e2e/mocks/elastic_5/nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ import { Page } from '@playwright/test'
export const mockElasticNodes = async (page: Page) => {
const mocks = {
catNodes: {
url: 'http://localhost:9200/_cat/nodes?h=ip%2Cid%2Cname%2Cheap.percent%2Cheap.current%2Cheap.max%2Cram.percent%2Cram.current%2Cram.max%2Cnode.role%2Cmaster%2Ccpu%2Cload_1m%2Cload_5m%2Cload_15m%2Cdisk.used_percent%2Cdisk.used%2Cdisk.total&full_id=true',
url: 'http://localhost:9200/_cat/nodes?h=ip%2Cid%2Cname%2Cversion%2Cheap.percent%2Cheap.current%2Cheap.max%2Cram.percent%2Cram.current%2Cram.max%2Cnode.role%2Cmaster%2Ccpu%2Cload_1m%2Cload_5m%2Cload_15m%2Cdisk.used_percent%2Cdisk.used%2Cdisk.total&full_id=true',
json: [
{
'ip': '192.168.112.2',
'id': '80VY7GdJQ266bnC3oX_gSw',
'name': 'es-5-node-1',
'version': '5.6.16',
'heap.percent': '21',
'heap.current': '431.2mb',
'heap.max': '1.9gb',
Expand Down Expand Up @@ -47,8 +48,8 @@ export const mockElasticNodes = async (page: Page) => {
}

for (const method in mocks) {
const url = mocks[method].url
const json = mocks[method].json
const url = mocks[method as keyof typeof mocks].url
const json = mocks[method as keyof typeof mocks].json

await page.route(url, async route => (await route.fulfill({ json })))
}
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/mocks/elastic_6/home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ export const mockElasticHome = async (page: Page, { health }: { health?: string
}

for (const method in mocks) {
const url = mocks[method].url
const json = mocks[method].json
const url = mocks[method as keyof typeof mocks].url
const json = mocks[method as keyof typeof mocks].json

await page.route(url, async route => (await route.fulfill({ json })))
}
Expand Down
7 changes: 4 additions & 3 deletions tests/e2e/mocks/elastic_6/nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ import { Page } from '@playwright/test'
export const mockElasticNodes = async (page: Page) => {
const mocks = {
catNodes: {
url: 'http://localhost:9200/_cat/nodes?h=ip%2Cid%2Cname%2Cheap.percent%2Cheap.current%2Cheap.max%2Cram.percent%2Cram.current%2Cram.max%2Cnode.role%2Cmaster%2Ccpu%2Cload_1m%2Cload_5m%2Cload_15m%2Cdisk.used_percent%2Cdisk.used%2Cdisk.total&full_id=true',
url: 'http://localhost:9200/_cat/nodes?h=ip%2Cid%2Cname%2Cversion%2Cheap.percent%2Cheap.current%2Cheap.max%2Cram.percent%2Cram.current%2Cram.max%2Cnode.role%2Cmaster%2Ccpu%2Cload_1m%2Cload_5m%2Cload_15m%2Cdisk.used_percent%2Cdisk.used%2Cdisk.total&full_id=true',
json: [
{
'ip': '192.168.64.4',
'id': 'o8NZD5umQdiBmKWIXd_Ueg',
'name': 'es-6-node-2',
'version': '6.8.2',
'heap.percent': '57',
'heap.current': '286.1mb',
'heap.max': '494.9mb',
Expand Down Expand Up @@ -75,8 +76,8 @@ export const mockElasticNodes = async (page: Page) => {
}

for (const method in mocks) {
const url = mocks[method].url
const json = mocks[method].json
const url = mocks[method as keyof typeof mocks].url
const json = mocks[method as keyof typeof mocks].json

await page.route(url, async route => (await route.fulfill({ json })))
}
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/mocks/elastic_7/home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ export const mockElasticHome = async (page: Page, { health }: { health?: string
}

for (const method in mocks) {
const url = mocks[method].url
const json = mocks[method].json
const url = mocks[method as keyof typeof mocks].url
const json = mocks[method as keyof typeof mocks].json

await page.route(url, async route => (await route.fulfill({ json })))
}
Expand Down
7 changes: 4 additions & 3 deletions tests/e2e/mocks/elastic_7/nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ import { Page } from '@playwright/test'
export const mockElasticNodes = async (page: Page) => {
const mocks = {
catNodes: {
url: 'http://localhost:9200/_cat/nodes?h=ip%2Cid%2Cname%2Cheap.percent%2Cheap.current%2Cheap.max%2Cram.percent%2Cram.current%2Cram.max%2Cnode.role%2Cmaster%2Ccpu%2Cload_1m%2Cload_5m%2Cload_15m%2Cdisk.used_percent%2Cdisk.used%2Cdisk.total&full_id=true',
url: 'http://localhost:9200/_cat/nodes?h=ip%2Cid%2Cname%2Cversion%2Cheap.percent%2Cheap.current%2Cheap.max%2Cram.percent%2Cram.current%2Cram.max%2Cnode.role%2Cmaster%2Ccpu%2Cload_1m%2Cload_5m%2Cload_15m%2Cdisk.used_percent%2Cdisk.used%2Cdisk.total&full_id=true',
json: [
{
'ip': '192.168.80.2',
'id': 'g72ugSyySjOyRkmiMQ0zYQ',
'name': 'es-7-node-1',
'version': '7.17.10',
'heap.percent': '33',
'heap.current': '174mb',
'heap.max': '512mb',
Expand Down Expand Up @@ -76,8 +77,8 @@ export const mockElasticNodes = async (page: Page) => {
}

for (const method in mocks) {
const url = mocks[method].url
const json = mocks[method].json
const url = mocks[method as keyof typeof mocks].url
const json = mocks[method as keyof typeof mocks].json

await page.route(url, async route => (await route.fulfill({ json })))
}
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/mocks/elastic_8/home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ export const mockElasticHome = async (page: Page, { health }: { health?: string
}

for (const method in mocks) {
const url = mocks[method].url
const json = mocks[method].json
const url = mocks[method as keyof typeof mocks].url
const json = mocks[method as keyof typeof mocks].json

await page.route(url, async route => (await route.fulfill({ json })))
}
Expand Down
7 changes: 4 additions & 3 deletions tests/e2e/mocks/elastic_8/nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ import { Page } from '@playwright/test'
export const mockElasticNodes = async (page: Page) => {
const mocks = {
catNodes: {
url: 'http://localhost:9200/_cat/nodes?h=ip%2Cid%2Cname%2Cheap.percent%2Cheap.current%2Cheap.max%2Cram.percent%2Cram.current%2Cram.max%2Cnode.role%2Cmaster%2Ccpu%2Cload_1m%2Cload_5m%2Cload_15m%2Cdisk.used_percent%2Cdisk.used%2Cdisk.total&full_id=true',
url: 'http://localhost:9200/_cat/nodes?h=ip%2Cid%2Cname%2Cversion%2Cheap.percent%2Cheap.current%2Cheap.max%2Cram.percent%2Cram.current%2Cram.max%2Cnode.role%2Cmaster%2Ccpu%2Cload_1m%2Cload_5m%2Cload_15m%2Cdisk.used_percent%2Cdisk.used%2Cdisk.total&full_id=true',
json: [
{
'ip': '192.168.32.2',
'id': 'hrFoHMcpTD-2QseKkE8W3Q',
'name': 'es-8-node-1',
'version': '8.7.1',
'heap.percent': '45',
'heap.current': '230.6mb',
'heap.max': '512mb',
Expand Down Expand Up @@ -47,8 +48,8 @@ export const mockElasticNodes = async (page: Page) => {
}

for (const method in mocks) {
const url = mocks[method].url
const json = mocks[method].json
const url = mocks[method as keyof typeof mocks].url
const json = mocks[method as keyof typeof mocks].json

await page.route(url, async route => (await route.fulfill({ json })))
}
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/mocks/opensearch_2/home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ export const mockElasticHome = async (page: Page, { health }: { health?: string
}

for (const method in mocks) {
const url = mocks[method].url
const json = mocks[method].json
const url = mocks[method as keyof typeof mocks].url
const json = mocks[method as keyof typeof mocks].json

await page.route(url, async route => (await route.fulfill({ json })))
}
Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/mocks/opensearch_2/nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Page } from '@playwright/test'
export const mockElasticNodes = async (page: Page) => {
const mocks = {
catNodes: {
url: 'http://localhost:9200/_cat/nodes?h=ip%2Cid%2Cname%2Cheap.percent%2Cheap.current%2Cheap.max%2Cram.percent%2Cram.current%2Cram.max%2Cnode.role%2Cmaster%2Ccpu%2Cload_1m%2Cload_5m%2Cload_15m%2Cdisk.used_percent%2Cdisk.used%2Cdisk.total&full_id=true',
url: 'http://localhost:9200/_cat/nodes?h=ip%2Cid%2Cname%2Cversion%2Cheap.percent%2Cheap.current%2Cheap.max%2Cram.percent%2Cram.current%2Cram.max%2Cnode.role%2Cmaster%2Ccpu%2Cload_1m%2Cload_5m%2Cload_15m%2Cdisk.used_percent%2Cdisk.used%2Cdisk.total&full_id=true',
json: [
{
'ip': '172.29.0.3',
Expand Down Expand Up @@ -66,8 +66,8 @@ export const mockElasticNodes = async (page: Page) => {
}

for (const method in mocks) {
const url = mocks[method].url
const json = mocks[method].json
const url = mocks[method as keyof typeof mocks].url
const json = mocks[method as keyof typeof mocks].json

await page.route(url, async route => (await route.fulfill({ json })))
}
Expand Down

0 comments on commit 0dc52a6

Please sign in to comment.