-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile-integration
162 lines (128 loc) · 4.81 KB
/
Makefile-integration
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
INTEGRATION_TEST_TMP=$(TMP)/integration
INTEGRATION_BUILT_MARK=$(INTEGRATION_TEST_TMP)/.built
#
# integration-test-{flavor}-test:
# - tests/styles/references/{flavor}: references for screenshots (flat)
# - $(INTEGRATION_TEST_TMP)/{flavor}runtime/screenshots: screenshot taken during test (by folders)
# - $(INTEGRATION_TEST_TMP)/{flavor}/.tested: mark
#
# integration-test-{flavor}-styles:
# - $(INTEGRATION_TEST_TMP)/{flavor}/differences
# - $(INTEGRATION_TEST_TMP)/{flavor}/styles.json
#
integration: clear integration-dump integration-test ok
integration-full: clear clean-files dc-build dc-up integration-dump integration-test ok
.PHONY: integration-dump
dump: integration-dump
integration-dump:
@echo ""
@echo "*******************"
@echo "*** integration ***"
@echo ""
@echo "INTEGRATION_TEST_TMP: $(INTEGRATION_TEST_TMP)"
# @echo "Cypress: $(shell QUIET=y bin/cr-cypress version )"
.PHONY: integration-clean
clean: integration-clean
integration-clean: integration-clean-files
# Playwright browser cache
rm -fr "$(HOME)/.cache/ms-playwright"
.PHONY: integration-clean-files
clean: integration-clean-files
reset: integration-clean-files
integration-clean-files:
rm -fr "$(ROOT)/$(TMP)/integration"
rm -fr "$(ROOT)/live/"
jh-kill-by-port 9515 || true
.PHONY: integration-build
build: integration-build
integration-build: $(INTEGRATION_BUILT_MARK)
$(INTEGRATION_BUILT_MARK): \
$(BACKEND_BUILT_MARK) \
$(FRONTEND_BUILT_MARK) \
www/built/browsers.json
@mkdir -p "$(dir $@)"
@touch "$@"
www/built/browsers.json: .browserslistrc $(FRONTEND_DEPENDENCIES_MARK)
@mkdir -p "$(dir $@)"
# pipe will not work with snap
node_modules/.bin/browserslist --json | tee "$@"
@touch "$@"
.PHONY: integration-test
test: integration-test
integration-test: integration-test-desktop integration-test-playwright
integration-test-open: $(INTEGRATION_BUILT_MARK)
./bin/cr-cypress open "$(INTEGRATION_TEST_TMP)/desktop/runtime"
.PHONY: integration-update-references-styles
update: integration-update-references-styles
integration-update-references-styles: \
integration-update-references-styles-desktop
##############################
#
# Cypress - Destop
#
.PHONY: integration-test-desktop
integration-test-desktop: integration-test-desktop-run integration-test-desktop-styles
.PHONY: integration-test-desktop-test
integration-test-desktop-run: $(INTEGRATION_TEST_TMP)/desktop/.tested
$(INTEGRATION_TEST_TMP)/desktop/.tested: \
$(INTEGRATION_BUILT_MARK) \
$(shell find tests/cypress/ -name "*.js")
@mkdir -p "$(dir $@)"
bin/cr-cypress "desktop" "$(INTEGRATION_TEST_TMP)/desktop/runtime"
@touch "$@"
.PHONY: integration-test-desktop-styles
integration-test-desktop-styles: $(INTEGRATION_TEST_TMP)/desktop/styles.json
$(INTEGRATION_TEST_TMP)/desktop/styles.json: $(INTEGRATION_TEST_TMP)/desktop/.tested \
tests/styles/check-styles.ts
@mkdir -p "$(dir $@)"
node_modules/.bin/tsx tests/styles/check-styles.ts \
--references="tests/styles/references/desktop" \
--results="$(INTEGRATION_TEST_TMP)/desktop" \
--screenshots="$(INTEGRATION_TEST_TMP)/desktop/runtime/screenshots"
.PHONY: integration-update-references-styles-desktop
update: integration-update-references-styles-desktop
integration-update-references-styles-desktop:
node_modules/.bin/tsx tests/styles/check-styles.ts \
--references="tests/styles/references/desktop" \
--results="$(INTEGRATION_TEST_TMP)/desktop" \
--screenshots="$(INTEGRATION_TEST_TMP)/desktop/runtime/screenshots" \
--update
##############################
#
# Playwright
#
.PHONY: integration-test-playwright
integration-test-playwright: integration-test-playwright-deps
node_modules/.bin/playwright test --update-snapshots
.PHONY: integration-test-playwright-strict
integration-test-playwright-strict: integration-test-playwright-deps
node_modules/.bin/playwright test
.PHONY: integration-test-playwright-headed
integration-test-playwright-headed: integration-test-playwright-deps
node_modules/.bin/playwright test --ui
.PHONY: integration-test-playwright-deps
integration-test-playwright-deps: \
$(INTEGRATION_BUILT_MARK) \
$(shell find tests/e2e/ -name "*.ts") \
playwright.config.ts \
$(HOME)/.cache/ms-playwright
.PHONY: integration-update-playwright-browsers
update: integration-update-playwright-browsers
integration-update-playwright-browsers:
$(MAKE) $(HOME)/.cache/ms-playwright
$(HOME)/.cache/ms-playwright:
node_modules/.bin/playwright install
########################################3
#
# Update
#
.PHONY: integration-update-download-github
integration-update-download-github:
bin/cr-github-get-artifacts
@echo "To update cypress snapshots, run make integration-update-to-commit"
.PHONY: integration-update-to-commit
integration-update-to-commit:
@echo
@echo "** styles-desktop"
make integration-update-references-styles-desktop
@echo