Skip to content

Commit

Permalink
Add integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
amake committed Mar 24, 2024
1 parent 2a60c59 commit 9c3b243
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@

# Exceptions to above rules.
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages

# Custom
.env
test-integration.png
19 changes: 17 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ build-release: ## Build the web artifact for release
build-release: build_args += --release
build-release: build

serve = cd $(1) && python3 -m http.server & pid=$$!; trap 'kill $$pid' EXIT
serve = python3 -m http.server --directory $(1) & trap "kill $$!" EXIT

.PHONY: web-release-serve
web-release-serve: ## Serve the web release locally over HTTP
Expand All @@ -23,7 +23,7 @@ web-release-serve: build

.PHONY: test
test: ## Run tests
test: lint test-unit
test: lint test-unit test-integration

.PHONY: lint
lint: ## Run linter
Expand All @@ -33,6 +33,21 @@ lint: ## Run linter
test-unit: ## Run unit tests
flutter test

env := .env

$(env):
python3 -m venv $(@)
$(@)/bin/pip install shot-scraper
$(@)/bin/shot-scraper install

.PHONY: test-integration
test-integration: $(env) ## Run integration tests
$(call serve,build/web); $(env)/bin/shot-scraper 'http://localhost:8000?q=a' \
--wait-for 'document.querySelector("flutter-view")' \
-o $(@).png \
--log-console 2>&1 \
| awk '/Failed/ {f++}; {print}; END {exit f}'

.PHONY: clean
clean: ## Clean up build artifacts
flutter clean
Expand Down

0 comments on commit 9c3b243

Please sign in to comment.