blob: 0be9bd8f8705dc290a4af2fb472c89244bd5cf2b [file] [log] [blame]
Ankush Menat3f14b922021-06-04 16:41:32 +05301name: UI
2
3on:
4 pull_request:
Ankush Menat8a6b82b2021-08-13 12:59:27 +05305 paths-ignore:
6 - '**.md'
Ankush Menat3f14b922021-06-04 16:41:32 +05307 workflow_dispatch:
8
9jobs:
10 test:
11 runs-on: ubuntu-18.04
Ankush0bb60b32021-07-29 17:15:12 +053012 timeout-minutes: 60
Ankush Menat3f14b922021-06-04 16:41:32 +053013
14 strategy:
15 fail-fast: false
16
17 name: UI Tests (Cypress)
18
19 services:
20 mysql:
21 image: mariadb:10.3
22 env:
23 MYSQL_ALLOW_EMPTY_PASSWORD: YES
24 ports:
25 - 3306:3306
26 options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
27
28 steps:
29 - name: Clone
30 uses: actions/checkout@v2
31
32 - name: Setup Python
33 uses: actions/setup-python@v2
34 with:
35 python-version: 3.7
36
37 - uses: actions/setup-node@v2
38 with:
39 node-version: 14
40 check-latest: true
41
42 - name: Add to Hosts
43 run: |
44 echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts
45
46 - name: Cache pip
47 uses: actions/cache@v2
48 with:
49 path: ~/.cache/pip
50 key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
51 restore-keys: |
52 ${{ runner.os }}-pip-
53 ${{ runner.os }}-
54
55 - name: Cache node modules
56 uses: actions/cache@v2
57 env:
58 cache-name: cache-node-modules
59 with:
60 path: ~/.npm
61 key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
62 restore-keys: |
63 ${{ runner.os }}-build-${{ env.cache-name }}-
64 ${{ runner.os }}-build-
65 ${{ runner.os }}-
66
67 - name: Get yarn cache directory path
68 id: yarn-cache-dir-path
69 run: echo "::set-output name=dir::$(yarn cache dir)"
70
71 - uses: actions/cache@v2
72 id: yarn-cache
73 with:
74 path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
75 key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
76 restore-keys: |
77 ${{ runner.os }}-yarn-
78
79 - name: Cache cypress binary
80 uses: actions/cache@v2
81 with:
82 path: ~/.cache
83 key: ${{ runner.os }}-cypress-
84 restore-keys: |
85 ${{ runner.os }}-cypress-
86 ${{ runner.os }}-
87
88 - name: Install
89 run: bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
90 env:
91 DB: mariadb
92 TYPE: ui
93
94 - name: Site Setup
95 run: cd ~/frappe-bench/ && bench --site test_site execute erpnext.setup.utils.before_tests
96
Ankush Menata68344f2021-06-29 21:33:55 +053097 - name: cypress pre-requisites
98 run: cd ~/frappe-bench/apps/frappe && yarn add cypress-file-upload@^5 --no-lockfile
99
Ankush Menat3f14b922021-06-04 16:41:32 +0530100
101 - name: Build Assets
102 run: cd ~/frappe-bench/ && bench build
103
104 - name: UI Tests
105 run: cd ~/frappe-bench/ && bench --site test_site run-ui-tests erpnext --headless
106 env:
Rucha Mahabal9dfddca2021-07-16 10:32:38 +0530107 CYPRESS_RECORD_KEY: 60a8e3bf-08f5-45b1-9269-2b207d7d30cd
Ankush Menat203c2b22021-07-02 22:35:15 +0530108
109 - name: Show bench console if tests failed
110 if: ${{ failure() }}
111 run: cat ~/frappe-bench/bench_run_logs.txt