mirror of
https://github.com/vxcontrol/ncform.git
synced 2026-07-19 18:23:32 -04:00
test: init ncform-theme-elementui e2e test project
This commit is contained in:
+31
-2
@@ -69,7 +69,7 @@ jobs:
|
||||
- attach_workspace:
|
||||
at: ~/project
|
||||
- run: npm run test
|
||||
e2etest:
|
||||
e2etest-ncform:
|
||||
docker:
|
||||
- image: cypress/base:8
|
||||
working_directory: ~/project/ncform
|
||||
@@ -95,6 +95,32 @@ jobs:
|
||||
wget --retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 -t 10 http://127.0.0.1:3000/examples/components/vue-ncform/_value-default.html
|
||||
:
|
||||
- run: cd packages/ncform-e2e && npm run test-ncform:cli
|
||||
e2etest-ncform-theme-elem:
|
||||
docker:
|
||||
- image: cypress/base:8
|
||||
working_directory: ~/project/ncform
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: ~/project
|
||||
- restore_cache:
|
||||
keys:
|
||||
- v1-deps-cypress-{{ checksum "packages/ncform-e2e/package.json" }}
|
||||
- v1-deps-cypress
|
||||
- run: cd packages/ncform-e2e && npm ci
|
||||
- save_cache:
|
||||
key: v1-deps-cypress-{{ checksum "packages/ncform-e2e/package.json" }}
|
||||
paths:
|
||||
- ~/.cache
|
||||
- ~/.npm
|
||||
- run:
|
||||
command: npx http-server packages/ncform-show -p 3004
|
||||
background: true
|
||||
- run:
|
||||
shell: /bin/sh
|
||||
command: |
|
||||
wget --retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 -t 10 http://127.0.0.1:3004/examples/components/playground/index.html
|
||||
:
|
||||
- run: cd packages/ncform-e2e && npm run test-theme-elem:cli
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
@@ -107,6 +133,9 @@ workflows:
|
||||
e2e-test:
|
||||
jobs:
|
||||
- build
|
||||
- e2etest:
|
||||
# - e2etest-ncform:
|
||||
# requires:
|
||||
# - build
|
||||
- e2etest-ncform-theme-elem:
|
||||
requires:
|
||||
- build
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
[](https://circleci.com/gh/ncform/ncform/tree/e2e)
|
||||

|
||||

|
||||
[](https://dashboard.cypress.io/#/projects/enxoqt/runs)
|
||||
[](https://dashboard.cypress.io/#/organizations/5a8f70ec-7f41-4e80-be29-7904254d59b4/projects)
|
||||
[](https://gitter.im/ncform/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[](https://lernajs.io/)
|
||||
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
[](https://circleci.com/gh/ncform/ncform/tree/e2e)
|
||||

|
||||

|
||||
[](https://dashboard.cypress.io/#/projects/enxoqt/runs)
|
||||
[](https://dashboard.cypress.io/#/organizations/5a8f70ec-7f41-4e80-be29-7904254d59b4/projects)
|
||||
[](https://gitter.im/ncform/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[](https://lernajs.io/)
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"projectId": "5y86ie"
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
/// <reference types="Cypress" />
|
||||
|
||||
context('Querying', () => {
|
||||
beforeEach(() => {
|
||||
cy.visit('https://example.cypress.io/commands/querying')
|
||||
})
|
||||
|
||||
// The most commonly used query is 'cy.get()', you can
|
||||
// think of this like the '$' in jQuery
|
||||
|
||||
it('cy.get() - query DOM elements', () => {
|
||||
// https://on.cypress.io/get
|
||||
|
||||
cy.get('#query-btn').should('contain', 'Button')
|
||||
|
||||
cy.get('.query-btn').should('contain', 'Button')
|
||||
|
||||
cy.get('#querying .well>button:first').should('contain', 'Button')
|
||||
// ↲
|
||||
// Use CSS selectors just like jQuery
|
||||
|
||||
cy.get('[data-test-id="test-example"]').should('have.class', 'example')
|
||||
})
|
||||
|
||||
it('cy.contains() - query DOM elements with matching content', () => {
|
||||
// https://on.cypress.io/contains
|
||||
cy.get('.query-list')
|
||||
.contains('bananas')
|
||||
.should('have.class', 'third')
|
||||
|
||||
// we can pass a regexp to `.contains()`
|
||||
cy.get('.query-list')
|
||||
.contains(/^b\w+/)
|
||||
.should('have.class', 'third')
|
||||
|
||||
cy.get('.query-list')
|
||||
.contains('apples')
|
||||
.should('have.class', 'first')
|
||||
|
||||
// passing a selector to contains will
|
||||
// yield the selector containing the text
|
||||
cy.get('#querying')
|
||||
.contains('ul', 'oranges')
|
||||
.should('have.class', 'query-list')
|
||||
|
||||
cy.get('.query-button')
|
||||
.contains('Save Form')
|
||||
.should('have.class', 'btn')
|
||||
})
|
||||
|
||||
it('.within() - query DOM elements within a specific element', () => {
|
||||
// https://on.cypress.io/within
|
||||
cy.get('.query-form').within(() => {
|
||||
cy.get('input:first').should('have.attr', 'placeholder', 'Email')
|
||||
cy.get('input:last').should('have.attr', 'placeholder', 'Password')
|
||||
})
|
||||
})
|
||||
|
||||
it('cy.root() - query the root DOM element', () => {
|
||||
// https://on.cypress.io/root
|
||||
|
||||
// By default, root is the document
|
||||
cy.root().should('match', 'html')
|
||||
|
||||
cy.get('.query-ul').within(() => {
|
||||
// In this within, the root is now the ul DOM element
|
||||
cy.root().should('have.class', 'query-ul')
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -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')
|
||||
@@ -7,7 +7,9 @@
|
||||
"scripts": {
|
||||
"test": "cypress --version",
|
||||
"test-ncform:cli": "cross-var \"cypress run --project ./ncform --record --key $NCFORM_E2E_KEY\"",
|
||||
"test-ncform:ui": "cd ncform && cypress open"
|
||||
"test-ncform:ui": "cd ncform && cypress open",
|
||||
"test-theme-elem:cli": "cross-var \"cypress run --project ./ncform-theme-elementui --record --key $NCFORM_THEME_ELEM_E2E_KEY\"",
|
||||
"test-theme-elem:ui": "cd ncform-theme-elementui && cypress open"
|
||||
},
|
||||
"author": "daniel.xiao",
|
||||
"license": "MIT",
|
||||
|
||||
Reference in New Issue
Block a user