mirror of
https://github.com/vxcontrol/ncform.git
synced 2026-07-19 18:23:32 -04:00
test: init e2e test
This commit is contained in:
+92
-2
@@ -2,7 +2,97 @@ version: 2
|
||||
jobs:
|
||||
build:
|
||||
docker:
|
||||
- image: circleci/ruby:2.4.1
|
||||
- image: circleci/node:8.15
|
||||
working_directory: ~/project/ncform
|
||||
steps:
|
||||
- checkout
|
||||
- run: echo "hello ncform"
|
||||
- restore_cache:
|
||||
keys:
|
||||
- v1-dependencies-{{ checksum "package.json" }}
|
||||
- v1-dependencies-
|
||||
- run: npm install
|
||||
- save_cache:
|
||||
paths:
|
||||
- node_modules
|
||||
key: v1-dependencies-{{ checksum "package.json" }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- v1-dependencies-ncform-{{ checksum "packages/ncform/package.json" }}
|
||||
- v1-dependencies-ncform
|
||||
- restore_cache:
|
||||
keys:
|
||||
- v1-dependencies-ncform-common-{{ checksum "packages/ncform-common/package.json" }}
|
||||
- v1-dependencies-ncform-common
|
||||
- restore_cache:
|
||||
keys:
|
||||
- v1-dependencies-ncform-show-{{ checksum "packages/ncform-show/package.json" }}
|
||||
- v1-dependencies-ncform-show
|
||||
- restore_cache:
|
||||
keys:
|
||||
- v1-dependencies-ncform-theme-elementui-{{ checksum "packages/ncform-theme-elementui/package.json" }}
|
||||
- v1-dependencies-ncform-theme-elementui
|
||||
- run: npm run bootstrap
|
||||
- save_cache:
|
||||
paths:
|
||||
- packages/ncform/node_modules
|
||||
key: v1-dependencies-ncform-{{ checksum "packages/ncform/package.json" }}
|
||||
- save_cache:
|
||||
paths:
|
||||
- packages/ncform-common/node_modules
|
||||
key: v1-dependencies-ncform-common-{{ checksum "packages/ncform-common/package.json" }}
|
||||
- save_cache:
|
||||
paths:
|
||||
- packages/ncform-show/node_modules
|
||||
key: v1-dependencies-ncform-show-{{ checksum "packages/ncform-show/package.json" }}
|
||||
- save_cache:
|
||||
paths:
|
||||
- packages/ncform-theme-elementui/node_modules
|
||||
key: v1-dependencies-ncform-theme-elementui-{{ checksum "packages/ncform-theme-elementui/package.json" }}
|
||||
- run: npm run build
|
||||
- persist_to_workspace:
|
||||
root: ~/project
|
||||
paths:
|
||||
- ncform
|
||||
unittest:
|
||||
docker:
|
||||
- image: circleci/node:8.15
|
||||
working_directory: ~/project/ncform
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: ~/project
|
||||
- run: npm run test
|
||||
run-ncform-dev-server:
|
||||
docker:
|
||||
- image: circleci/node:8.15
|
||||
working_directory: ~/project/ncform
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: ~/project
|
||||
- run: cd packages/ncform && npm run dev
|
||||
e2etest:
|
||||
docker:
|
||||
- image: circleci/node:8.15
|
||||
working_directory: ~/project/ncform
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: ~/project
|
||||
- run: cd packages/ncform-e2e
|
||||
- run: npm run test-ncform:cli
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
unit-test:
|
||||
jobs:
|
||||
- build
|
||||
- unittest:
|
||||
requires:
|
||||
- build
|
||||
e2e-test:
|
||||
jobs:
|
||||
- build
|
||||
- run-ncform-dev-server:
|
||||
requires:
|
||||
- build
|
||||
- e2etest:
|
||||
requires:
|
||||
- run-ncform-dev-server
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
ncform/cypress/videos
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"projectId": "enxoqt"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "Using fixtures to represent data",
|
||||
"email": "hello@cypress.io",
|
||||
"body": "Fixtures are a great way to mock data for responses to routes"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"id": 8739,
|
||||
"name": "Jane",
|
||||
"email": "jane@example.com"
|
||||
}
|
||||
@@ -0,0 +1,232 @@
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"name": "Leanne Graham",
|
||||
"username": "Bret",
|
||||
"email": "Sincere@april.biz",
|
||||
"address": {
|
||||
"street": "Kulas Light",
|
||||
"suite": "Apt. 556",
|
||||
"city": "Gwenborough",
|
||||
"zipcode": "92998-3874",
|
||||
"geo": {
|
||||
"lat": "-37.3159",
|
||||
"lng": "81.1496"
|
||||
}
|
||||
},
|
||||
"phone": "1-770-736-8031 x56442",
|
||||
"website": "hildegard.org",
|
||||
"company": {
|
||||
"name": "Romaguera-Crona",
|
||||
"catchPhrase": "Multi-layered client-server neural-net",
|
||||
"bs": "harness real-time e-markets"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "Ervin Howell",
|
||||
"username": "Antonette",
|
||||
"email": "Shanna@melissa.tv",
|
||||
"address": {
|
||||
"street": "Victor Plains",
|
||||
"suite": "Suite 879",
|
||||
"city": "Wisokyburgh",
|
||||
"zipcode": "90566-7771",
|
||||
"geo": {
|
||||
"lat": "-43.9509",
|
||||
"lng": "-34.4618"
|
||||
}
|
||||
},
|
||||
"phone": "010-692-6593 x09125",
|
||||
"website": "anastasia.net",
|
||||
"company": {
|
||||
"name": "Deckow-Crist",
|
||||
"catchPhrase": "Proactive didactic contingency",
|
||||
"bs": "synergize scalable supply-chains"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"name": "Clementine Bauch",
|
||||
"username": "Samantha",
|
||||
"email": "Nathan@yesenia.net",
|
||||
"address": {
|
||||
"street": "Douglas Extension",
|
||||
"suite": "Suite 847",
|
||||
"city": "McKenziehaven",
|
||||
"zipcode": "59590-4157",
|
||||
"geo": {
|
||||
"lat": "-68.6102",
|
||||
"lng": "-47.0653"
|
||||
}
|
||||
},
|
||||
"phone": "1-463-123-4447",
|
||||
"website": "ramiro.info",
|
||||
"company": {
|
||||
"name": "Romaguera-Jacobson",
|
||||
"catchPhrase": "Face to face bifurcated interface",
|
||||
"bs": "e-enable strategic applications"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"name": "Patricia Lebsack",
|
||||
"username": "Karianne",
|
||||
"email": "Julianne.OConner@kory.org",
|
||||
"address": {
|
||||
"street": "Hoeger Mall",
|
||||
"suite": "Apt. 692",
|
||||
"city": "South Elvis",
|
||||
"zipcode": "53919-4257",
|
||||
"geo": {
|
||||
"lat": "29.4572",
|
||||
"lng": "-164.2990"
|
||||
}
|
||||
},
|
||||
"phone": "493-170-9623 x156",
|
||||
"website": "kale.biz",
|
||||
"company": {
|
||||
"name": "Robel-Corkery",
|
||||
"catchPhrase": "Multi-tiered zero tolerance productivity",
|
||||
"bs": "transition cutting-edge web services"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"name": "Chelsey Dietrich",
|
||||
"username": "Kamren",
|
||||
"email": "Lucio_Hettinger@annie.ca",
|
||||
"address": {
|
||||
"street": "Skiles Walks",
|
||||
"suite": "Suite 351",
|
||||
"city": "Roscoeview",
|
||||
"zipcode": "33263",
|
||||
"geo": {
|
||||
"lat": "-31.8129",
|
||||
"lng": "62.5342"
|
||||
}
|
||||
},
|
||||
"phone": "(254)954-1289",
|
||||
"website": "demarco.info",
|
||||
"company": {
|
||||
"name": "Keebler LLC",
|
||||
"catchPhrase": "User-centric fault-tolerant solution",
|
||||
"bs": "revolutionize end-to-end systems"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"name": "Mrs. Dennis Schulist",
|
||||
"username": "Leopoldo_Corkery",
|
||||
"email": "Karley_Dach@jasper.info",
|
||||
"address": {
|
||||
"street": "Norberto Crossing",
|
||||
"suite": "Apt. 950",
|
||||
"city": "South Christy",
|
||||
"zipcode": "23505-1337",
|
||||
"geo": {
|
||||
"lat": "-71.4197",
|
||||
"lng": "71.7478"
|
||||
}
|
||||
},
|
||||
"phone": "1-477-935-8478 x6430",
|
||||
"website": "ola.org",
|
||||
"company": {
|
||||
"name": "Considine-Lockman",
|
||||
"catchPhrase": "Synchronised bottom-line interface",
|
||||
"bs": "e-enable innovative applications"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"name": "Kurtis Weissnat",
|
||||
"username": "Elwyn.Skiles",
|
||||
"email": "Telly.Hoeger@billy.biz",
|
||||
"address": {
|
||||
"street": "Rex Trail",
|
||||
"suite": "Suite 280",
|
||||
"city": "Howemouth",
|
||||
"zipcode": "58804-1099",
|
||||
"geo": {
|
||||
"lat": "24.8918",
|
||||
"lng": "21.8984"
|
||||
}
|
||||
},
|
||||
"phone": "210.067.6132",
|
||||
"website": "elvis.io",
|
||||
"company": {
|
||||
"name": "Johns Group",
|
||||
"catchPhrase": "Configurable multimedia task-force",
|
||||
"bs": "generate enterprise e-tailers"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"name": "Nicholas Runolfsdottir V",
|
||||
"username": "Maxime_Nienow",
|
||||
"email": "Sherwood@rosamond.me",
|
||||
"address": {
|
||||
"street": "Ellsworth Summit",
|
||||
"suite": "Suite 729",
|
||||
"city": "Aliyaview",
|
||||
"zipcode": "45169",
|
||||
"geo": {
|
||||
"lat": "-14.3990",
|
||||
"lng": "-120.7677"
|
||||
}
|
||||
},
|
||||
"phone": "586.493.6943 x140",
|
||||
"website": "jacynthe.com",
|
||||
"company": {
|
||||
"name": "Abernathy Group",
|
||||
"catchPhrase": "Implemented secondary concept",
|
||||
"bs": "e-enable extensible e-tailers"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"name": "Glenna Reichert",
|
||||
"username": "Delphine",
|
||||
"email": "Chaim_McDermott@dana.io",
|
||||
"address": {
|
||||
"street": "Dayna Park",
|
||||
"suite": "Suite 449",
|
||||
"city": "Bartholomebury",
|
||||
"zipcode": "76495-3109",
|
||||
"geo": {
|
||||
"lat": "24.6463",
|
||||
"lng": "-168.8889"
|
||||
}
|
||||
},
|
||||
"phone": "(775)976-6794 x41206",
|
||||
"website": "conrad.com",
|
||||
"company": {
|
||||
"name": "Yost and Sons",
|
||||
"catchPhrase": "Switchable contextually-based project",
|
||||
"bs": "aggregate real-time technologies"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"name": "Clementina DuBuque",
|
||||
"username": "Moriah.Stanton",
|
||||
"email": "Rey.Padberg@karina.biz",
|
||||
"address": {
|
||||
"street": "Kattie Turnpike",
|
||||
"suite": "Suite 198",
|
||||
"city": "Lebsackbury",
|
||||
"zipcode": "31428-2261",
|
||||
"geo": {
|
||||
"lat": "-38.2386",
|
||||
"lng": "57.2232"
|
||||
}
|
||||
},
|
||||
"phone": "024-648-3804",
|
||||
"website": "ambrose.net",
|
||||
"company": {
|
||||
"name": "Hoeger LLC",
|
||||
"catchPhrase": "Centralized empowering task-force",
|
||||
"bs": "target end-to-end models"
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,42 @@
|
||||
/// <reference types="Cypress" />
|
||||
|
||||
const md5 = require('blueimp-md5');
|
||||
|
||||
context('Value And Default', () => {
|
||||
|
||||
before(() => {
|
||||
cy.visit('http://localhost:3000/examples/components/vue-ncform/_value-default.html')
|
||||
})
|
||||
|
||||
it('Both value and default have values', () => {
|
||||
let id = md5('Both value and default have values');
|
||||
cy.get(`[data-cy=${id}]`).within(() => {
|
||||
cy.get('label').contains('name').next().find('input').should('have.value', 'daniel');
|
||||
})
|
||||
})
|
||||
|
||||
it('Default has value, value has no value', () => {
|
||||
let id = md5('Default has value, value has no value');
|
||||
cy.get(`[data-cy=${id}]`).within(() => {
|
||||
cy.get('label').contains('firstname').next().find('input').should('have.value', 'sarah');
|
||||
cy.get('label').contains('lastname').next().find('input').should('have.value', 'xiao');
|
||||
})
|
||||
})
|
||||
|
||||
it("Object: Value overrides its fields's", () => {
|
||||
let id = md5("Object: Value overrides its fields's");
|
||||
cy.get(`[data-cy=${id}]`).within(() => {
|
||||
cy.get('label').contains('firstname').next().find('input').should('have.value', 'daniel');
|
||||
cy.get('label').contains('lastname').next().find('input').should('have.value', 'xiao');
|
||||
})
|
||||
})
|
||||
|
||||
it("Array: Item's value overrides its fields's", () => {
|
||||
let id = md5("Array: Item's value overrides its fields's");
|
||||
cy.get(`[data-cy=${id}]`).within(() => {
|
||||
cy.get('label').contains('users 1').next().next().find('input').should('have.value', 'daniel');
|
||||
cy.get('label').contains('users 2').next().next().find('input').should('have.value', '');
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
@@ -0,0 +1,17 @@
|
||||
// ***********************************************************
|
||||
// This example plugins/index.js can be used to load plugins
|
||||
//
|
||||
// You can change the location of this file or turn off loading
|
||||
// the plugins file with the 'pluginsFile' configuration option.
|
||||
//
|
||||
// You can read more here:
|
||||
// https://on.cypress.io/plugins-guide
|
||||
// ***********************************************************
|
||||
|
||||
// This function is called when a project is opened or re-opened (e.g. due to
|
||||
// the project's config changing)
|
||||
|
||||
module.exports = (on, config) => {
|
||||
// `on` is used to hook into various events Cypress emits
|
||||
// `config` is the resolved Cypress config
|
||||
}
|
||||
@@ -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 is will overwrite an existing command --
|
||||
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
|
||||
@@ -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')
|
||||
Generated
+2740
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "ncform-e2e",
|
||||
"private": true,
|
||||
"version": "0.1.28",
|
||||
"description": "ncform e2e test",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test-ncform:cli": "cross-var \"cd ncform && cypress run --record --key $NCFORM_E2E_KEY\"",
|
||||
"test-ncform:ui": "cd ncform && cypress open"
|
||||
},
|
||||
"author": "daniel.xiao",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"cross-var": "^1.1.0",
|
||||
"cypress": "^3.1.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"blueimp-md5": "^2.10.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>vue-ncform Example</title>
|
||||
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="../../../node_modules/bootstrap/dist/css/bootstrap.min.css"
|
||||
/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="demo" class="container">
|
||||
<template v-for="item in formSchemas">
|
||||
<div
|
||||
:data-cy="item.id"
|
||||
v-if="mode !== 'only' || item.only"
|
||||
:key="item.formName"
|
||||
>
|
||||
<h4>[CASE] {{ item.title }}</h4>
|
||||
<ncform
|
||||
:form-schema="item.formSchema"
|
||||
v-model="item.formSchema.value"
|
||||
:form-name="item.formName"
|
||||
></ncform>
|
||||
<hr />
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="../../../node_modules/vue/dist/vue.js"
|
||||
></script>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="https://unpkg.com/blueimp-md5@2.10.0/js/md5.js"
|
||||
></script>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="../../../node_modules/@ncform/ncform-common/dist/ncformCommon.min.js"
|
||||
></script>
|
||||
<script type="text/javascript" src="../../../dist/vueNcform.js"></script>
|
||||
<script type="text/javascript">
|
||||
Vue.use(vueNcform);
|
||||
|
||||
new Vue({
|
||||
el: '#demo',
|
||||
data: {
|
||||
mode: 'all', // all or only. if only mode, only objects with only:true in formSchemas are valid
|
||||
formSchemas: [
|
||||
{
|
||||
id: md5('Both value and default have values'),
|
||||
title: 'Both value and default have values',
|
||||
formName: 'form_' + Math.random(),
|
||||
formSchema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
name: {
|
||||
type: 'string',
|
||||
value: 'daniel',
|
||||
default: 'sarah'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id: md5('Default has value, value has no value'),
|
||||
title: 'Default has value, value has no value',
|
||||
formName: 'form_' + Math.random(),
|
||||
formSchema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
firstname: {
|
||||
type: 'string',
|
||||
default: 'sarah'
|
||||
},
|
||||
lastname: {
|
||||
type: 'string',
|
||||
default: 'dx: ["x", "i", "a", "o"].join("")'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id: md5("Object: Value overrides its fields's"),
|
||||
title: "Object: Value overrides its fields's",
|
||||
formName: 'form_' + Math.random(),
|
||||
formSchema: {
|
||||
type: 'object',
|
||||
value: {
|
||||
firstname: 'daniel',
|
||||
lastname: 'xiao'
|
||||
},
|
||||
properties: {
|
||||
firstname: {
|
||||
type: 'string',
|
||||
value: 'sarah'
|
||||
},
|
||||
lastname: {
|
||||
type: 'string',
|
||||
value: 'wang'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id: md5("Array: Item's value overrides its fields's"),
|
||||
title: "Array: Item's value overrides its fields's",
|
||||
formName: 'form_' + Math.random(),
|
||||
formSchema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
users: {
|
||||
type: 'array',
|
||||
value: ['daniel', ''],
|
||||
items: {
|
||||
type: 'string',
|
||||
value: 'sarah'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user