Skip to content

Commit 043e718

Browse files
KasinhouMatus Kasak
andauthored
Running UI tests for ZCU customer (#885)
* Running ui tests for zcu customer * Changed instance number and delete unused import and delay * Increased timeout in tests --------- Co-authored-by: Matus Kasak <matus.kasak@dataquest.sk>
1 parent bd8be5f commit 043e718

2 files changed

Lines changed: 79 additions & 136 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 58 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -63,120 +63,45 @@ jobs:
6363
# docker compose --env-file $ENVFILE -p dspace-$INSTANCE -f docker/docker-compose.yml -f docker/docker-compose-rest.yml -f /opt/dspace-envs/4/extra.yml pull
6464
docker compose --env-file $ENVFILE -p dspace-$INSTANCE -f docker/docker-compose.yml -f docker/docker-compose-rest.yml -f /opt/dspace-envs/4/extra.yml up -d --no-build
6565
66-
deploy-8:
67-
if: inputs.INSTANCE == '*' || inputs.INSTANCE == '8'
68-
runs-on: dspace-dep-1
69-
timeout-minutes: 180
70-
env:
71-
INSTANCE: '8'
72-
# 2024/02: this .env replaces ENTRYPOINT to angular
73-
# !!!!WARNING!!!!
74-
# disable TSL checks = allowing to cooperate with https backend with invalid
75-
# certificate
76-
ENVFILE: /opt/dspace-envs/.env.dspace.imported.dev-5
66+
playwright-after-deploy4:
67+
runs-on: dspace-test-1
68+
needs: deploy-4
69+
timeout-minutes: 45
70+
if: '!inputs.IMPORT'
7771
steps:
78-
- uses: actions/checkout@v4
79-
80-
- uses: ./.github/actions/erase-db
81-
if: inputs.ERASE_DB
72+
- name: Checkout Playwright tests
73+
uses: actions/checkout@v4
8274
with:
83-
INSTANCE: ${{ env.INSTANCE }}
84-
NAME: dspace-${{ env.INSTANCE }}
85-
86-
- name: deploy dspace-import on dev-5
87-
working-directory: build-scripts/run/
88-
run: |
89-
./start.sh dspace-$INSTANCE
90-
cd ../..
91-
# this is not necessary, since extra.yml doesn't contain any new images that weren't pulled within script above
92-
# docker compose --env-file $ENVFILE -p dspace-$INSTANCE -f docker/docker-compose.yml -f docker/docker-compose-rest.yml -f /opt/dspace-envs/8/extra.yml pull
93-
docker compose --env-file $ENVFILE -p dspace-$INSTANCE -f docker/docker-compose.yml -f docker/docker-compose-rest.yml -f /opt/dspace-envs/8/extra.yml up -d --no-build
94-
# this seems to be the easiest solution for now
95-
docker restart dockerized-nginx-with-shibboleth-nginx-1
96-
/bin/bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://dev-5.pc:8$INSTANCE/server/api)" != "200" ]]; do sleep 5; done'
97-
75+
repository: dataquest-dev/dspace-ui-tests
76+
path: dspace-ui-tests
77+
token: ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}
9878

99-
import-8:
100-
runs-on: dspace-dep-1
101-
if: inputs.IMPORT
102-
needs: deploy-8
103-
env:
104-
INSTANCE: '8'
105-
ENVFILE: /opt/dspace-envs/.env.dspace.imported.dev-5
106-
steps:
107-
- uses: ./.github/actions/import-db
79+
- name: Checkout main repository
80+
uses: actions/checkout@v4
10881
with:
109-
INSTANCE: ${{ env.INSTANCE }}
110-
DATADIR: /opt/dspace-data/clarin-dspace/
111-
ASSETSTORE: /opt/dspace-data/clarin-dspace/assetstore/
112-
113-
- name: dspace basic command
114-
run: |
115-
export DNAME=dspace$INSTANCE
116-
docker logs -n 50 $DNAME
117-
118-
echo "dspace version:"
119-
docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace version"
120-
121-
echo "dspace cleanup:"
122-
docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace cleanup -v"
123-
124-
echo "dspace reindex solr:"
125-
docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace index-discovery -b"
82+
path: this-repository
12683

