From 109433e7f2c1a0fa9f2ac50ef695d3dbfa2daa4d Mon Sep 17 00:00:00 2001 From: l Date: Thu, 18 Apr 2024 23:22:59 -0400 Subject: [PATCH] Include cypress tests --- cypress.config.js | 9 +++ cypress/e2e/features.cy.js | 19 +++++ cypress/fixtures/example.json | 5 ++ cypress/support/commands.js | 25 ++++++ cypress/support/e2e.js | 20 +++++ cypress/support/objects/objects.js | 118 +++++++++++++++++++++++++++++ 6 files changed, 196 insertions(+) create mode 100644 cypress.config.js create mode 100644 cypress/e2e/features.cy.js create mode 100644 cypress/fixtures/example.json create mode 100644 cypress/support/commands.js create mode 100644 cypress/support/e2e.js create mode 100644 cypress/support/objects/objects.js diff --git a/cypress.config.js b/cypress.config.js new file mode 100644 index 000000000..97f47c412 --- /dev/null +++ b/cypress.config.js @@ -0,0 +1,9 @@ +const { defineConfig } = require("cypress"); + +module.exports = defineConfig({ + e2e: { + setupNodeEvents(on, config) { + // implement node event listeners here + }, + }, +}); diff --git a/cypress/e2e/features.cy.js b/cypress/e2e/features.cy.js new file mode 100644 index 000000000..ea605b102 --- /dev/null +++ b/cypress/e2e/features.cy.js @@ -0,0 +1,19 @@ + + + +import '../support/objects/objects.js' + +describe('Create Workspace', () => { + it('passes', () => { + cy.request({ + method: 'POST', + url: `${hostname}/workspaces/`, + headers: { + 'x-user-token': `${user.authToken}` + }, + body: workspaces[0] + }).then((response) => { + id = response.body.response.id; + }) + }) +}); \ No newline at end of file diff --git a/cypress/fixtures/example.json b/cypress/fixtures/example.json new file mode 100644 index 000000000..02e425437 --- /dev/null +++ b/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" +} diff --git a/cypress/support/commands.js b/cypress/support/commands.js new file mode 100644 index 000000000..66ea16ef0 --- /dev/null +++ b/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) => { ... }) \ No newline at end of file diff --git a/cypress/support/e2e.js b/cypress/support/e2e.js new file mode 100644 index 000000000..0e7290a13 --- /dev/null +++ b/cypress/support/e2e.js @@ -0,0 +1,20 @@ +// *********************************************************** +// This example support/e2e.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') \ No newline at end of file diff --git a/cypress/support/objects/objects.js b/cypress/support/objects/objects.js new file mode 100644 index 000000000..028da0256 --- /dev/null +++ b/cypress/support/objects/objects.js @@ -0,0 +1,118 @@ + +let hostname = 'localhost:5555'; + +let user = { + pubkey: '', + authToken: '', + name: 'Alice' +}; + +let workspaces = [ + { + id: '29a999fc-0424-46d2-ac04-ffc3e0635928', + name: 'Sample Workspace 1', + owner_pub_key: user.pubkey, + img: 'IqQnBnAdrteW_QCeq_3Ss1_78_yBAz_rckG5F3NE9ms=', + mission: 'Access the largest pool of human cognition', + tactics:'Create a marketplace for providers and bounty hunters', + schematic_url: 'https://miro.com/app/board/uXjVNQOK7Zc=', + schematic_img: '1b281867-2c0e-481e-b508-1aab0e33ab50.jpg' + }, + { + id: 'e3e7396a-3308-48f4-acba-b3d3120b65f6', + name: 'Sample Workspace 2', + owner_pub_key: user.pubkey, + img: 'IqQnBnAdrteW_QCeq_3Ss1_78_yBAz_rckG5F3NE9ms=', + mission: 'Access the largest pool of human cognition', + tactics:'Create a marketplace for providers and bounty hunters', + schematic_url: 'https://miro.com/app/board/uXjVNQOK7Zc=', + schematic_img: '1b281867-2c0e-481e-b508-1aab0e33ab50.jpg' + }, + { + id: '18616ed4-2fda-4670-9550-dfa9356a3beb', + name: 'Sample Workspace 3', + owner_pub_key: user.pubkey, + img: 'IqQnBnAdrteW_QCeq_3Ss1_78_yBAz_rckG5F3NE9ms=', + mission: 'Access the largest pool of human cognition', + tactics:'Create a marketplace for providers and bounty hunters', + schematic_url: 'https://miro.com/app/board/uXjVNQOK7Zc=', + schematic_img: '1b281867-2c0e-481e-b508-1aab0e33ab50.jpg' + }]; + +let repositories = [ + { + name: 'frontend', + url: 'https://github.com/stakwork/sphinx-tribes-frontend' + }, + { + name: 'backend', + url: 'https://github.com/stakwork/sphinx-tribes' + } +]; + +let features = [ + { + name: 'Hive Process', + priority: 1, + brief: 'To follow a set of best practices in product development.
' + + 'Dividing complex features into small
steps makes it easier to ' + + 'track and the timing more certain.
A guided process would help ' + + 'a PM new to the hive process get the best results with the least mental ' + + 'load.
This feature is for a not se technical Product Manager.
' + + 'The hive process lets you get features out to production faster and with less risk.', + requirements: 'Modify workspaces endpoint to accomodate new fields.
' + + 'Create end points for features, user stories and phases', + architecture: 'Describe the architecture of the feature with the following sections:' + + '

Wireframes

Visual Schematics

Object Definition

' + + 'DB Schema Changes

UX

CI/CD

Changes

Endpoints

' + + 'Front

', + }, + { + name: 'AI Assited text fields', + priority: 2, + brief: 'An important struggle of a technical product manager is to find ' + + 'the right words to describe a business goal. The definition of ' + + 'things like \'product mission\' or \'tactics and objectives\' is ' + + ' the base from which every technical decition relays on.
' + + 'We are going to leverage AI to help the PM write better definitions.
' + + 'The fields that would benefit form AI assistance are: mission, tactics, ' + + 'feature brief and feature user stories', + requirements: 'Create a new page for a conversation format between the PM and the LLM
' + + 'Rely as much as possible on stakwork workflows
' + + 'Have history of previous definitions', + architecture: 'Describe the architecture of the feature with the following sections:' + + '

Wireframes

Visual Schematics

Object Definition

' + + 'DB Schema Changes

UX

CI/CD

Changes

Endpoints

' + + 'Front

', + }, + { + name: 'AI Assited relation between text fields', + priority: 2, + brief: 'A product and feature\'s various definition fields: mission, tactics, ' + + 'feature brief, user stories, requirements and architecture should have some ' + + 'relation between each other.
' + 'One way to do that is to leverage an LLM ' + + 'to discern the parts of the defintion that have a connection to other definitions.
' + + 'The UI will need to show the user how each definition is related to other defintions.', + requirements: 'Create a new process after a Feature text has changed. It should use the LLM to ' + + 'determine de relationship between parts of the text.', + architecture: 'Describe the architecture of the feature with the following sections:' + + '

Wireframes

Visual Schematics

Object Definition

' + + 'DB Schema Changes

UX

CI/CD

Changes

Endpoints

' + + 'Front

', + }, +]; + +let user_stories = [ + { id: 'f4c4c4b4-7a90-4a3a-b3e2-151d0feca9bf', description: ' As a {PM} I want to {make providers \"hive ready\"}, so I can {leverage the hive process ' }, + { id: '78f4b326-1841-449b-809a-a0947622db3e', description: ' As a {PM} I want to {CRUD Features}, so I can {use the system to manage my features} ' }, + { id: '5d353d23-3d27-4aa8-a9f7-04dcd5f4843c', description: ' As a {PM} I want to {follow best practices}, so I can {make more valuable features} ' }, + { id: '1a4e00f4-0e58-4e08-a1df-b623bc10f08d', description: ' As a {PM} I want to {save the architecture of the feature}, so I can {share it with people} ' }, + { id: 'eb6e4138-37e5-465d-934e-18e335abaa47', description: ' As a {PM} I want to {create phases}, so I can {divide the work in several deliverable stages} ' }, + { id: '35a5d8dd-240d-4ff0-a699-aa2fa2cfa32c', description: ' As a {PM} I want to {assign bounties to features}, so I can {group bounties together} ' }, +]; + +let phases = [ + { id: 'a96e3bff-e5c8-429e-bd65-911d619761aa', name: ' MVP ' }, + { id: '6de147ab-695c-45b1-81e7-2d1a5ba482ab', name: ' MVP ' }, + { id: '28541c4a-41de-447e-86d8-293583d1abc2', name: ' MVP ' }, +]; \ No newline at end of file