Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cypress-toolkit make commands. #16

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
53 changes: 53 additions & 0 deletions make/qa.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ LINT_PHP_TARGETS :=
CS_INSTALLED := $(shell test -f $(COMPOSER_JSON_PATH)/vendor/bin/phpcs && echo yes || echo no)
CS_CONF_EXISTS := $(shell test -f phpcs.xml.dist && echo yes || echo no)
TESTSUITES ?= unit,kernel,functional
CYPRESS_DIR = cypress-toolkit
CYPRESS_SETUP = $(shell test -d $(CYPRESS_DIR) && echo yes || echo no)
NVM_SH := $(HOME)/.nvm/nvm.sh
NODE_VERSION ?= 20

PHONY += fix
fix: ## Fix code style
Expand Down Expand Up @@ -71,3 +75,52 @@ define cs
$(call warn,CodeSniffer is not installed!)
endef
endif

PHONY += cypress-init
cypress-init: ## Init cypress
$(call step,Adding cypress-toolkit to the project...\n)
@git clone --recursive git@github.com:druidfi/cypress-toolkit.git

PHONY += cypress-install
cypress-install: ## Install Cypress packages
$(call step,Install npm packages\n)
@cd $(CYPRESS_DIR) && \
chmod u+x $(NVM_SH) && \
$(NVM_SH) use $(NODE_VERSION) && \
npm i --silence

PHONY += cypress-update
cypress-update: ## Update Cypress packages
$(call step,Update cypress-toolkit from github...\n)
@cd $(CYPRESS_DIR) && \
git pull origin main
$(call step,Update npm packages\n) && \
chmod u+x $(NVM_SH) && \
$(NVM_SH) use $(NODE_VERSION) && \
npm update

PHONY += cypress-open
cypress-open: ## Open Cypress UI
$(call step,Open Cypress UI...\n)
@cd $(CYPRESS_DIR) && \
npx cypress open

PHONY += cypress-run-tests
cypress-run-tests: ## Run cypress tests
ifeq ($(CYPRESS_SETUP), yes)
@cd $(CYPRESS_DIR) && \
chmod u+x $(NVM_SH) && \
$(NVM_SH) use $(NODE_VERSION)
ifeq ($(CYPRESS_LOCAL_CONFIG),yes)
@cd ../CYPRESS_LOCAL_DIR && \
cypress run --config-file ../tests/cypress/cypress.config.js
else
npx cypress run
endif
endif

PHONY += cypress-remove
cypress-remove: ## Run cypress tests
ifeq ($(CYPRESS_SETUP), yes)
@rm -fR $(CYPRESS_DIR)
endif