127-
echo "dspace reindex OAI-PMH:"
128-
docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace oai import -c"
129-
130-
echo "dspace checker:"
131-
docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace checker -v -l"
132-
133-
- name: dspace healthcheck
84+
- name: Copy customer config to UI tests repository for merging
13485
run: |
135-
export DNAME=dspace$INSTANCE
136-
echo "dspace healthcheck:"
137-
docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace healthcheck -v"
86+
cp this-repository/config/config.zcu.ui.tests.json dspace-ui-tests/customer-constants/
13887
139-
playwright-after-deploy8:
140-
runs-on: ubuntu-latest
141-
needs: deploy-8
142-
timeout-minutes: 15
143-
if: '!inputs.IMPORT'
144-
steps:
145-
- name: run playwright
88+
- name: test
89+
working-directory: dspace-ui-tests/scripts
90+
env:
91+
HOME_URL: http://dev-5.pc:84/
92+
NAME: ZCU
14693
run: |
147-
# wait until FE stabilizes a bit
148-
sleep 3m
94+
./test.sh
14995
150-
curl -H "Accept: application/vnd.github.everest-preview+json" \
151-
-H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" \
152-
--request POST \
153-
https://api.github.com/repos/dataquest-dev/\
154-
dspace-ui-tests/actions/workflows/cron-test.yml/dispatches \
155-
--data "{\"ref\":\"refs/heads/master\"}" 2> /dev/null
156-
157-
# wait for it to start
158-
sleep 30s
159-
160-
# get result of last job
161-
RES=$(curl -H "Accept: application/vnd.github.everest-preview+json" -H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" https://api.github.com/repos/dataquest-dev/dspace-ui-tests/actions/workflows/cron-test.yml/runs?per_page=1 2> /dev/null | jq .workflow_runs[0].conclusion)
162-
163-
# while job did not finish, sleep
164-
while [[ $RES == 'null' ]]; do
165-
sleep 10s
166-
RES=$(curl -H "Accept: application/vnd.github.everest-preview+json" -H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" https://api.github.com/repos/dataquest-dev/dspace-ui-tests/actions/workflows/cron-test.yml/runs?per_page=1 2> /dev/null | jq .workflow_runs[0].conclusion)
167-
done;
168-
169-
echo $RES
170-
# if last result is not success, return -1 and fail
171-
if [[ $RES != \"success\" ]]; then
172-
echo "playwright tests have failed! check appropriate action run"
173-
exit 1
174-
fi;
96+
- uses: mazoea/ga-maz/end@master
97+
with:
98+
CHOWN_DIR: ./
99+
if: ${{ always() }}
175100

176-
rest-tests-after-deploy8:
101+
rest-tests-after-deploy4:
177102
runs-on: ubuntu-latest
178-
needs: playwright-after-deploy8
179-
timeout-minutes: 15
103+
needs: playwright-after-deploy4
104+
timeout-minutes: 45
180105
steps:
181106
- name: run rest-tests
182107
run: |
@@ -207,48 +132,45 @@ jobs:
207132
fi;
208133
209134
210-
playwright-after-import8:
135+
playwright-after-import4:
211136
runs-on: ubuntu-latest
212-
needs: import-8
137+
needs: import-4
213138
if: inputs.IMPORT
214-
timeout-minutes: 15
139+
timeout-minutes: 45
215140
steps:
216-
- name: run playwright
217-
run: |
218-
# wait until FE stabilizes a bit
219-
sleep 3m
220-
221-
curl -H "Accept: application/vnd.github.everest-preview+json" \
222-
-H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" \
223-
--request POST \
224-
https://api.github.com/repos/dataquest-dev/\
225-
dspace-ui-tests/actions/workflows/cron-test.yml/dispatches \
226-
--data "{\"ref\":\"refs/heads/master\"}" 2> /dev/null
227-
228-
# wait for it to start
229-
sleep 30s
141+
- name: Checkout Playwright tests
142+
uses: actions/checkout@v4
143+
with:
144+
repository: dataquest-dev/dspace-ui-tests
145+
path: dspace-ui-tests
146+
token: ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}
230147

231-
# get result of last job
232-
RES=$(curl -H "Accept: application/vnd.github.everest-preview+json" -H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" https://api.github.com/repos/dataquest-dev/dspace-ui-tests/actions/workflows/cron-test.yml/runs?per_page=1 2> /dev/null | jq .workflow_runs[0].conclusion)
148+
- name: Checkout main repository
149+
uses: actions/checkout@v4
150+
with:
151+
path: this-repository
233152

234-
# while job did not finish, sleep
235-
while [[ $RES == 'null' ]]; do
236-
sleep 10s
237-
RES=$(curl -H "Accept: application/vnd.github.everest-preview+json" -H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" https://api.github.com/repos/dataquest-dev/dspace-ui-tests/actions/workflows/cron-test.yml/runs?per_page=1 2> /dev/null | jq .workflow_runs[0].conclusion)
238-
done;
153+
- name: Copy customer config to UI tests repository for merging
154+
run: |
155+
cp this-repository/config/config.zcu.ui.tests.json dspace-ui-tests/customer-constants/
239156
240-
echo $RES
241-
# if last result is not success, return -1 and fail
242-
if [[ $RES != \"success\" ]]; then
157+
- name: test
158+
working-directory: dspace-ui-tests/scripts
159+
env:
160+
HOME_URL: http://dev-5.pc:84/
161+
NAME: ZCU
162+
run: |
163+
./test.sh
243164
244-
echo "playwright tests have failed! check appropriate action run"
245-
exit 1
246-
fi;
165+
- uses: mazoea/ga-maz/end@master
166+
with:
167+
CHOWN_DIR: ./
168+
if: ${{ always() }}
247169

248-
rest-tests-after-import8:
170+
rest-tests-after-import4:
249171
runs-on: ubuntu-latest
250-
needs: playwright-after-import8
251-
timeout-minutes: 15
172+
needs: playwright-after-import4
173+
timeout-minutes: 45
252174
steps:
253175
- name: run rest-tests
254176
run: |

config/config.zcu.ui.tests.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"env": {
3+
"has_discojuice": false,
4+
"has_whats_new": false,
5+
"has_profile_and_logout_link": true,
6+
"can_create_item_test": "enabled",
7+
"author_has_one_field": true
8+
},
9+
"locators": {
10+
"title": "DSpace at University of West Bohemia Home",
11+
"profile_link": "a[href=\"/profile\"]",
12+
"logout_link": "button[data-test=\"logout-button\"]",
13+
"signon_link": "a[data-test=\"login-menu\"]",
14+
"result_card": "li[data-test=\"list-object\"]"
15+
},
16+
"urls": {
17+
"oaipmh_response": "http://dev-5.pc:84/server/oai/request?verb=ListRecords&metadataPrefix=oai_dc",
18+
"redirect_to_login": "http://dev-5.pc:84/login?redirectUrl=http:%2F%2Fdev-5.pc:82%2Fhome",
19+
"not_exposed_data": "http://dev-5.pc:84/server/oai/request?verb=GetRecord&metadataPrefix=cmdi&identifier=oai:dev-5.pc:20.500.12800/1-4740"
20+
}
21+
}

0 commit comments

Comments
 (0)