Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/cypress_admin-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,68 @@ env:
CI: true

jobs:
prepare-matrix:
runs-on: ubuntu-latest
outputs:
spec_groups: ${{ steps.set-matrix.outputs.spec_groups }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set matrix
id: set-matrix
shell: bash
run: |
cd clients/admin-ui/cypress/e2e
# Group test files into balanced groups based on number of tests in each file
echo "spec_groups=$(find . -name "*.cy.ts" | python3 -c '
import sys, os, json, math, re

# Number of groups to create (adjust based on your needs)
NUM_GROUPS = 3

# Get all test files with their test counts
files = []
for line in sys.stdin:
filepath = line.strip()
if os.path.exists(filepath):
# Count the number of test occurrences (it, describe, context)
test_count = 0
with open(filepath, "r") as f:
content = f.read()
# Count occurrences of test definitions like "it(", "test(", "specify("
test_count += len(re.findall(r"\bit\s*\(", content))
test_count += len(re.findall(r"\btest\s*\(", content))
test_count += len(re.findall(r"\bspecify\s*\(", content))
# If no tests found, set minimum of 1 to ensure file is included
if test_count == 0:
test_count = 1
files.append((filepath.replace("./", ""), test_count))

# Sort files by test count in descending order
files.sort(key=lambda x: x[1], reverse=True)

# Initialize groups
groups = [[] for _ in range(NUM_GROUPS)]
group_counts = [0] * NUM_GROUPS

# Distribute files using greedy algorithm (most tests first)
for file, count in files:
# Find the group with the smallest total test count
min_group_idx = group_counts.index(min(group_counts))
groups[min_group_idx].append(file)
group_counts[min_group_idx] += count

# Format for GitHub Actions
print(json.dumps([",".join(group) for group in groups]))
')" >> $GITHUB_OUTPUT

Admin-UI-Cypress:
needs: prepare-matrix
strategy:
fail-fast: false
matrix:
spec_group: ${{ fromJson(needs.prepare-matrix.outputs.spec_groups) }}
runs-on: ubuntu-latest
defaults:
run:
Expand Down Expand Up @@ -43,6 +104,7 @@ jobs:
start: npm run cy:start
wait-on: "http://localhost:3000"
wait-on-timeout: 180
spec: cypress/e2e/{${{ matrix.spec_group }}}

- uses: actions/upload-artifact@v4
if: failure()
Expand Down
10 changes: 5 additions & 5 deletions clients/admin-ui/cypress/e2e/integration-management.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe("Integration management for data detection & discovery", () => {
test_status: "succeeded",
},
}).as("testConnection");
cy.intercept("GET", "/api/v1/connection_type", {
cy.intercept("GET", "/api/v1/connection_type?*", {
fixture: "connectors/connection_types.json",
}).as("getConnectionTypes");
cy.intercept("GET", "/api/v1/connection_type/*/secret", {
Expand Down Expand Up @@ -90,9 +90,9 @@ describe("Integration management for data detection & discovery", () => {
describe("adding an integration", () => {
beforeEach(() => {
cy.intercept("GET", "/api/v1/connection?*", {
fixture: "connectors/bigquery_connection_list.json",
// fixture: "connectors/bigquery_connection_list.json",
}).as("getConnections");
cy.intercept("GET", "/api/v1/connection_type", {
cy.intercept("GET", "/api/v1/connection_type?*", {
fixture: "connectors/connection_types.json",
}).as("getConnectionTypes");
cy.visit(INTEGRATION_MANAGEMENT_ROUTE);
Expand Down Expand Up @@ -178,7 +178,7 @@ describe("Integration management for data detection & discovery", () => {
cy.intercept("GET", "/api/v1/connection?*", {
fixture: "connectors/bigquery_connection_list.json",
}).as("getConnections");
cy.intercept("GET", "/api/v1/connection_type", {
cy.intercept("GET", "/api/v1/connection_type?*", {
fixture: "connectors/connection_types.json",
}).as("getConnectionTypes");
cy.intercept("GET", "/api/v1/system", {
Expand Down Expand Up @@ -461,7 +461,7 @@ describe("Integration management for data detection & discovery", () => {
cy.intercept("GET", "/api/v1/plus/discovery-monitor*", {
fixture: "detection-discovery/monitors/website_monitor_list.json",
}).as("getMonitors");
cy.intercept("GET", "/api/v1/connection_type", {
cy.intercept("GET", "/api/v1/connection_type?*", {
fixture: "connectors/connection_types.json",
}).as("getConnectionTypes");
cy.getByTestId("tab-Data discovery").click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const ConfigureIntegrationForm = ({
usePatchSystemConnectionConfigsMutation();

const { data: secrets, isLoading: secretsSchemaIsLoading } =
useGetConnectionTypeSecretSchemaQuery(connectionOption?.identifier);
useGetConnectionTypeSecretSchemaQuery(connectionOption.identifier);

const { data: allSystems } = useGetAllSystemsQuery();

Expand Down Expand Up @@ -129,7 +129,7 @@ const ConfigureIntegrationForm = ({
: {
name: values.name,
key: formatKey(values.name),
connection_type: connectionOption?.identifier as ConnectionType,
connection_type: connectionOption.identifier as ConnectionType,
access: AccessLevel.READ,
disabled: false,
description: values.description,
Expand Down Expand Up @@ -292,7 +292,7 @@ const ConfigureIntegrationForm = ({
layout="stacked"
/>
)}
{connectionOption?.identifier === ConnectionType.DATAHUB && (
{connectionOption.identifier === ConnectionType.DATAHUB && (
<ControlledSelect
id="dataset"
name="dataset"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const ConfigureMonitorForm = ({
},
};

if (integrationOption?.identifier === ConnectionType.DYNAMODB) {
if (integrationOption.identifier === ConnectionType.DYNAMODB) {
payload.datasource_params = {
single_dataset: false,
};
Expand Down