Skip to content

Commit 0901bac

Browse files
authored
Merge pull request #9 from OriginTrail/test-ui-fixes
Test UI fixes
2 parents 1b67fec + 5bac03c commit 0901bac

File tree

5 files changed

+24
-14
lines changed

5 files changed

+24
-14
lines changed

apps/agent/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
"script:setup": "node dist/scripts/setup.js",
2020
"script:createUser": "node dist/scripts/createUser.js",
2121
"script:createToken": "node dist/scripts/createToken.js",
22-
"test": "PLAYWRIGHT_JUNIT_OUTPUT_NAME=DKG_Node_UI_Tests.xml playwright test spec/testUI.spec.js --grep '@gh_actions' --reporter=list,html,junit",
23-
"test:e2e": "PLAYWRIGHT_JUNIT_OUTPUT_NAME=DKG_Node_UI_Tests.xml playwright test spec/testUI.spec.js --reporter=list,junit",
24-
"test:install": "playwright install",
22+
"test": "PLAYWRIGHT_JUNIT_OUTPUT_NAME=DKG_Node_UI_Tests.xml npx playwright test spec/testUI.spec.js --grep '@gh_actions' --reporter=list,html,junit",
23+
"test:e2e": "PLAYWRIGHT_JUNIT_OUTPUT_NAME=DKG_Node_UI_Tests.xml npx playwright test spec/testUI.spec.js --reporter=list,html,junit",
24+
"test:install": "npx playwright install",
2525
"test:integration": "NODE_OPTIONS='--import tsx' mocha 'tests/integration/**/*.spec.ts' --require tests/integration/setup/global-setup.ts",
2626
"test:ragas": "NODE_OPTIONS='--import tsx' tsx tests/ragas/evaluate.ts",
2727
"test:ragas:results": "NODE_OPTIONS='--import tsx' tsx tests/ragas/show-results.ts",

apps/agent/tests/e2e/pages/chatbotPage.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ class ChatbotPage {
134134
document.querySelectorAll('[data-testid="chat-message-text"]'),
135135
);
136136
const successPattern =
137-
/((Knowledge Asset|KA).*(created|published|generated|added|stored|uploaded)|(created|published|generated|added|stored|uploaded).*(Knowledge Asset|KA)|successfully.*(created|published)|UAL.*did:|Here.*UAL|Asset.*DKG|DKG.*Asset)/i;
137+
/(?!.*unable)(?!.*failed)(?!.*error)(?!.*cannot)(?!.*can't)((Knowledge Asset|KA).*(created|published|generated|added|stored|uploaded)|(created|published|generated|added|stored|uploaded).*(Knowledge Asset|KA)|successfully.*(created|published)|UAL.*did:|Here.*UAL)/i;
138138
return messages.some((msg) =>
139139
successPattern.test(msg.textContent || ""),
140140
);
@@ -145,7 +145,7 @@ class ChatbotPage {
145145

146146
// Find the success message and extract UAL from it
147147
const successMessageRegex =
148-
/(Knowledge Asset.*(?:created|published|generated|added|stored|uploaded)|(?:created|published|generated|added|stored|uploaded).*Knowledge Asset|successfully.*(?:created|published)|UAL.*did:|Here.*UAL|Asset.*DKG|DKG.*Asset|KA.*(?:created|published)|(?:created|published).*KA)/i;
148+
/(?!.*unable)(?!.*failed)(?!.*error)(?!.*cannot)(?!.*can't)(Knowledge Asset.*(?:created|published|generated|added|stored|uploaded)|(?:created|published|generated|added|stored|uploaded).*Knowledge Asset|successfully.*(?:created|published)|UAL.*did:|Here.*UAL|KA.*(?:created|published)|(?:created|published).*KA)/i;
149149

150150
// Get all messages and find the one with success content
151151
const allMessages = await this.page.getByTestId("chat-message-text").all();

apps/agent/tests/ragas/run-ragas.sh

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,24 @@ cd ../../
1111
# Function to cleanup on exit
1212
cleanup() {
1313
echo "🧹 Cleaning up..."
14+
15+
# In CI, use force kill (-9) to prevent hanging
16+
if [ -n "$CI" ] || [ -n "$JENKINS_URL" ] || [ -n "$GITHUB_ACTIONS" ] || [ -n "$GITLAB_CI" ]; then
17+
KILL_SIGNAL="-9"
18+
echo "🤖 CI environment detected - using force kill"
19+
else
20+
KILL_SIGNAL=""
21+
fi
22+
1423
if [ ! -z "$FRONTEND_PID" ] && kill -0 $FRONTEND_PID 2>/dev/null; then
1524
echo "🔴 Stopping frontend server (PID: $FRONTEND_PID)..."
16-
kill $FRONTEND_PID
17-
wait $FRONTEND_PID 2>/dev/null
25+
kill $KILL_SIGNAL $FRONTEND_PID 2>/dev/null || true
26+
sleep 1
1827
fi
1928
if [ ! -z "$BACKEND_PID" ] && kill -0 $BACKEND_PID 2>/dev/null; then
2029
echo "🔴 Stopping backend server (PID: $BACKEND_PID)..."
21-
kill $BACKEND_PID
22-
wait $BACKEND_PID 2>/dev/null
30+
kill $KILL_SIGNAL $BACKEND_PID 2>/dev/null || true
31+
sleep 1
2332
fi
2433
# Note: Dashboard process (DASHBOARD_PID) is intentionally NOT killed
2534
# to allow continued access to results after evaluation completes
@@ -139,15 +148,15 @@ if [ $? -eq 0 ]; then
139148
# Stop the evaluation servers but keep dashboard running
140149
if [ "$FRONTEND_ALREADY_RUNNING" = false ] && [ ! -z "$FRONTEND_PID" ] && kill -0 $FRONTEND_PID 2>/dev/null; then
141150
echo "🔴 Stopping frontend server (evaluation complete)..."
142-
kill $FRONTEND_PID
143-
wait $FRONTEND_PID 2>/dev/null
151+
kill $FRONTEND_PID 2>/dev/null || true
152+
sleep 1
144153
FRONTEND_PID=""
145154
fi
146155

147156
if [ "$BACKEND_ALREADY_RUNNING" = false ] && [ ! -z "$BACKEND_PID" ] && kill -0 $BACKEND_PID 2>/dev/null; then
148157
echo "🔴 Stopping backend server (evaluation complete)..."
149-
kill $BACKEND_PID
150-
wait $BACKEND_PID 2>/dev/null
158+
kill $BACKEND_PID 2>/dev/null || true
159+
sleep 1
151160
BACKEND_PID=""
152161
fi
153162

package-lock.json

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/plugin-dkg-essentials/src/utils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ export const serializeSourceKAContent = (
2525
[${k.ual}](${getExplorerUrl(k.ual)})`,
2626
)
2727
.join("\n"),
28+
_meta: {
2829
description:
2930
"This section provides a list of source knowledge assets used in the creation of this content." +
3031
"This data should be included in the final output.",
32+
},
3133
});
3234

3335
export const parseSourceKAContent = (

0 commit comments

Comments
 (0)