22# Copyright (C) 2024 Intel Corporation
33# SPDX-License-Identifier: Apache-2.0
44
5- set -e
5+ set -xe
66
77WORKPATH=$( dirname " $PWD " )
88LOG_PATH=" $WORKPATH /tests"
@@ -22,8 +22,8 @@ function build_docker_images() {
2222 cd $WORKPATH /docker
2323 docker build -t opea/searchqna:latest -f Dockerfile .
2424
25- # cd $WORKPATH/docker/ui
26- # docker build --no-cache -t opea/searchqna-ui:latest -f docker/Dockerfile .
25+ cd $WORKPATH /docker/ui
26+ docker build --no-cache -t opea/searchqna-ui:latest -f docker/Dockerfile .
2727
2828 docker images
2929}
@@ -52,8 +52,10 @@ function start_services() {
5252 export WEB_RETRIEVER_SERVICE_PORT=3003
5353 export RERANK_SERVICE_PORT=3005
5454 export LLM_SERVICE_PORT=3007
55+ export BACKEND_SERVICE_ENDPOINT=" http://${ip_address} :3008/v1/searchqna"
5556
56- # sed -i "s/backend_address/$ip_address/g" $WORKPATH/docker/ui/svelte/.env
57+
58+ sed -i " s/backend_address/$ip_address /g" $WORKPATH /docker/ui/svelte/.env
5759
5860 if [[ " $IMAGE_REPO " != " " ]]; then
5961 # Replace the container name with a test-specific name
@@ -94,30 +96,30 @@ function validate_megaservice() {
9496
9597}
9698
97- # function validate_frontend() {
98- # cd $WORKPATH/docker/ui/svelte
99- # local conda_env_name="OPEA_e2e"
100- # export PATH=${HOME}/miniforge3/bin/:$PATH
101- # # conda remove -n ${conda_env_name} --all -y
102- # # conda create -n ${conda_env_name} python=3.12 -y
103- # source activate ${conda_env_name}
104- #
105- # sed -i "s/localhost/$ip_address/g" playwright.config.ts
106- #
107- # # conda install -c conda-forge nodejs -y
108- # npm install && npm ci && npx playwright install --with-deps
109- # node -v && npm -v && pip list
110- #
111- # exit_status=0
112- # npx playwright test || exit_status=$?
113- #
114- # if [ $exit_status -ne 0 ]; then
115- # echo "[TEST INFO]: ---------frontend test failed---------"
116- # exit $exit_status
117- # else
118- # echo "[TEST INFO]: ---------frontend test passed---------"
119- # fi
120- # }
99+ function validate_frontend() {
100+ cd $WORKPATH /docker/ui/svelte
101+ local conda_env_name=" OPEA_e2e"
102+ export PATH=${HOME} /miniforge3/bin/:$PATH
103+ # conda remove -n ${conda_env_name} --all -y
104+ # conda create -n ${conda_env_name} python=3.12 -y
105+ source activate ${conda_env_name}
106+
107+ sed -i " s/localhost/$ip_address /g" playwright.config.ts
108+
109+ # conda install -c conda-forge nodejs -y
110+ npm install && npm ci && npx playwright install --with-deps
111+ node -v && npm -v && pip list
112+
113+ exit_status=0
114+ npx playwright test || exit_status=$?
115+
116+ if [ $exit_status -ne 0 ]; then
117+ echo " [TEST INFO]: ---------frontend test failed---------"
118+ exit $exit_status
119+ else
120+ echo " [TEST INFO]: ---------frontend test passed---------"
121+ fi
122+ }
121123
122124function stop_docker() {
123125 cd $WORKPATH /docker/xeon
@@ -131,7 +133,7 @@ function main() {
131133 start_services
132134
133135 validate_megaservice
134- # validate_frontend
136+ validate_frontend
135137
136138 stop_docker
137139 echo y | docker system prune
0 commit comments