Browse Source

add cypress, but the first test fails with a decrypt message (and besides: app generates new account when visiting /account)

try-cypress
Trent Larson 2 years ago
parent
commit
d48b2210d5
  1. 9
      cypress.config.ts
  2. 20
      cypress/e2e/spec.cy.ts
  3. 5
      cypress/fixtures/example.json
  4. 37
      cypress/support/commands.ts
  5. 20
      cypress/support/e2e.ts
  6. 1349
      package-lock.json
  7. 1
      package.json
  8. 2
      src/views/ImportAccountView.vue
  9. 2
      src/views/NewEditProjectView.vue

9
cypress.config.ts

@ -0,0 +1,9 @@
import { defineConfig } from "cypress";
export default defineConfig({
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
},
},
});

20
cypress/e2e/spec.cy.ts

@ -0,0 +1,20 @@
describe('My First Test', () => {
it('finds the content "type"', () => {
cy.visit('http://localhost:8080')
cy.contains('Yes').click()
cy.get('#mnemonic').type('seminar accuse mystery assist delay law thing deal image undo guard initial shallow wrestle list fragile borrow velvet tomorrow awake explain test offer control')
cy.get('#import').click()
cy.get('Share Your ID')
/**
cy.visit('http://localhost:8080/new-edit-project')
cy.get('#name').type('Clicker Shooter')
cy.get('#description').type('Joel\'s new test project via Cypress')
cy.contains('Save Project').click()
**/
})
})

5
cypress/fixtures/example.json

@ -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"
}

37
cypress/support/commands.ts

@ -0,0 +1,37 @@
/// <reference types="cypress" />
// ***********************************************
// This example commands.ts 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) => { ... })
//
// declare global {
// namespace Cypress {
// interface Chainable {
// login(email: string, password: string): Chainable<void>
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
// }
// }
// }

20
cypress/support/e2e.ts

@ -0,0 +1,20 @@
// ***********************************************************
// This example support/e2e.ts 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')

1349
package-lock.json

File diff suppressed because it is too large

1
package.json

@ -62,6 +62,7 @@
"@vue/cli-service": "~5.0.8",
"@vue/eslint-config-typescript": "^11.0.2",
"autoprefixer": "^10.4.13",
"cypress": "^12.5.1",
"eslint": "^8.28.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",

2
src/views/ImportAccountView.vue

@ -19,6 +19,7 @@
</p>
<input
type="text"
id="mnemonic"
placeholder="Seed Phrase"
class="block w-full rounded border border-slate-400 mb-4 px-3 py-2"
v-model="mnemonic"
@ -26,6 +27,7 @@
{{ mnemonic }}
<div class="mt-8">
<button
id="import"
@click="from_mnemonic()"
class="block w-full text-center text-lg font-bold uppercase bg-blue-600 text-white px-2 py-3 rounded-md mb-2"
>

2
src/views/NewEditProjectView.vue

@ -22,6 +22,7 @@
</div>
<input
id="name"
type="text"
placeholder="Project Name"
class="block w-full rounded border border-slate-400 mb-4 px-3 py-2"
@ -29,6 +30,7 @@
/>
<textarea
id="description"
placeholder="Description"
class="block w-full rounded border border-slate-400 mb-4 px-3 py-2"
rows="5"

Loading…
Cancel
Save