浏览代码

test: cypress scaffolding

Tienson Qin 4 年之前
父节点
当前提交
f0af0f05dd
共有 9 个文件被更改,包括 918 次插入3 次删除
  1. 2 1
      .gitignore
  2. 1 0
      cypress.json
  3. 5 0
      cypress/fixtures/example.json
  4. 10 0
      cypress/integration/app/window.cljs
  5. 7 0
      cypress/plugins/index.js
  6. 25 0
      cypress/support/commands.js
  7. 20 0
      cypress/support/index.js
  8. 3 0
      package.json
  9. 845 2
      yarn.lock

+ 2 - 1
.gitignore

@@ -33,4 +33,5 @@ resources/electron.js
 .lsp/
 /libs/dist/
 charlie/
-.vscode
+.vscode
+/.preprocessor-cljs

+ 1 - 0
cypress.json

@@ -0,0 +1 @@
+{}

+ 5 - 0
cypress/fixtures/example.json

@@ -0,0 +1,5 @@
+{
+  "name": "Using fixtures to represent data",
+  "email": "[email protected]",
+  "body": "Fixtures are a great way to mock data for responses to routes"
+}

+ 10 - 0
cypress/integration/app/window.cljs

@@ -0,0 +1,10 @@
+(ns app.window
+  (:require-macros [latte.core :refer [describe beforeEach it]]))
+
+(def cy js/cy)
+
+(describe "Window"
+  (beforeEach []
+    (.visit cy "https://example.cypress.io/commands/window"))
+  (it "cy.window() - get the global window object" []
+    (.should (.window cy) "have.property" "top")))

+ 7 - 0
cypress/plugins/index.js

@@ -0,0 +1,7 @@
+const makeCljsPreprocessor = require('cypress-clojurescript-preprocessor');
+/**
+ * @type {Cypress.PluginConfig}
+ */
+module.exports = (on, config) => {
+  on('file:preprocessor', makeCljsPreprocessor(config));
+};

+ 25 - 0
cypress/support/commands.js

@@ -0,0 +1,25 @@
+// ***********************************************
+// This example commands.js shows you how to
+// create various custom commands and overwrite
+// existing commands.
+//
+// For more comprehensive examples of custom
+// commands please read more here:
+// https://on.cypress.io/custom-commands
+// ***********************************************
+//
+//
+// -- This is a parent command --
+// Cypress.Commands.add('login', (email, password) => { ... })
+//
+//
+// -- This is a child command --
+// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
+//
+//
+// -- This is a dual command --
+// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
+//
+//
+// -- This will overwrite an existing command --
+// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })

+ 20 - 0
cypress/support/index.js

@@ -0,0 +1,20 @@
+// ***********************************************************
+// This example support/index.js is processed and
+// loaded automatically before your test files.
+//
+// This is a great place to put global configuration and
+// behavior that modifies Cypress.
+//
+// You can change the location of this file or turn off
+// automatically serving support files with the
+// 'supportFile' configuration option.
+//
+// You can read more here:
+// https://on.cypress.io/configuration
+// ***********************************************************
+
+// Import commands.js using ES2015 syntax:
+import './commands'
+
+// Alternatively you can use CommonJS syntax:
+// require('./commands')

+ 3 - 0
package.json

@@ -9,6 +9,7 @@
         "@types/gulp": "^4.0.7",
         "cross-env": "^7.0.3",
         "cssnano": "^4.1.10",
+        "cypress": "^7.5.0",
         "del": "^6.0.0",
         "gulp": "^4.0.2",
         "gulp-clean-css": "^4.3.0",
@@ -35,6 +36,7 @@
         "dev-electron-app": "gulp electron",
         "release-electron": "run-s gulp:build && gulp electronMaker",
         "debug-electron": "cd static/ && yarn electron:debug",
+        "e2e-test": "./node_modules/.bin/cypress open",
         "clean": "gulp clean",
         "test": "run-s cljs:test cljs:run-test",
         "report": "run-s cljs:report",
@@ -65,6 +67,7 @@
         "chokidar": "^3.5.1",
         "chrono-node": "^2.2.4",
         "codemirror": "^5.58.1",
+        "cypress-clojurescript-preprocessor": "^0.1.4",
         "diff": "5.0.0",
         "diff-match-patch": "^1.0.5",
         "electron": "^13.0.0",

文件差异内容过多而无法显示
+ 845 - 2
yarn.lock


部分文件因为文件数量过多而无法显示