blob: ab6a53b5d925a4460e9cbb4bf7e6e6fe5670ce99 [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
Ankush Menat9de0f752021-08-30 14:07:13 +05309concurrency:
10 group: ui-develop-${{ github.event.number }}
11 cancel-in-progress: true
12
Ankush Menat3f14b922021-06-04 16:41:32 +053013jobs:
14 test:
Ankush Menat602374a2021-08-30 18:24:48 +053015 runs-on: ubuntu-latest
Ankush0bb60b32021-07-29 17:15:12 +053016 timeout-minutes: 60
Ankush Menat3f14b922021-06-04 16:41:32 +053017
18 strategy:
19 fail-fast: false
20
21 name: UI Tests (Cypress)
22
23 services:
24 mysql:
25 image: mariadb:10.3
26 env:
27 MYSQL_ALLOW_EMPTY_PASSWORD: YES
28 ports:
29 - 3306:3306
30 options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
31
32 steps:
33 - name: Clone
34 uses: actions/checkout@v2
35
36 - name: Setup Python
37 uses: actions/setup-python@v2
38 with:
Ankush Menat2854f632022-01-10 13:51:06 +053039 python-version: 3.8
Ankush Menat3f14b922021-06-04 16:41:32 +053040
41 - uses: actions/setup-node@v2
42 with:
43 node-version: 14
44 check-latest: true
45
46 - name: Add to Hosts
47 run: |
48 echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts
49
50 - name: Cache pip
51 uses: actions/cache@v2
52 with:
53 path: ~/.cache/pip
54 key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
55 restore-keys: |
56 ${{ runner.os }}-pip-
57 ${{ runner.os }}-
58
59 - name: Cache node modules
60 uses: actions/cache@v2
61 env:
62 cache-name: cache-node-modules
63 with:
64 path: ~/.npm
65 key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
66 restore-keys: |
67 ${{ runner.os }}-build-${{ env.cache-name }}-
68 ${{ runner.os }}-build-
69 ${{ runner.os }}-
70
71 - name: Get yarn cache directory path
72 id: yarn-cache-dir-path
73 run: echo "::set-output name=dir::$(yarn cache dir)"
74
75 - uses: actions/cache@v2
76 id: yarn-cache
77 with:
78 path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
79 key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
80 restore-keys: |
81 ${{ runner.os }}-yarn-
82
83 - name: Cache cypress binary
84 uses: actions/cache@v2
85 with:
86 path: ~/.cache
87 key: ${{ runner.os }}-cypress-
88 restore-keys: |
89 ${{ runner.os }}-cypress-
90 ${{ runner.os }}-
91
92 - name: Install
93 run: bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
94 env:
95 DB: mariadb
96 TYPE: ui
97
98 - name: Site Setup
99 run: cd ~/frappe-bench/ && bench --site test_site execute erpnext.setup.utils.before_tests
100
Ankush Menata68344f2021-06-29 21:33:55 +0530101 - name: cypress pre-requisites
Ankush Menatae55eab2021-08-26 20:43:06 +0530102 run: cd ~/frappe-bench/apps/frappe && yarn add cypress-file-upload@^5 @testing-library/cypress@^8 --no-lockfile
Ankush Menata68344f2021-06-29 21:33:55 +0530103
Ankush Menat3f14b922021-06-04 16:41:32 +0530104
105 - name: Build Assets
106 run: cd ~/frappe-bench/ && bench build
Ankush Menat35e30bd2021-10-05 21:44:34 +0530107 env:
108 CI: Yes
Ankush Menat3f14b922021-06-04 16:41:32 +0530109
110 - name: UI Tests
111 run: cd ~/frappe-bench/ && bench --site test_site run-ui-tests erpnext --headless
112 env:
Rucha Mahabal9dfddca2021-07-16 10:32:38 +0530113 CYPRESS_RECORD_KEY: 60a8e3bf-08f5-45b1-9269-2b207d7d30cd
Ankush Menat203c2b22021-07-02 22:35:15 +0530114
115 - name: Show bench console if tests failed
116 if: ${{ failure() }}
117 run: cat ~/frappe-bench/bench_run_logs.txt