Skip to content

Commit 5ee3968

Browse files
KasinhouMatus Kasak
andauthored
ZCU-DATA/Running playwright tests for zcu-data customer (#929)
Co-authored-by: Matus Kasak <matus.kasak@dataquest.sk>
1 parent 596880e commit 5ee3968

3 files changed

Lines changed: 62 additions & 69 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 7 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -133,46 +133,15 @@ jobs:
133133
docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace healthcheck -v"
134134
135135
playwright-after-deploy8:
136-
runs-on: ubuntu-latest
137136
needs: deploy-8
138-
timeout-minutes: 15
139137
if: '!inputs.IMPORT'
140-
steps:
141-
- name: run playwright
142-
run: |
143-
# wait until FE stabilizes a bit
144-
sleep 3m
145-
146-
curl -H "Accept: application/vnd.github.everest-preview+json" \
147-
-H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" \
148-
--request POST \
149-
https://api.github.com/repos/dataquest-dev/\
150-
dspace-ui-tests/actions/workflows/cron-test.yml/dispatches \
151-
--data "{\"ref\":\"refs/heads/master\"}" 2> /dev/null
152-
153-
# wait for it to start
154-
sleep 30s
155-
156-
# get result of last job
157-
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)
158-
159-
# while job did not finish, sleep
160-
while [[ $RES == 'null' ]]; do
161-
sleep 10s
162-
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)
163-
done;
164-
165-
echo $RES
166-
# if last result is not success, return -1 and fail
167-
if [[ $RES != \"success\" ]]; then
168-
echo "playwright tests have failed! check appropriate action run"
169-
exit 1
170-
fi;
138+
uses: ./.github/workflows/playwright-tests.yml
139+
secrets: inherit
171140

172141
rest-tests-after-deploy8:
173142
runs-on: ubuntu-latest
174143
needs: playwright-after-deploy8
175-
timeout-minutes: 15
144+
timeout-minutes: 45
176145
steps:
177146
- name: run rest-tests
178147
run: |
@@ -204,47 +173,16 @@ jobs:
204173
205174
206175
playwright-after-import8:
207-
runs-on: ubuntu-latest
208176
needs: import-8
209177
if: inputs.IMPORT
210-
timeout-minutes: 15
211-
steps:
212-
- name: run playwright
213-
run: |
214-
# wait until FE stabilizes a bit
215-
sleep 3m
216-
217-
curl -H "Accept: application/vnd.github.everest-preview+json" \
218-
-H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" \
219-
--request POST \
220-
https://api.github.com/repos/dataquest-dev/\
221-
dspace-ui-tests/actions/workflows/cron-test.yml/dispatches \
222-
--data "{\"ref\":\"refs/heads/master\"}" 2> /dev/null
223-
224-
# wait for it to start
225-
sleep 30s
226-
227-
# get result of last job
228-
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)
229-
230-
# while job did not finish, sleep
231-
while [[ $RES == 'null' ]]; do
232-
sleep 10s
233-
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)
234-
done;
235-
236-
echo $RES
237-
# if last result is not success, return -1 and fail
238-
if [[ $RES != \"success\" ]]; then
239-
240-
echo "playwright tests have failed! check appropriate action run"
241-
exit 1
242-
fi;
178+
uses: ./.github/workflows/playwright-tests.yml
179+
secrets: inherit
180+
243181

244182
rest-tests-after-import8:
245183
runs-on: ubuntu-latest
246184
needs: playwright-after-import8
247-
timeout-minutes: 15
185+
timeout-minutes: 45
248186
steps:
249187
- name: run rest-tests
250188
run: |
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Playwright tests
2+
3+
on:
4+
workflow_dispatch:
5+
workflow_call:
6+
7+
jobs:
8+
playwright-tests:
9+
runs-on: dspace-test-1
10+
timeout-minutes: 45
11+
steps:
12+
- name: Checkout Playwright tests
13+
uses: actions/checkout@v4
14+
with:
15+
repository: dataquest-dev/dspace-ui-tests
16+
path: dspace-ui-tests
17+
token: ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}
18+
19+
- name: Checkout main repository
20+
uses: actions/checkout@v4
21+
with:
22+
path: this-repository
23+
24+
- name: Copy customer config to UI tests repository for merging
25+
run: |
26+
cp this-repository/config/config.zcu-data.ui.tests.json dspace-ui-tests/customer-constants/
27+
- name: test
28+
working-directory: dspace-ui-tests/scripts
29+
env:
30+
HOME_URL: http://dev-5.pc:89/
31+
NAME: ZCU-DATA
32+
run: |
33+
./test.sh
34+
- uses: mazoea/ga-maz/end@master
35+
with:
36+
CHOWN_DIR: ./
37+
if: ${{ always() }}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"env": {
3+
"has_discojuice": false,
4+
"has_profile_and_logout_link": true,
5+
"has_resource_select": false,
6+
"has_contact_person": false,
7+
"has_license_select": false,
8+
"has_size_dropdown": false,
9+
"has_imported_items": false
10+
},
11+
"locators": {
12+
"title": "DSpace at University of West Bohemia Home",
13+
"profile_link": "a[href=\"/profile\"]",
14+
"logout_link": "button[data-test=\"logout-button\"]",
15+
"signon_link": "a[data-test=\"login-menu\"]",
16+
"result_card": "li[data-test=\"list-object\"]"
17+
}
18+
}

0 commit comments

Comments
 (0)