瀏覽代碼

test: rm cypress

Andelf 3 年之前
父節點
當前提交
63c55af453

+ 0 - 5
cypress/fixtures/example.json

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

+ 0 - 73
cypress/integration/app/basic.cljs

@@ -1,73 +0,0 @@
-(ns app.basic
-  "Basic operations"
-  (:require-macros [latte.core :refer [describe beforeEach before it]])
-  (:require [latte.chai :refer (expect)]
-            [app.util :as util])
-  (:refer-clojure :exclude [first get]))
-
-(def cy js/cy)
-
-(describe "basic"
-  (beforeEach []
-              (.clearIndexedDB cy))
-  (before []
-          (.. cy
-              (visit "http://localhost:3001")
-              (get "#main-content-container" #js {:timeout 10000})
-              (should (fn [result]
-                        (expect result :not.to.contain "Loading")))))
-
-  (it "Search" []
-    (.. cy
-        (get "#search-button")
-        (click)
-        (get "input.cp__palette-input")
-        (type "welcome to Logseq"))
-    (.. cy (get "#ui__ac-inner")
-        (should (fn [result]
-                  (expect result :to.have.length 1))))
-    (util/back-to-home)
-
-    ;; create new page
-    (.. cy
-        (get "#search-button")
-        (click)
-        (get "input.cp__palette-input")
-        (type "new page")
-        (wait 500)
-        (type "{enter}"))
-      
-    ;; edit bullet
-    (util/edit-block "this is my first bullet {enter}")
-    (util/edit-block "this is my second bullet {enter}")
-    (util/edit-block "this is my third bullet")
-    (util/tab)
-    (util/edit-block ", continue editing")
-    (util/shift+tab)
-    (util/edit-block ", continue {enter}")
-
-    ;; Backspace to delete a block
-    (util/edit-block "test")
-
-    ;; delete the previous block
-    (dorun (repeatedly 5 util/backspace))
-
-    (.. cy (get ".ls-block")
-        (should (fn [result]
-                  (expect result :to.have.length 3))))
-
-    (util/edit-block "{enter}")
-
-    ;; Del
-    (util/edit-block "test")
-    (util/edit-block "{leftarrow}{leftarrow}")
-    (util/delete)
-    (util/delete)
-
-    ;; FIXME: not working
-    ;; (match-content "te")
-
-    (util/edit-block "{enter}")
-
-    ;; Selection
-    (dorun (repeatedly 3 util/shift+up))))

+ 0 - 49
cypress/integration/app/template.cljs

@@ -1,49 +0,0 @@
-(ns app.template
-  "Template related operations"
-  (:require-macros [latte.core :refer [describe beforeEach before it]])
-  (:require [latte.chai :refer (expect)]
-            [app.util :as util])
-  (:refer-clojure :exclude [first get]))
-
-(def cy js/cy)
-
-(describe "template"
-          (beforeEach []
-                      (.clearIndexedDB cy)
-                      (cy.wait 1000))
-          (before []
-                  (.. cy
-                      (visit "http://localhost:3001")
-                      (get "#main-content-container" #js {:timeout 10000})
-                      (should (fn [result]
-                                (expect result :not.to.contain "Loading")))))
-          (it "template-basic" []
-              (.. cy
-                  (get "#search-button")
-                  (click)
-                  (get "input.cp__palette-input")
-                  (type "template test page")
-                  (wait 1000)
-                  (type "{enter}"))
-              (util/edit-block "template")
-              (.. cy
-                  (realPress #js ["Shift" "Enter"]))
-              (util/edit-block "template:: template-name{enter}{enter}")
-              (util/tab)
-              (util/edit-block "line1{enter}")
-              (util/edit-block "line2{enter}")
-              (util/tab)
-              (util/edit-block "line3")
-              (.. cy
-                  (get ".ls-block")
-                  (should (fn [result]
-                            (expect result :to.have.length 4))))
-              (dorun (repeatedly 3 #(util/edit-block "{enter}")))
-
-              (util/edit-block "/template{enter}")
-              (util/edit-block "template-name{enter}")
-              (cy.wait 1000)
-              (.. cy
-                  (get ".ls-block")
-                  (should (fn [result]
-                            (expect result :to.have.length 8))))))

+ 0 - 46
cypress/integration/app/util.cljs

@@ -1,46 +0,0 @@
-(ns app.util
-  (:refer-clojure :exclude [first get]))
-
-(def cy js/cy)
-
-(defn back-to-home
-  []
-  (.. cy (get ".ui__modal")
-      (first)
-      (click)))
-
-(defn edit-block
-  [content]
-  (.. cy (get "textarea")
-      (first)
-      (click)
-      (type content)))
-
-(defn tab
-  []
-  (.. cy (realPress "Tab")))
-
-(defn shift+tab
-  []
-  (.. cy (realPress #js ["Shift" "Tab"])))
-
-(defn shift+up
-  []
-  (.. cy (realPress #js ["Shift" "ArrowUp"])))
-
-(defn shift+down
-  []
-  (.. cy (realPress #js ["Shift" "ArrowDown"])))
-
-(defn backspace
-  []
-  (edit-block "{backspace}"))
-
-(defn delete
-  []
-  (.. cy (realPress "Delete")))
-
-(defn match-content
-  [value]
-  (.. cy (get "textarea") (first)
-      (should "have.value" value)))

+ 0 - 7
cypress/plugins/index.js

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

+ 0 - 44
cypress/support/commands.js

@@ -1,44 +0,0 @@
-// ***********************************************
-// 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) => { ... })
-
-Cypress.Commands.add('clearIndexedDB', async () => {
-  const databases = await window.indexedDB.databases();
-
-  await Promise.all(
-    databases.map(
-      ({ name }) =>
-      new Promise((resolve, reject) => {
-        const request = window.indexedDB.deleteDatabase(name);
-
-        request.addEventListener('success', resolve);
-        // Note: we need to also listen to the "blocked" event
-        // (and resolve the promise) due to https://stackoverflow.com/a/35141818
-        request.addEventListener('blocked', resolve);
-        request.addEventListener('error', reject);
-      }),
-    ),
-  );
-});

+ 0 - 22
cypress/support/index.js

@@ -1,22 +0,0 @@
-// ***********************************************************
-// 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')
-
-import "cypress-real-events/support";

+ 0 - 3
package.json

@@ -9,7 +9,6 @@
         "@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",
@@ -75,8 +74,6 @@
         "chokidar": "3.5.1",
         "chrono-node": "2.2.4",
         "codemirror": "5.58.1",
-        "cypress-clojurescript-preprocessor": "0.1.4",
-        "cypress-real-events": "1.5.0",
         "d3-force": "3.0.0",
         "diff": "5.0.0",
         "diff-match-patch": "1.0.5",