summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorGeorge Goldberg <george@gberg.me>2017-03-23 18:05:36 +0000
committerChristopher Speller <crspeller@gmail.com>2017-03-23 14:05:36 -0400
commit7d449e05562c76bb430efc1c36bd715675a84152 (patch)
treeb6d5bbd143fbd31483c9c931b5031aec280ace2d /cmd
parentc6ded1dbfd69a1da69add8d2b554f4b7dd0341b3 (diff)
downloadchat-7d449e05562c76bb430efc1c36bd715675a84152.tar.gz
chat-7d449e05562c76bb430efc1c36bd715675a84152.tar.bz2
chat-7d449e05562c76bb430efc1c36bd715675a84152.zip
PLT-5755: Infrastructure for Component Testing. (#5814)
This migrates the existing webapp tests to using Jest and Enzyme. The infrastructure is put in place for React component testing, and a few simple example component tests are implemented. This also adds snapshot testing of components, coverage checking for the webapp (although that is not yet integrated to Coveralls), and the ability to run npm run test:watch to automatically re-run affected tests when working on the webapp codebase.
Diffstat (limited to 'cmd')
-rw-r--r--cmd/platform/test.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/cmd/platform/test.go b/cmd/platform/test.go
index 65a8528d0..cf67d6702 100644
--- a/cmd/platform/test.go
+++ b/cmd/platform/test.go
@@ -10,9 +10,12 @@ import (
"os/exec"
"github.com/mattermost/platform/api"
+ "github.com/mattermost/platform/api4"
"github.com/mattermost/platform/app"
"github.com/mattermost/platform/utils"
"github.com/spf13/cobra"
+ "os/signal"
+ "syscall"
)
var testCmd = &cobra.Command{
@@ -27,9 +30,16 @@ var runWebClientTestsCmd = &cobra.Command{
RunE: webClientTestsCmdF,
}
+var runServerForWebClientTestsCmd = &cobra.Command{
+ Use: "web_client_tests_server",
+ Short: "Run the server configured for running the web client tests against it",
+ RunE: serverForWebClientTestsCmdF,
+}
+
func init() {
testCmd.AddCommand(
runWebClientTestsCmd,
+ runServerForWebClientTestsCmd,
)
}
@@ -37,6 +47,7 @@ func webClientTestsCmdF(cmd *cobra.Command, args []string) error {
initDBCommandContextCobra(cmd)
utils.InitTranslations(utils.Cfg.LocalizationSettings)
api.InitRouter()
+ api4.InitApi(false)
api.InitApi()
setupClientTests()
app.StartServer()
@@ -46,6 +57,24 @@ func webClientTestsCmdF(cmd *cobra.Command, args []string) error {
return nil
}
+func serverForWebClientTestsCmdF(cmd *cobra.Command, args []string) error {
+ initDBCommandContextCobra(cmd)
+ utils.InitTranslations(utils.Cfg.LocalizationSettings)
+ api.InitRouter()
+ api4.InitApi(false)
+ api.InitApi()
+ setupClientTests()
+ app.StartServer()
+
+ c := make(chan os.Signal)
+ signal.Notify(c, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
+ <-c
+
+ app.StopServer()
+
+ return nil
+}
+
func setupClientTests() {
*utils.Cfg.TeamSettings.EnableOpenServer = true
*utils.Cfg.ServiceSettings.EnableCommands = false