Skip to content

Commit 17319d0

Browse files
author
Triona Doyle
committed
address yet more coderabbit feedback ..
Signed-off-by: Triona Doyle <tekton@example.com>
1 parent 075a3cf commit 17319d0

5 files changed

Lines changed: 31 additions & 21 deletions

File tree

test/ui-e2e/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ All executions are driven via the ./run-ui-tests.sh wrapper script. This wrapper
6868
| `--headed` | Launches the visible Chromium browser UI. Excellent for local debugging. |
6969
| `--trace on` | Records a granular execution trace (DOM snapshots, network calls, actions) for visual triage. |
7070
| `--reporter=list` | Switches stdout to a clean line-by-line format, ideal for monitoring real-time execution steps. |
71-
| `--env=<ci|pipeline>` | Overrides the local setup to simulate automation. It forces headless execution, performs a clean `npm ci`, and installs required browser binaries dynamically. |
71+
| --env=<ci\|pipeline> | Overrides the local setup to simulate automation. It forces headless execution, performs a clean `npm ci`, and installs required browser binaries dynamically. |
7272

7373
### Visual Debugging (Trace Viewer)
7474

test/ui-e2e/global.setup.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ async function globalSetup() {
1313
execSync('oc delete all -l app=spring-petclinic -n openshift-gitops --wait=false', { stdio: 'ignore' });
1414

1515
console.log('* Cluster sanitized. Starting test suite.');
16-
} catch (error) {
17-
console.log('* Cluster is clean. Starting test suite.');
18-
}
16+
} catch (error) {
17+
console.error('Pre-flight cleanup failed. Check your cluster connection.', error);
18+
throw error;
19+
}
1920
}
2021

2122
export default globalSetup;

test/ui-e2e/run-ui-tests.sh

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ while [[ "$#" -gt 0 ]]; do
1212
shift
1313
done
1414

15+
#making sure we are in the correct dir
16+
cd "$(dirname "$0")" || exit 1
17+
1518
if [ -f .env ]; then
1619
echo "Loading variables from .env file..."
1720
set -a #export all variables
1821
source .env
1922
set +a #stop auto export
2023
fi
2124

22-
#making sure we are in the correct dir
23-
cd "$(dirname "$0")" || exit 1
24-
2525
#username (might be something different for rosa - can be overwritten with export CLUSTER_USER)
2626
export CLUSTER_USER=${CLUSTER_USER:-"kubeadmin"}
2727
export IDP=${IDP:-"kube:admin"}
@@ -67,18 +67,24 @@ rm -f .auth/storageState.json || true
6767
echo " Starting Playwright tests..."
6868

6969
# 2. Execute based on the environment
70-
if [[ "$ENV" == "ci" ]] || [[ "$ENV" == "pipeline" ]]; then
70+
if [ "$ENV" = "ci" ] || [ "$ENV" = "pipeline" ]; then
7171
echo "Running headlessly in automation ($ENV)..."
7272
npm ci
73-
74-
# Prevent sudo jump-scares for local Mac users simulating CI
75-
if [[ "$(uname -s)" == "Darwin" ]]; then
73+
if [ "$(uname -s)" = "Darwin" ]; then
7674
npx playwright install chromium
7775
else
7876
npx playwright install chromium --with-deps
7977
fi
8078

81-
npx playwright test "${TEST_ARGS[@]}" --reporter=list
79+
#headed from args
80+
FILTERED_ARGS=()
81+
for arg in "${TEST_ARGS[@]}"; do
82+
if [[ "$arg" != "--headed" ]]; then
83+
FILTERED_ARGS+=("$arg")
84+
fi
85+
done
86+
87+
npx playwright test "${FILTERED_ARGS[@]}" --reporter=list
8288

8389
else
8490
echo "Running Locally..."

test/ui-e2e/src/pages/ApplicationDetailsPage.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ export class ApplicationDetailsPage {
2323
//wait tree to be visible
2424
await expect(this.resourceTreeContainer).toBeVisible({ timeout: 20000 });
2525
//wait for healthy status
26-
await expect(this.page.getByText('Healthy', { exact: true }).first()).toBeVisible({ timeout: 30000 });
26+
await expect(this.resourceTreeContainer.getByText('Healthy', { exact: true }).first()).toBeVisible({ timeout: 30000 });
27+
2728
}
2829

2930
async clickResourceNode(kind: string, name: string) {

test/ui-e2e/src/pages/ApplicationsPage.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,11 @@ export class ApplicationsPage {
128128

129129
//now it is safe to open the panel
130130
await appContainer.getByText('Sync', { exact: true }).click();
131+
132+
const slideOutPanel = this.page.locator('.sliding-panel').filter({ visible: true });
131133

132-
//click 'all' first to ensure all resource checkboxes are ticked across newer Argo CD versions
133-
const allLink = this.page.getByRole('link', { name: 'all', exact: true });
134+
// 🚀 SWAPPED: this.page is now slideOutPanel
135+
const allLink = slideOutPanel.getByRole('link', { name: 'all', exact: true });
134136
try {
135137
await allLink.waitFor({ state: 'visible', timeout: TIMEOUTS.modal });
136138
await allLink.click();
@@ -143,11 +145,11 @@ export class ApplicationsPage {
143145
}
144146
}
145147

146-
//wait for the manifests to render on the panel (generous timeout for slower FIPS clusters)
147-
await expect(this.page.getByText(expectedResource).first()).toBeVisible({ timeout: TIMEOUTS.render });
148+
// 🚀 SWAPPED: this.page is now slideOutPanel
149+
await expect(slideOutPanel.getByText(expectedResource).first()).toBeVisible({ timeout: TIMEOUTS.render });
148150

149-
//click the main sync button
150-
await this.page.getByRole('button', { name: /^synchronize$/i }).first().click();
151+
// 🚀 SWAPPED: this.page is now slideOutPanel
152+
await slideOutPanel.getByRole('button', { name: /^synchronize$/i }).first().click();
151153

152154
//wait for the panel to close
153155
await expect(this.page.getByText('SYNCHRONIZE RESOURCES')).toBeHidden({ timeout: TIMEOUTS.panel });
@@ -174,8 +176,8 @@ export class ApplicationsPage {
174176

175177
//find the container, then specifically click the link of the app name
176178
const appLink = this.page.locator('.white-box, .argo-table-list__row')
177-
.filter({ hasText: appName })
178-
.getByRole('link', { name: appName });
179+
.filter({ has: this.page.getByText(appName, { exact: true }) })
180+
.getByRole('link', { name: appName, exact: true });
179181

180182
await appLink.waitFor({ state: 'visible', timeout: TIMEOUTS.default });
181183
await appLink.click();

0 commit comments

Comments
 (0)