Skip to content

Commit 66a4048

Browse files
KasinhouMatus Kasak
andauthored
UK/Running UI tests for UK customer (#884)
* Updated ui tests after deploy for uk customer * Added urls to test oaipmh * Delete unused playwright after import * Increased timeout in rest-tests --------- Co-authored-by: Matus Kasak <matus.kasak@dataquest.sk>
1 parent 6ac2504 commit 66a4048

2 files changed

Lines changed: 47 additions & 174 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 28 additions & 174 deletions
Original file line numberDiff line numberDiff line change
@@ -59,191 +59,45 @@ jobs:
5959
run: |
6060
./start.sh dspace-$INSTANCE
6161
62-
deploy-8:
63-
if: inputs.INSTANCE == '*' || inputs.INSTANCE == '8'
64-
runs-on: dspace-dep-1
65-
timeout-minutes: 120
66-
env:
67-
INSTANCE: '8'
68-
# 2024/02: this .env replaces ENTRYPOINT to angular
69-
# !!!!WARNING!!!!
70-
# disable TSL checks = allowing to cooperate with https backend with invalid
71-
# certificate
72-
ENVFILE: /opt/dspace-envs/.env.dspace.imported.dev-5
62+
playwright-after-deploy2:
63+
runs-on: dspace-test-1
64+
needs: deploy-2
65+
timeout-minutes: 45
66+
if: '!inputs.IMPORT'
7367
steps:
74-
- uses: actions/checkout@v4
75-
76-
- uses: ./.github/actions/erase-db
77-
if: inputs.ERASE_DB
68+
- name: Checkout Playwright tests
69+
uses: actions/checkout@v4
7870
with:
79-
INSTANCE: ${{ env.INSTANCE }}
80-
NAME: dspace-${{ env.INSTANCE }}
81-
82-
- name: deploy dspace-import on dev-5
83-
working-directory: build-scripts/run/
84-
run: |
85-
./start.sh dspace-$INSTANCE
86-
cd ../..
87-
# this is not necessary, since extra.yml doesn't contain any new images that weren't pulled within script above
88-
# 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
89-
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
90-
# this seems to be the easiest solution for now
91-
docker restart dockerized-nginx-with-shibboleth-nginx-1
92-
/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'
93-
71+
repository: dataquest-dev/dspace-ui-tests
72+
path: dspace-ui-tests
73+
token: ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}
9474

