Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

test(e2e): add cypress (DSP-468) #4

Merged
merged 20 commits into from
Feb 13, 2021
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ build --workspace_status_command=tools/buildstamp/get_workspace_status --stamp=y
startup --host_jvm_args=-Djavax.net.ssl.trustStore=/etc/ssl/certs/java/cacerts \
--host_jvm_args=-Djavax.net.ssl.trustStorePassword=changeit
test --test_output=errors --local_test_jobs=1 --runs_per_test 1


# Required for cypress_repository on macOS
build --experimental_inprocess_symlink_creation
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,10 @@ dump.rdb
dependencies.txt
/client-test-data.zip
/db_staging_dump.trig

node_modules
e2e/cypress/plugins
e2e/cypress/videos
e2e/cypress/fixtures
cypress/*

2 changes: 2 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package(default_visibility = ["//visibility:public"])

exports_files(["tsconfig.json", "cypress.json"])


10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ build: ## build all targets (excluding docs)
run: ## run app
@bazel run //app

.PHONY: yarn
yarn: ## install dependencies
@bazel run @nodejs//:yarn

#################################
# Docker targets
#################################
Expand All @@ -63,15 +67,15 @@ docker-publish: ## publish Tangoh image to Dockerhub
#################################

.PHONY: test-docker
test-docker: docker-build ## runs Docker image tests
test-docker: docker-build yarn ## runs Docker image tests
bazel test //docker/...

.PHONY: test-app
test-webapi: docker-build ## runs all app tests.
test-webapi: docker-build yarn ## runs all app tests.
bazel test //app/...

.PHONY: test
test: docker-build ## runs all test targets.
test: docker-build yarn ## runs all test targets.
bazel test //...

#################################
Expand Down
38 changes: 37 additions & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
workspace(name = "io_dasch_dsp_api")
workspace(
name = "io_dasch_dsp_api",
managed_directories = {"@npm": ["node_modules"]},
)

# load http_archive method
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
Expand Down Expand Up @@ -60,6 +63,39 @@ load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
protobuf_deps()


#
# download rules_nodejs (javascript)
#
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "dd4dc46066e2ce034cba0c81aa3e862b27e8e8d95871f567359f7a534cccb666",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.1.0/rules_nodejs-3.1.0.tar.gz"],
)

# NOTE: this rule installs nodejs, npm, and yarn, but does NOT install
# your npm dependencies into your node_modules folder.
# You must still run the package manager to do this.
load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories")
node_repositories(
node_version = "14.15.4",
package_json = ["//:package.json"],
)

load("@build_bazel_rules_nodejs//:package.bzl", "rules_nodejs_dev_dependencies")
rules_nodejs_dev_dependencies()

load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install")
yarn_install(
name = "npm",
package_json = "//:package.json",
yarn_lock = "//:yarn.lock",
)

load("@npm//@bazel/cypress:index.bzl", "cypress_repository")

# The name you pass here names the external repository you can load cypress_web_test from
cypress_repository(name = "cypress")

#
# download rules_webtesting (for browser tests of salsah1)
#
Expand Down
70 changes: 35 additions & 35 deletions app/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -65,38 +65,38 @@ scala_library(
],
)

scala_library(
name = "test_library",
testonly = True,
srcs = [
"//app/src/test/scala/org/knora/salsah:test_srcs",
],
# unused_dependency_checker_mode = "warn",
runtime_deps = [
"@maven//:ch_qos_logback_logback_classic",
"@maven//:ch_qos_logback_logback_core",
"@maven//:com_typesafe_akka_akka_slf4j_2_12",
"@maven//:org_slf4j_log4j_over_slf4j",
],
deps = [
":main_library",
"@io_bazel_rules_webtesting//java/com/google/testing/web",
"@maven//:com_typesafe_akka_akka_actor_2_12",
"@maven//:com_typesafe_akka_akka_http_2_12",
"@maven//:com_typesafe_akka_akka_http_core_2_12",
"@maven//:com_typesafe_akka_akka_stream_2_12",
"@maven//:com_typesafe_config",
"@maven//:org_scalatest_scalatest_2_12",
"@maven//:org_scalatest_scalatest_core_2_12",
"@maven//:org_scalatest_scalatest_wordspec_2_12",
"@maven//:org_scalatest_scalatest_matchers_core_2_12",
"@maven//:org_scalatest_scalatest_shouldmatchers_2_12",
"@maven//:org_scalatest_scalatest_compatible",
"@maven//:org_scalactic_scalactic_2_12",
# Selenium
"@maven//:org_seleniumhq_selenium_selenium_support",
"@org_seleniumhq_selenium_selenium_api", # pulled in by io_bazel_rules_webtesting
"@maven//:org_testcontainers_testcontainers",
"@maven//:junit_junit",
],
)
#scala_library(
# name = "test_library",
# testonly = True,
# srcs = [
# "//app/src/test/scala/org/knora/salsah:test_srcs",
# ],
# # unused_dependency_checker_mode = "warn",
# runtime_deps = [
# "@maven//:ch_qos_logback_logback_classic",
# "@maven//:ch_qos_logback_logback_core",
# "@maven//:com_typesafe_akka_akka_slf4j_2_12",
# "@maven//:org_slf4j_log4j_over_slf4j",
# ],
# deps = [
# ":main_library",
# "@io_bazel_rules_webtesting//java/com/google/testing/web",
# "@maven//:com_typesafe_akka_akka_actor_2_12",
# "@maven//:com_typesafe_akka_akka_http_2_12",
# "@maven//:com_typesafe_akka_akka_http_core_2_12",
# "@maven//:com_typesafe_akka_akka_stream_2_12",
# "@maven//:com_typesafe_config",
# "@maven//:org_scalatest_scalatest_2_12",
# "@maven//:org_scalatest_scalatest_core_2_12",
# "@maven//:org_scalatest_scalatest_wordspec_2_12",
# "@maven//:org_scalatest_scalatest_matchers_core_2_12",
# "@maven//:org_scalatest_scalatest_shouldmatchers_2_12",
# "@maven//:org_scalatest_scalatest_compatible",
# "@maven//:org_scalactic_scalactic_2_12",
# # Selenium
# "@maven//:org_seleniumhq_selenium_selenium_support",
# "@org_seleniumhq_selenium_selenium_api", # pulled in by io_bazel_rules_webtesting
# "@maven//:org_testcontainers_testcontainers",
# "@maven//:junit_junit",
# ],
#)