diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/api-services/ai-chat-service.spec.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/api-integration/ai-chat-service.spec.ts similarity index 96% rename from workspaces/bi/bi-extension/src/test/e2e-playwright-tests/api-services/ai-chat-service.spec.ts rename to workspaces/bi/bi-extension/src/test/e2e-playwright-tests/api-integration/ai-chat-service.spec.ts index cca330a9fbb..a841ca1aa95 100644 --- a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/api-services/ai-chat-service.spec.ts +++ b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/api-integration/ai-chat-service.spec.ts @@ -17,9 +17,9 @@ * under the License. */ import { test } from '@playwright/test'; -import { addArtifact, initTest, page } from '../utils'; +import { addArtifact, initTest, page } from '../utils/helpers'; import { Form, switchToIFrame } from '@wso2/playwright-vscode-tester'; -import { ProjectExplorer } from '../ProjectExplorer'; +import { ProjectExplorer } from '../utils/pages'; export default function createTests() { test.describe('AI Chat Agent Tests', { diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/api-services/graphql-service.spec.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/api-integration/graphql-service.spec.ts similarity index 97% rename from workspaces/bi/bi-extension/src/test/e2e-playwright-tests/api-services/graphql-service.spec.ts rename to workspaces/bi/bi-extension/src/test/e2e-playwright-tests/api-integration/graphql-service.spec.ts index e97fca071a2..b371493640b 100644 --- a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/api-services/graphql-service.spec.ts +++ b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/api-integration/graphql-service.spec.ts @@ -16,11 +16,11 @@ * under the License. */ import { Frame, test } from '@playwright/test'; -import { addArtifact, initTest, page } from '../utils'; +import { addArtifact, initTest, page } from '../utils/helpers'; import { Form, switchToIFrame } from '@wso2/playwright-vscode-tester'; -import { ProjectExplorer } from '../ProjectExplorer'; +import { ProjectExplorer } from '../utils/pages'; import { GraphQLServiceUtils} from './graphqlUtils'; -import { TypeEditorUtils } from '../type/TypeEditorUtils'; +import { TypeEditorUtils } from '../type-editor/TypeEditorUtils'; const TEST_DATA = { editedBasePath: (attempt: number) => `/editedSample${attempt}`, diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/api-services/graphqlUtils.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/api-integration/graphqlUtils.ts similarity index 99% rename from workspaces/bi/bi-extension/src/test/e2e-playwright-tests/api-services/graphqlUtils.ts rename to workspaces/bi/bi-extension/src/test/e2e-playwright-tests/api-integration/graphqlUtils.ts index 621558bd79a..f74ba8829aa 100644 --- a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/api-services/graphqlUtils.ts +++ b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/api-integration/graphqlUtils.ts @@ -17,7 +17,7 @@ */ import { Frame,Page } from '@playwright/test'; import { Form } from '@wso2/playwright-vscode-tester'; -import { TypeEditorUtils } from '../type/TypeEditorUtils'; +import { TypeEditorUtils } from '../type-editor/TypeEditorUtils'; export class GraphQLServiceUtils { /** diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/api-services/http-service.spec.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/api-integration/http-service.spec.ts similarity index 96% rename from workspaces/bi/bi-extension/src/test/e2e-playwright-tests/api-services/http-service.spec.ts rename to workspaces/bi/bi-extension/src/test/e2e-playwright-tests/api-integration/http-service.spec.ts index b9f1825f770..31c838180eb 100644 --- a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/api-services/http-service.spec.ts +++ b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/api-integration/http-service.spec.ts @@ -16,9 +16,9 @@ * under the License. */ import { test } from '@playwright/test'; -import { addArtifact, initTest, page } from '../utils'; +import { addArtifact, initTest, page } from '../utils/helpers'; import { Form, switchToIFrame } from '@wso2/playwright-vscode-tester'; -import { ProjectExplorer } from '../ProjectExplorer'; +import { ProjectExplorer } from '../utils/pages'; export default function createTests() { test.describe('HTTP Service Tests', { diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/api-services/tcp-service.spec.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/api-integration/tcp-service.spec.ts similarity index 97% rename from workspaces/bi/bi-extension/src/test/e2e-playwright-tests/api-services/tcp-service.spec.ts rename to workspaces/bi/bi-extension/src/test/e2e-playwright-tests/api-integration/tcp-service.spec.ts index 8166ba59350..fa06a8d3e7e 100644 --- a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/api-services/tcp-service.spec.ts +++ b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/api-integration/tcp-service.spec.ts @@ -16,9 +16,9 @@ * under the License. */ import { test } from '@playwright/test'; -import { addArtifact, initTest, page } from '../utils'; +import { addArtifact, initTest, page } from '../utils/helpers'; import { Form, switchToIFrame } from '@wso2/playwright-vscode-tester'; -import { ProjectExplorer } from '../ProjectExplorer'; +import { ProjectExplorer } from '../utils/pages'; export default function createTests() { test.describe('TCP Service Tests', { diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/automation/automation.spec.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/automation/automation.spec.ts index 7975bb9f2f0..397cf02aecd 100644 --- a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/automation/automation.spec.ts +++ b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/automation/automation.spec.ts @@ -16,7 +16,7 @@ * under the License. */ import { test } from '@playwright/test'; -import { addArtifact, initTest, page } from '../utils'; +import { addArtifact, initTest, page } from '../utils/helpers'; import { switchToIFrame } from '@wso2/playwright-vscode-tester'; export default function createTests() { diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/configuration/configuration.spec.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/configuration/configuration.spec.ts index 01ca0ad4ae4..f2b4c3b0881 100644 --- a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/configuration/configuration.spec.ts +++ b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/configuration/configuration.spec.ts @@ -16,9 +16,9 @@ * under the License. */ import { expect, test } from '@playwright/test'; -import { addArtifact, enableICP, initTest, page } from '../utils'; +import { addArtifact, enableICP, initTest, page } from '../utils/helpers'; import { Form, switchToIFrame } from '@wso2/playwright-vscode-tester'; -import { ConfigEditor } from '../ConfigEditor'; +import { ConfigEditor } from '../utils/pages'; import { config } from 'process'; export default function createTests() { diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integrations/azure.spec.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integration/azure.spec.ts similarity index 97% rename from workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integrations/azure.spec.ts rename to workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integration/azure.spec.ts index 24b99831ed3..f9c75dfc4be 100644 --- a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integrations/azure.spec.ts +++ b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integration/azure.spec.ts @@ -17,9 +17,9 @@ * under the License. */ import { test } from '@playwright/test'; -import { addArtifact, initTest, page } from '../utils'; +import { addArtifact, initTest, page } from '../utils/helpers'; import { Form, switchToIFrame } from '@wso2/playwright-vscode-tester'; -import { ProjectExplorer } from '../ProjectExplorer'; +import { ProjectExplorer } from '../utils/pages'; export default function createTests() { test.describe('Azure Integration Tests', { diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integrations/github.spec.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integration/github.spec.ts similarity index 97% rename from workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integrations/github.spec.ts rename to workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integration/github.spec.ts index fe9ec768a02..6926c4aa081 100644 --- a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integrations/github.spec.ts +++ b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integration/github.spec.ts @@ -17,9 +17,9 @@ * under the License. */ import { test } from '@playwright/test'; -import { addArtifact, initTest, page } from '../utils'; +import { addArtifact, initTest, page } from '../utils/helpers'; import { Form, switchToIFrame } from '@wso2/playwright-vscode-tester'; -import { ProjectExplorer } from '../ProjectExplorer'; +import { ProjectExplorer } from '../utils/pages'; export default function createTests() { test.describe('Github Integration Tests', { diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integrations/kafka.spec.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integration/kafka.spec.ts similarity index 97% rename from workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integrations/kafka.spec.ts rename to workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integration/kafka.spec.ts index e5d7b0fde7c..58afe511c15 100644 --- a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integrations/kafka.spec.ts +++ b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integration/kafka.spec.ts @@ -17,9 +17,9 @@ * under the License. */ import { test } from '@playwright/test'; -import { addArtifact, initTest, page } from '../utils'; +import { addArtifact, initTest, page } from '../utils/helpers'; import { Form, switchToIFrame } from '@wso2/playwright-vscode-tester'; -import { ProjectExplorer } from '../ProjectExplorer'; +import { ProjectExplorer } from '../utils/pages'; export default function createTests() { test.describe('Kafka Integration Tests', { diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integrations/mqtt.spec.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integration/mqtt.spec.ts similarity index 97% rename from workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integrations/mqtt.spec.ts rename to workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integration/mqtt.spec.ts index 85041e244c6..524bf8625e2 100644 --- a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integrations/mqtt.spec.ts +++ b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integration/mqtt.spec.ts @@ -17,9 +17,9 @@ * under the License. */ import { test } from '@playwright/test'; -import { addArtifact, initTest, page } from '../utils'; +import { addArtifact, initTest, page } from '../utils/helpers'; import { Form, switchToIFrame } from '@wso2/playwright-vscode-tester'; -import { ProjectExplorer } from '../ProjectExplorer'; +import { ProjectExplorer } from '../utils/pages'; export default function createTests() { test.describe('MQTT Integration Tests', { diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integrations/rabbitmq.spec.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integration/rabbitmq.spec.ts similarity index 97% rename from workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integrations/rabbitmq.spec.ts rename to workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integration/rabbitmq.spec.ts index 8f9dd4d7334..d8cf0c9d1b4 100644 --- a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integrations/rabbitmq.spec.ts +++ b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integration/rabbitmq.spec.ts @@ -17,9 +17,9 @@ * under the License. */ import { test } from '@playwright/test'; -import { addArtifact, initTest, page } from '../utils'; +import { addArtifact, initTest, page } from '../utils/helpers'; import { Form, switchToIFrame } from '@wso2/playwright-vscode-tester'; -import { ProjectExplorer } from '../ProjectExplorer'; +import { ProjectExplorer } from '../utils/pages'; export default function createTests() { test.describe('RabbitMQ Integration Tests', { diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integrations/salesforce.spec.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integration/salesforce.spec.ts similarity index 97% rename from workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integrations/salesforce.spec.ts rename to workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integration/salesforce.spec.ts index fe245089338..809705cf3b8 100644 --- a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integrations/salesforce.spec.ts +++ b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integration/salesforce.spec.ts @@ -17,9 +17,9 @@ * under the License. */ import { test } from '@playwright/test'; -import { addArtifact, initTest, page } from '../utils'; +import { addArtifact, initTest, page } from '../utils/helpers'; import { Form, switchToIFrame } from '@wso2/playwright-vscode-tester'; -import { ProjectExplorer } from '../ProjectExplorer'; +import { ProjectExplorer } from '../utils/pages'; export default function createTests() { test.describe('Salesforce Integration Tests', { diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integrations/twillio.spec.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integration/twillio.spec.ts similarity index 98% rename from workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integrations/twillio.spec.ts rename to workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integration/twillio.spec.ts index 1cf2ce709b6..59364a12faa 100644 --- a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integrations/twillio.spec.ts +++ b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/event-integration/twillio.spec.ts @@ -17,9 +17,9 @@ * under the License. */ import { test } from '@playwright/test'; -import { addArtifact, initTest, page } from '../utils'; +import { addArtifact, initTest, page } from '../utils/helpers'; import { Form, switchToIFrame } from '@wso2/playwright-vscode-tester'; -import { ProjectExplorer } from '../ProjectExplorer'; +import { ProjectExplorer } from '../utils/pages'; export default function createTests() { test.describe('Twillio Integration Tests', { diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/expression-editor/expression-editor.spec.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/expression-editor/expression-editor.spec.ts index 1f39c0e7004..f72c3765e47 100644 --- a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/expression-editor/expression-editor.spec.ts +++ b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/expression-editor/expression-editor.spec.ts @@ -17,10 +17,9 @@ */ import { test } from '@playwright/test'; -import { addArtifact, initTest, page } from '../utils'; +import { addArtifact, initTest, page } from '../utils/helpers'; import { switchToIFrame } from '@wso2/playwright-vscode-tester'; -import { Diagram } from '../components/Diagram'; -import { SidePanel } from '../components/SidePanel'; +import { Diagram, SidePanel } from '../utils/pages'; export default function createTests() { test.describe('Expression Editor Tests', { diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/file-integrations/directory.spec.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/file-integration/directory.spec.ts similarity index 97% rename from workspaces/bi/bi-extension/src/test/e2e-playwright-tests/file-integrations/directory.spec.ts rename to workspaces/bi/bi-extension/src/test/e2e-playwright-tests/file-integration/directory.spec.ts index 4aa832770da..b873f309915 100644 --- a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/file-integrations/directory.spec.ts +++ b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/file-integration/directory.spec.ts @@ -17,9 +17,9 @@ * under the License. */ import { test } from '@playwright/test'; -import { addArtifact, initTest, page } from '../utils'; +import { addArtifact, initTest, page } from '../utils/helpers'; import { Form, switchToIFrame } from '@wso2/playwright-vscode-tester'; -import { ProjectExplorer } from '../ProjectExplorer'; +import { ProjectExplorer } from '../utils/pages'; export default function createTests() { test.describe('Directory Integration Tests', { diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/file-integrations/ftp.spec.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/file-integration/ftp.spec.ts similarity index 97% rename from workspaces/bi/bi-extension/src/test/e2e-playwright-tests/file-integrations/ftp.spec.ts rename to workspaces/bi/bi-extension/src/test/e2e-playwright-tests/file-integration/ftp.spec.ts index 486d8dce359..59f0b9212d9 100644 --- a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/file-integrations/ftp.spec.ts +++ b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/file-integration/ftp.spec.ts @@ -17,9 +17,9 @@ * under the License. */ import { test } from '@playwright/test'; -import { addArtifact, initTest, page } from '../utils'; +import { addArtifact, initTest, page } from '../utils/helpers'; import { Form, switchToIFrame } from '@wso2/playwright-vscode-tester'; -import { ProjectExplorer } from '../ProjectExplorer'; +import { ProjectExplorer } from '../utils/pages'; export default function createTests() { test.describe('FTP Integration Tests', { diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/import-integration/import-integration.spec.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/import-integration/import-integration.spec.ts index 99177dd24c1..7b1f6e0be6f 100644 --- a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/import-integration/import-integration.spec.ts +++ b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/import-integration/import-integration.spec.ts @@ -19,7 +19,7 @@ import { test } from '@playwright/test'; import { Form } from '@wso2/playwright-vscode-tester'; import fs from 'fs'; import path from 'path'; -import { getWebview, initMigrationTest, page } from '../utils'; +import { getWebview, initMigrationTest, page } from '../utils/helpers'; export default function createTests() { test.describe('Import Integration Tests', { diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/other-artifacts/connection.spec.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/other-artifacts/connection.spec.ts index a65050eb2a7..ea40164a573 100644 --- a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/other-artifacts/connection.spec.ts +++ b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/other-artifacts/connection.spec.ts @@ -18,9 +18,9 @@ * under the License. */ import { test } from '@playwright/test'; -import { addArtifact, initTest, page } from '../utils'; +import { addArtifact, initTest, page } from '../utils/helpers'; import { Form, switchToIFrame } from '@wso2/playwright-vscode-tester'; -import { ProjectExplorer } from '../ProjectExplorer'; +import { ProjectExplorer } from '../utils/pages'; export default function createTests() { test.describe('Connection Artifact Tests', { diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/other-artifacts/data-mapper.spec.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/other-artifacts/data-mapper.spec.ts index 4bd5e99dc29..9ddeca96fd9 100644 --- a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/other-artifacts/data-mapper.spec.ts +++ b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/other-artifacts/data-mapper.spec.ts @@ -17,9 +17,9 @@ * under the License. */ import { test } from '@playwright/test'; -import { addArtifact, initTest, page } from '../utils'; +import { addArtifact, initTest, page } from '../utils/helpers'; import { Form, switchToIFrame } from '@wso2/playwright-vscode-tester'; -import { ProjectExplorer } from '../ProjectExplorer'; +import { ProjectExplorer } from '../utils/pages'; export default function createTests() { test.describe('Data Mapper Artifact Tests', { diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/other-artifacts/function.spec.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/other-artifacts/function.spec.ts index ab87ba4c617..7d2d39d5b33 100644 --- a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/other-artifacts/function.spec.ts +++ b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/other-artifacts/function.spec.ts @@ -17,9 +17,9 @@ * under the License. */ import { test } from '@playwright/test'; -import { addArtifact, initTest, page } from '../utils'; +import { addArtifact, initTest, page } from '../utils/helpers'; import { Form, switchToIFrame } from '@wso2/playwright-vscode-tester'; -import { ProjectExplorer } from '../ProjectExplorer'; +import { ProjectExplorer } from '../utils/pages'; export default function createTests() { test.describe('Function Artifact Tests', { diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/other-artifacts/np.spec.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/other-artifacts/np.spec.ts index 77aea89a927..d556b600a6d 100644 --- a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/other-artifacts/np.spec.ts +++ b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/other-artifacts/np.spec.ts @@ -17,9 +17,9 @@ * under the License. */ import { test } from '@playwright/test'; -import { addArtifact, initTest, page } from '../utils'; +import { addArtifact, initTest, page } from '../utils/helpers'; import { Form, switchToIFrame } from '@wso2/playwright-vscode-tester'; -import { ProjectExplorer } from '../ProjectExplorer'; +import { ProjectExplorer } from '../utils/pages'; export default function createTests() { test.describe('Natural Function Artifact Tests', { diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/other-artifacts/type.spec.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/other-artifacts/type.spec.ts index 7de82f3a02d..6466de905aa 100644 --- a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/other-artifacts/type.spec.ts +++ b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/other-artifacts/type.spec.ts @@ -18,9 +18,9 @@ * under the License. */ import { test } from '@playwright/test'; -import { addArtifact, initTest, page } from '../utils'; +import { addArtifact, initTest, page } from '../utils/helpers'; import { Form, switchToIFrame } from '@wso2/playwright-vscode-tester'; -import { ProjectExplorer } from '../ProjectExplorer'; +import { ProjectExplorer } from '../utils/pages'; export default function createTests() { test.describe('Type Diagram Artifact Tests', { diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/service-class-designer/service-class.spec.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/service-designer/service-class.spec.ts similarity index 99% rename from workspaces/bi/bi-extension/src/test/e2e-playwright-tests/service-class-designer/service-class.spec.ts rename to workspaces/bi/bi-extension/src/test/e2e-playwright-tests/service-designer/service-class.spec.ts index 2326d863479..32846f6e833 100644 --- a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/service-class-designer/service-class.spec.ts +++ b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/service-designer/service-class.spec.ts @@ -16,7 +16,7 @@ * under the License. */ import { test } from '@playwright/test'; -import { addArtifact, getWebview, initTest, page } from '../utils'; +import { addArtifact, getWebview, initTest, page } from '../utils/helpers'; import { ServiceClassEditorUtils } from './serviceEditorUtils'; export default function createTests() { diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/service-class-designer/serviceEditorUtils.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/service-designer/serviceEditorUtils.ts similarity index 100% rename from workspaces/bi/bi-extension/src/test/e2e-playwright-tests/service-class-designer/serviceEditorUtils.ts rename to workspaces/bi/bi-extension/src/test/e2e-playwright-tests/service-designer/serviceEditorUtils.ts diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/template/template.spec.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/template/template.spec.ts deleted file mode 100644 index 34594150411..00000000000 --- a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/template/template.spec.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com) All Rights Reserved. - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -import { test } from '@playwright/test'; -import { initTest, page } from '../utils'; -import { switchToIFrame } from '@wso2/playwright-vscode-tester'; - -export default function createTests() { - test.describe('Sample Tests', { - tag: '@group1', - }, async () => { - initTest(); - test('Sample Test', async ({ }, testInfo) => { - const testAttempt = testInfo.retry + 1; - console.log('Sample test attempt: ', testAttempt); - const artifactWebView = await switchToIFrame('WSO2 Integrator: BI', page.page, 30000); - if (!artifactWebView) { - throw new Error('WSO2 Integrator: BI webview not found'); - } - // Add test implementation here - }); - }); -} diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/test.list.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/test.list.ts index b9fe8411782..c423dc03c73 100644 --- a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/test.list.ts +++ b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/test.list.ts @@ -17,28 +17,28 @@ */ import { test } from '@playwright/test'; -import { page } from './utils'; +import { page } from './utils/helpers'; const fs = require('fs'); const path = require('path'); const videosFolder = path.join(__dirname, '..', 'test-resources', 'videos'); import automation from './automation/automation.spec'; -import httpService from './api-services/http-service.spec'; -import aiChatService from './api-services/ai-chat-service.spec'; -import graphqlService from './api-services/graphql-service.spec'; -import tcpService from './api-services/tcp-service.spec'; +import httpService from './api-integration/http-service.spec'; +import aiChatService from './api-integration/ai-chat-service.spec'; +import graphqlService from './api-integration/graphql-service.spec'; +import tcpService from './api-integration/tcp-service.spec'; -import kafkaIntegration from './event-integrations/kafka.spec'; -import rabbitmqIntegration from './event-integrations/rabbitmq.spec'; -import mqttIntegration from './event-integrations/mqtt.spec'; -import azureIntegration from './event-integrations/azure.spec'; -import salesforceIntegration from './event-integrations/salesforce.spec'; -import twillioIntegration from './event-integrations/twillio.spec'; -import githubIntegration from './event-integrations/github.spec'; +import kafkaIntegration from './event-integration/kafka.spec'; +import rabbitmqIntegration from './event-integration/rabbitmq.spec'; +import mqttIntegration from './event-integration/mqtt.spec'; +import azureIntegration from './event-integration/azure.spec'; +import salesforceIntegration from './event-integration/salesforce.spec'; +import twillioIntegration from './event-integration/twillio.spec'; +import githubIntegration from './event-integration/github.spec'; -import ftpIntegration from './file-integrations/ftp.spec'; -import directoryIntegration from './file-integrations/directory.spec'; +import ftpIntegration from './file-integration/ftp.spec'; +import directoryIntegration from './file-integration/directory.spec'; import functionArtifact from './other-artifacts/function.spec'; import naturalFunctionArtifact from './other-artifacts/np.spec'; @@ -46,8 +46,8 @@ import typeDiagramArtifact from './other-artifacts/type.spec'; import connectionArtifact from './other-artifacts/connection.spec'; import configuration from './configuration/configuration.spec'; -import typeTest from './type/type.spec'; -import serviceTest from './service-class-designer/service-class.spec'; +import typeTest from './type-editor/type.spec'; +import serviceTest from './service-designer/service-class.spec'; import importIntegration from './import-integration/import-integration.spec'; diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/type/TypeEditorUtils.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/type-editor/TypeEditorUtils.ts similarity index 100% rename from workspaces/bi/bi-extension/src/test/e2e-playwright-tests/type/TypeEditorUtils.ts rename to workspaces/bi/bi-extension/src/test/e2e-playwright-tests/type-editor/TypeEditorUtils.ts diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/type/testOutput.bal b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/type-editor/testOutput.bal similarity index 100% rename from workspaces/bi/bi-extension/src/test/e2e-playwright-tests/type/testOutput.bal rename to workspaces/bi/bi-extension/src/test/e2e-playwright-tests/type-editor/testOutput.bal diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/type/type.spec.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/type-editor/type.spec.ts similarity index 99% rename from workspaces/bi/bi-extension/src/test/e2e-playwright-tests/type/type.spec.ts rename to workspaces/bi/bi-extension/src/test/e2e-playwright-tests/type-editor/type.spec.ts index 040cfa52d65..59dc039921b 100644 --- a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/type/type.spec.ts +++ b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/type-editor/type.spec.ts @@ -17,7 +17,7 @@ */ import { test } from '@playwright/test'; -import { addArtifact, initTest, page, getWebview, verifyGeneratedSource } from '../utils'; +import { addArtifact, initTest, page, getWebview, verifyGeneratedSource } from '../utils/helpers'; import { Form } from '@wso2/playwright-vscode-tester'; import { TypeEditorUtils } from './TypeEditorUtils'; import path from 'path'; diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/data/new-project/testProject/sample/Ballerina.toml b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/data/new-project/testProject/sample/Ballerina.toml new file mode 100644 index 00000000000..82389a78257 --- /dev/null +++ b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/data/new-project/testProject/sample/Ballerina.toml @@ -0,0 +1,7 @@ +[package] +org = "nino" +name = "sample" +version = "0.1.0" + +[build-options] +sticky = true \ No newline at end of file diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/data/new-project/testProject/sample/agents.bal b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/data/new-project/testProject/sample/agents.bal new file mode 100644 index 00000000000..e69de29bb2d diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/data/new-project/testProject/sample/config.bal b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/data/new-project/testProject/sample/config.bal new file mode 100644 index 00000000000..e69de29bb2d diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/data/new-project/testProject/sample/connections.bal b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/data/new-project/testProject/sample/connections.bal new file mode 100644 index 00000000000..e69de29bb2d diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/data/new-project/testProject/sample/data_mappings.bal b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/data/new-project/testProject/sample/data_mappings.bal new file mode 100644 index 00000000000..e69de29bb2d diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/data/new-project/testProject/sample/functions.bal b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/data/new-project/testProject/sample/functions.bal new file mode 100644 index 00000000000..e69de29bb2d diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/data/new-project/testProject/sample/main.bal b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/data/new-project/testProject/sample/main.bal new file mode 100644 index 00000000000..9db45286b81 --- /dev/null +++ b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/data/new-project/testProject/sample/main.bal @@ -0,0 +1,13 @@ +import ballerina/http; + +listener http:Listener httpDefaultListener = http:getDefaultListener(); + +service /foo on httpDefaultListener { + resource function get greeting() returns error|json|http:InternalServerError { + do { + } on fail error err { + // handle error + return error("unhandled error", err); + } + } +} diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/data/new-project/testProject/sample/types.bal b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/data/new-project/testProject/sample/types.bal new file mode 100644 index 00000000000..e69de29bb2d diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/helpers/artifacts.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/helpers/artifacts.ts new file mode 100644 index 00000000000..f7f10071f4b --- /dev/null +++ b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/helpers/artifacts.ts @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com) All Rights Reserved. + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { getWebview } from "./webview"; +import { page } from "./setup"; + +/** + * Add an artifact to the project + */ +export async function addArtifact(artifactName: string, testId: string) { + console.log(`Adding artifact: ${artifactName}`); + const artifactWebView = await getWebview('WSO2 Integrator: BI', page); + if (!artifactWebView) { + throw new Error('WSO2 Integrator: BI webview not found'); + } + // Navigate to the overview page + await artifactWebView.getByRole('button', { name: ' Add Artifact' }).click(); + // how to get element by id + const addArtifactBtn = artifactWebView.locator(`#${testId}`); + await addArtifactBtn.waitFor(); + await addArtifactBtn.click(); +} + +/** + * Enable ICP (Integration Control Plane) + */ +export async function enableICP() { + console.log('Enabling ICP'); + const webview = await getWebview('WSO2 Integrator: BI', page); + if (!webview) { + throw new Error('WSO2 Integrator: BI webview not found'); + } + const icpToggle = webview.getByRole('checkbox', { name: 'Enable WSO2 Integrator: ICP' }); + await icpToggle.waitFor(); + if (!(await icpToggle.isChecked())) { + await icpToggle.click(); + } +} diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/helpers/index.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/helpers/index.ts new file mode 100644 index 00000000000..c761a2dc9d6 --- /dev/null +++ b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/helpers/index.ts @@ -0,0 +1,39 @@ +/** + * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com) All Rights Reserved. + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// Re-export from setup +export { + page, + vscode, + resourcesFolder, + newProjectPath, + initTest, + initMigrationTest, + createProject, + setupBallerinaIntegrator, + toggleNotifications +} from './setup'; + +// Re-export from webview +export { getWebview } from './webview'; + +// Re-export from artifacts +export { addArtifact, enableICP } from './artifacts'; + +// Re-export from verification +export { verifyGeneratedSource } from './verification'; diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/helpers/setup.ts similarity index 68% rename from workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils.ts rename to workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/helpers/setup.ts index b95231e3c65..da02bd28412 100644 --- a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils.ts +++ b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/helpers/setup.ts @@ -15,19 +15,21 @@ * specific language governing permissions and limitations * under the License. */ + import { ExtendedPage, Form, startVSCode, switchToIFrame } from "@wso2/playwright-vscode-tester"; import { test } from '@playwright/test'; import fs, { existsSync } from 'fs'; import path from 'path'; import { exec } from 'child_process'; import { promisify } from 'util'; +import { getWebview } from './webview'; -const dataFolder = path.join(__dirname, 'data'); -const extensionsFolder = path.join(__dirname, '..', '..', '..', 'vsix'); +const dataFolder = path.join(__dirname, '..', 'data'); +const extensionsFolder = path.join(__dirname, '..', '..', '..', '..', '..', 'vsix'); const vscodeVersion = 'latest'; -export const resourcesFolder = path.join(__dirname, '..', 'test-resources'); +export const resourcesFolder = path.join(__dirname, '..', '..', '..', 'test-resources'); export const newProjectPath = path.join(dataFolder, 'new-project', 'testProject'); -export let vscode; +export let vscode: any; export let page: ExtendedPage; const execAsync = promisify(exec); @@ -120,47 +122,6 @@ export async function setupBallerinaIntegrator() { } } -export async function getWebview(viewName: string, page: ExtendedPage) { - let webview; - let retryCount = 0; - const maxRetries = 3; - - while (retryCount < maxRetries) { - try { - await page.page.waitForLoadState('domcontentloaded'); - await page.page.waitForTimeout(1000); - - webview = await switchToIFrame(viewName, page.page); - if (webview) { - return webview; - } - // If webview is falsy, treat it as a failed attempt - console.log(`Attempt ${retryCount + 1} failed: switchToIFrame returned ${webview}`); - } catch (error) { - const message = error instanceof Error ? error.message : String(error); - if (message.includes('Frame was detached')) { - console.log(`Frame was detached, retrying (${retryCount + 1}/${maxRetries})`); - } else { - console.log(`Attempt ${retryCount + 1} failed to access iframe:`, message); - } - } - - // Always increment retry count after each attempt - retryCount++; - - // Only retry if we haven't reached max retries - if (retryCount < maxRetries) { - await page.page.waitForTimeout(2000); - try { - await page.selectSidebarItem(viewName); - } catch (sidebarError) { - console.log('Failed to reselect sidebar item:', sidebarError); - } - } - } - throw new Error(`Failed to access iframe for ${viewName} after ${maxRetries} attempts`); -} - export async function createProject(page: ExtendedPage, projectName?: string) { console.log('Creating new project'); @@ -226,7 +187,6 @@ export function initTest(newProject: boolean = false, skipProjectCreation: boole }); } - export function initMigrationTest() { test.beforeAll(async ({ }, testInfo) => { console.log(`>>> Starting migration tests. Title: ${testInfo.title}, Attempt: ${testInfo.retry + 1}`); @@ -261,73 +221,3 @@ export function initMigrationTest() { console.log('Migration test runner started'); }); } - - -export async function addArtifact(artifactName: string, testId: string) { - console.log(`Adding artifact: ${artifactName}`); - const artifactWebView = await getWebview('WSO2 Integrator: BI', page); - if (!artifactWebView) { - throw new Error('WSO2 Integrator: BI webview not found'); - } - // Navigate to the overview page - await artifactWebView.getByRole('button', { name: ' Add Artifact' }).click(); - // how to get element by id - const addArtifactBtn = artifactWebView.locator(`#${testId}`); - await addArtifactBtn.waitFor(); - await addArtifactBtn.click(); -} - -export async function enableICP() { - console.log('Enabling ICP'); - const webview = await getWebview('WSO2 Integrator: BI', page); - if (!webview) { - throw new Error('WSO2 Integrator: BI webview not found'); - } - const icpToggle = webview.getByRole('checkbox', { name: 'Enable WSO2 Integrator: ICP' }); - await icpToggle.waitFor(); - if (!(await icpToggle.isChecked())) { - await icpToggle.click(); - } -} - -/** - * Normalize source code for comparison - */ -function normalizeSource(source: string): string { - return source - .replace(/\r\n/g, '\n') // Normalize line endings - .replace(/\t/g, ' ') // Convert tabs to spaces - .split('\n') - .map(line => line.trimEnd()) // Remove trailing whitespace - .filter(line => line.trim() !== '') // Remove empty lines - .join('\n') - .trim(); -} - -/** - * Compare a generated .bal file with an expected .bal file - * @param generatedFileName - Name of the generated file (e.g., 'types.bal') - * @param expectedFilePath - Path to the expected file (e.g., path to testOutput.bal) - */ -export async function verifyGeneratedSource(generatedFileName: string, expectedFilePath: string): Promise { - const { expect } = await import('@playwright/test'); - - // Generated file is in the project sample folder - const generatedFilePath = path.join(newProjectPath, 'sample', generatedFileName); - - if (!fs.existsSync(generatedFilePath)) { - throw new Error(`Generated file not found at: ${generatedFilePath}`); - } - - if (!fs.existsSync(expectedFilePath)) { - throw new Error(`Expected file not found at: ${expectedFilePath}`); - } - - const actualContent = fs.readFileSync(generatedFilePath, 'utf-8'); - const expectedContent = fs.readFileSync(expectedFilePath, 'utf-8'); - - const normalizedActual = normalizeSource(actualContent); - const normalizedExpected = normalizeSource(expectedContent); - - expect(normalizedActual).toBe(normalizedExpected); -} diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/helpers/verification.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/helpers/verification.ts new file mode 100644 index 00000000000..328c0dadb1c --- /dev/null +++ b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/helpers/verification.ts @@ -0,0 +1,63 @@ +/** + * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com) All Rights Reserved. + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import fs from 'fs'; +import path from 'path'; +import { newProjectPath } from './setup'; + +/** + * Normalize source code for comparison + */ +function normalizeSource(source: string): string { + return source + .replace(/\r\n/g, '\n') // Normalize line endings + .replace(/\t/g, ' ') // Convert tabs to spaces + .split('\n') + .map(line => line.trimEnd()) // Remove trailing whitespace + .filter(line => line.trim() !== '') // Remove empty lines + .join('\n') + .trim(); +} + +/** + * Compare a generated .bal file with an expected .bal file + * @param generatedFileName - Name of the generated file (e.g., 'types.bal') + * @param expectedFilePath - Path to the expected file (e.g., path to testOutput.bal) + */ +export async function verifyGeneratedSource(generatedFileName: string, expectedFilePath: string): Promise { + const { expect } = await import('@playwright/test'); + + // Generated file is in the project sample folder + const generatedFilePath = path.join(newProjectPath, 'sample', generatedFileName); + + if (!fs.existsSync(generatedFilePath)) { + throw new Error(`Generated file not found at: ${generatedFilePath}`); + } + + if (!fs.existsSync(expectedFilePath)) { + throw new Error(`Expected file not found at: ${expectedFilePath}`); + } + + const actualContent = fs.readFileSync(generatedFilePath, 'utf-8'); + const expectedContent = fs.readFileSync(expectedFilePath, 'utf-8'); + + const normalizedActual = normalizeSource(actualContent); + const normalizedExpected = normalizeSource(expectedContent); + + expect(normalizedActual).toBe(normalizedExpected); +} diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/helpers/webview.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/helpers/webview.ts new file mode 100644 index 00000000000..f7a4487aa87 --- /dev/null +++ b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/helpers/webview.ts @@ -0,0 +1,63 @@ +/** + * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com) All Rights Reserved. + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { ExtendedPage, switchToIFrame } from "@wso2/playwright-vscode-tester"; + +/** + * Get webview frame with retry logic + */ +export async function getWebview(viewName: string, page: ExtendedPage) { + let webview; + let retryCount = 0; + const maxRetries = 3; + + while (retryCount < maxRetries) { + try { + await page.page.waitForLoadState('domcontentloaded'); + await page.page.waitForTimeout(1000); + + webview = await switchToIFrame(viewName, page.page); + if (webview) { + return webview; + } + // If webview is falsy, treat it as a failed attempt + console.log(`Attempt ${retryCount + 1} failed: switchToIFrame returned ${webview}`); + } catch (error) { + const message = error instanceof Error ? error.message : String(error); + if (message.includes('Frame was detached')) { + console.log(`Frame was detached, retrying (${retryCount + 1}/${maxRetries})`); + } else { + console.log(`Attempt ${retryCount + 1} failed to access iframe:`, message); + } + } + + // Always increment retry count after each attempt + retryCount++; + + // Only retry if we haven't reached max retries + if (retryCount < maxRetries) { + await page.page.waitForTimeout(2000); + try { + await page.selectSidebarItem(viewName); + } catch (sidebarError) { + console.log('Failed to reselect sidebar item:', sidebarError); + } + } + } + throw new Error(`Failed to access iframe for ${viewName} after ${maxRetries} attempts`); +} diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/ConfigEditor.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/pages/ConfigEditor.ts similarity index 100% rename from workspaces/bi/bi-extension/src/test/e2e-playwright-tests/ConfigEditor.ts rename to workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/pages/ConfigEditor.ts diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/components/Diagram.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/pages/Diagram.ts similarity index 100% rename from workspaces/bi/bi-extension/src/test/e2e-playwright-tests/components/Diagram.ts rename to workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/pages/Diagram.ts diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/ProjectExplorer.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/pages/ProjectExplorer.ts similarity index 100% rename from workspaces/bi/bi-extension/src/test/e2e-playwright-tests/ProjectExplorer.ts rename to workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/pages/ProjectExplorer.ts diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/components/SidePanel.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/pages/SidePanel.ts similarity index 99% rename from workspaces/bi/bi-extension/src/test/e2e-playwright-tests/components/SidePanel.ts rename to workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/pages/SidePanel.ts index 428dff66214..cd58963376d 100644 --- a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/components/SidePanel.ts +++ b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/pages/SidePanel.ts @@ -40,4 +40,4 @@ export class SidePanel { const nodeContainer = this.getLocator().getByTitle(nodeTitle); await nodeContainer.click(); } -} \ No newline at end of file +} diff --git a/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/pages/index.ts b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/pages/index.ts new file mode 100644 index 00000000000..7583905907b --- /dev/null +++ b/workspaces/bi/bi-extension/src/test/e2e-playwright-tests/utils/pages/index.ts @@ -0,0 +1,22 @@ +/** + * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com) All Rights Reserved. + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export { ConfigEditor } from './ConfigEditor'; +export { ProjectExplorer } from './ProjectExplorer'; +export { Diagram } from './Diagram'; +export { SidePanel } from './SidePanel';