95-
import-8:
96-
runs-on: dspace-dep-1
97-
if: inputs.IMPORT
98-
needs: deploy-8
99-
env:
100-
INSTANCE: '8'
101-
ENVFILE: /opt/dspace-envs/.env.dspace.imported.dev-5
102-
steps:
103-
- uses: ./.github/actions/import-db
75+
- name: Checkout main repository
76+
uses: actions/checkout@v4
10477
with:
105-
INSTANCE: ${{ env.INSTANCE }}
106-
DATADIR: /opt/dspace-data/clarin-dspace/
107-
108-
- name: dspace basic command
109-
run: |
110-
export DNAME=dspace$INSTANCE
111-
docker logs -n 50 $DNAME
112-
113-
echo "dspace version:"
114-
docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace version"
115-
116-
echo "dspace cleanup:"
117-
docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace cleanup -v"
118-
119-
echo "dspace reindex solr:"
120-
docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace index-discovery -b"
121-
122-
echo "dspace reindex OAI-PMH:"
123-
docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace oai import -c"
124-
125-
echo "dspace checker:"
126-
docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace checker -v -l"
127-
128-
- name: dspace healthcheck
129-
run: |
130-
export DNAME=dspace$INSTANCE
131-
echo "dspace healthcheck:"
132-
docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace healthcheck -v"
133-
134-
playwright-after-deploy8:
135-
runs-on: ubuntu-latest
136-
needs: deploy-8
137-
timeout-minutes: 15
138-
if: '!inputs.IMPORT'
139-
steps:
140-
- name: run playwright
141-
run: |
142-
# wait until FE stabilizes a bit
143-
sleep 3m
144-
145-
curl -H "Accept: application/vnd.github.everest-preview+json" \
146-
-H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" \
147-
--request POST \
148-
https://api.github.com/repos/dataquest-dev/\
149-
dspace-ui-tests/actions/workflows/cron-test.yml/dispatches \
150-
--data "{\"ref\":\"refs/heads/master\"}" 2> /dev/null
151-
152-
# wait for it to start
153-
sleep 30s
154-
155-
# get result of last job
156-
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)
157-
158-
# while job did not finish, sleep
159-
while [[ $RES == 'null' ]]; do
160-
sleep 10s
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-
done;
163-
164-
echo $RES
165-
# if last result is not success, return -1 and fail
166-
if [[ $RES != \"success\" ]]; then
167-
echo "playwright tests have failed! check appropriate action run"
168-
exit 1
169-
fi;
78+
path: this-repository
17079

171-
rest-tests-after-deploy8:
172-
runs-on: ubuntu-latest
173-
needs: playwright-after-deploy8
174-
timeout-minutes: 15
175-
steps:
176-
- name: run rest-tests
80+
- name: Copy customer config to UI tests repository for merging
17781
run: |
178-
curl -H "Accept: application/vnd.github.everest-preview+json" \
179-
-H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" \
180-
--request POST \
181-
https://api.github.com/repos/dataquest-dev/\
182-
dspace-rest-test/actions/workflows/run_unittests.yml/dispatches \
183-
--data "{\"ref\":\"refs/heads/master\"}" 2> /dev/null
184-
185-
# wait for it to start
186-
sleep 30s
187-
188-
# get result of last job
189-
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-rest-test/actions/workflows/run_unittests.yml/runs?per_page=1 2> /dev/null | jq .workflow_runs[0].conclusion)
190-
191-
# while job did not finish, sleep
192-
while [[ $RES == 'null' ]]; do
193-
sleep 10s
194-
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-rest-test/actions/workflows/run_unittests.yml/runs?per_page=1 2> /dev/null | jq .workflow_runs[0].conclusion)
195-
done;
196-
197-
echo $RES
198-
# if last result is not success, return -1 and fail
199-
if [[ $RES != \"success\" ]]; then
200-
echo "rest-tests have failed! check appropriate action run"
201-
exit 1
202-
fi;
203-
82+
cp this-repository/config/config.uk.ui.tests.json dspace-ui-tests/customer-constants/
20483
205-
playwright-after-import8:
206-
runs-on: ubuntu-latest
207-
needs: import-8
208-
if: inputs.IMPORT
209-
timeout-minutes: 15
210-
steps:
211-
- name: run playwright
84+
- name: test
85+
working-directory: dspace-ui-tests/scripts
86+
env:
87+
HOME_URL: http://dev-5.pc:82/
88+
NAME: UK
21289
run: |
213-
# wait until FE stabilizes a bit
214-
sleep 3m
215-
216-
curl -H "Accept: application/vnd.github.everest-preview+json" \
217-
-H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" \
218-
--request POST \
219-
https://api.github.com/repos/dataquest-dev/\
220-
dspace-ui-tests/actions/workflows/cron-test.yml/dispatches \
221-
--data "{\"ref\":\"refs/heads/master\"}" 2> /dev/null
90+
./test.sh
22291
223-
# wait for it to start
224-
sleep 30s
225-
226-
# get result of last job
227-
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)
228-
229-
# while job did not finish, sleep
230-
while [[ $RES == 'null' ]]; do
231-
sleep 10s
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)
233-
done;
234-
235-
echo $RES
236-
# if last result is not success, return -1 and fail
237-
if [[ $RES != \"success\" ]]; then
238-
239-
echo "playwright tests have failed! check appropriate action run"
240-
exit 1
241-
fi;
92+
- uses: mazoea/ga-maz/end@master
93+
with:
94+
CHOWN_DIR: ./
95+
if: ${{ always() }}
24296

243-
rest-tests-after-import8:
97+
rest-tests-after-deploy2:
24498
runs-on: ubuntu-latest
245-
needs: playwright-after-import8
246-
timeout-minutes: 15
99+
needs: playwright-after-deploy2
100+
timeout-minutes: 45
247101
steps:
248102
- name: run rest-tests
249103
run: |

config/config.uk.ui.tests.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"env": {
3+
"has_discojuice": true,
4+
"has_whats_new": true,
5+
"has_profile_and_logout_link": false,
6+
"can_create_item_test": "disabled",
7+
"author_has_one_field": true
8+
},
9+
"locators": {
10+
"title": "LINDAT/CLARIAH-CZ Repository Home",
11+
"profile_link": "a[href=\"/profile\"]",
12+
"logout_link": "a[href=\"/logout\"]"
13+
},
14+
"urls": {
15+
"oaipmh_response": "http://dev-5.pc:82/server/oai/request?verb=ListRecords&metadataPrefix=oai_dc",
16+
"redirect_to_login": "http://dev-5.pc:82/login?redirectUrl=http:%2F%2Fdev-5.pc:82%2Fhome",
17+
"not_exposed_data": "http://dev-5.pc:82/server/oai/request?verb=GetRecord&metadataPrefix=cmdi&identifier=oai:dev-5.pc:20.500.12800/1-4740"
18+
}
19+
}

0 commit comments

Comments
 (0)