-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1628 from stakwork/feature-add-features-endpoints
Feature add features endpoints
- Loading branch information
Showing
23 changed files
with
2,607 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"type": "chrome", | ||
"request": "attach", | ||
"name": "Attach to Chrome", | ||
"port": 9222, | ||
"urlFilter": "http://localhost:4200/*", | ||
"webRoot": "${workspaceFolder}", | ||
"configurations": [ | ||
|
||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const { defineConfig } = require("cypress"); | ||
|
||
module.exports = defineConfig({ | ||
e2e: { | ||
setupNodeEvents(on, config) { | ||
// implement node event listeners here | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { User } from '../support/objects/objects' | ||
|
||
describe('Create User', () => { | ||
it('it creates a user', () => { | ||
const response = cy.upsertlogin(User); | ||
return response; | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import { User, HostName, Workspaces } from '../support/objects/objects'; | ||
|
||
|
||
describe('Create Workspaces', () => { | ||
it('passes', () => { | ||
cy.upsertlogin(User).then(value => { | ||
for(let i = 0; i <= 2; i++) { | ||
cy.request({ | ||
method: 'POST', | ||
url: `${HostName}/workspaces/`, | ||
headers: { 'x-jwt': `${value}` }, | ||
body: Workspaces[i] | ||
}).its('body').should('have.property', 'name', Workspaces[i].name.trim()); | ||
} | ||
}) | ||
}) | ||
}) | ||
|
||
describe('Edit Mission', () => { | ||
it('passes', () => { | ||
cy.upsertlogin(User).then(value => { | ||
for(let i = 0; i <= 2; i++) { | ||
cy.request({ | ||
method: 'POST', | ||
url: `${HostName}/workspaces/mission`, | ||
headers: { 'x-jwt': `${value}` }, | ||
body: { | ||
uuid: Workspaces[i].uuid, | ||
owner_pubkey: Workspaces[i].owner_pubkey, | ||
mission: Workspaces[i].mission + '_addedtext' | ||
} | ||
}).then((resp) => { | ||
expect(resp.status).to.eq(200) | ||
}) | ||
} | ||
}) | ||
}) | ||
}) | ||
|
||
describe('Edit Tactics', () => { | ||
it('passes', () => { | ||
cy.upsertlogin(User).then(value => { | ||
for(let i = 0; i <= 2; i++) { | ||
cy.request({ | ||
method: 'POST', | ||
url: `${HostName}/workspaces/tactics`, | ||
headers: { 'x-jwt': `${value}` }, | ||
body: { | ||
uuid: Workspaces[i].uuid, | ||
owner_pubkey: Workspaces[i].owner_pubkey, | ||
tactics: Workspaces[i].tactics + '_addedtext' | ||
} | ||
}).then((resp) => { | ||
expect(resp.status).to.eq(200) | ||
}) | ||
} | ||
}) | ||
}) | ||
}) | ||
|
||
describe('Edit Schematics Url', () => { | ||
it('passes', () => { | ||
cy.upsertlogin(User).then(value => { | ||
for(let i = 0; i <= 2; i++) { | ||
cy.request({ | ||
method: 'POST', | ||
url: `${HostName}/workspaces/schematicurl`, | ||
headers: { 'x-jwt': `${value}` }, | ||
body: { | ||
uuid: Workspaces[i].uuid, | ||
owner_pubkey: Workspaces[i].owner_pubkey, | ||
schematic_url: Workspaces[i].schematic_url + '_addedtext' | ||
} | ||
}).then((resp) => { | ||
expect(resp.status).to.eq(200) | ||
}) | ||
} | ||
}) | ||
}) | ||
}) | ||
|
||
|
||
describe('Check Workspace Values', () => { | ||
it('passes', () => { | ||
cy.upsertlogin(User).then(value => { | ||
for(let i = 0; i <= 2; i++) { | ||
cy.request({ | ||
method: 'GET', | ||
url: `${HostName}/workspaces/` + Workspaces[i].uuid, | ||
headers: { 'x-jwt': `${ value }` }, | ||
body: {} | ||
}).then((resp) => { | ||
expect(resp.status).to.eq(200) | ||
expect(resp.body).to.have.property('mission', Workspaces[i].mission.trim() + '_addedtext') | ||
expect(resp.body).to.have.property('tactics', Workspaces[i].tactics.trim() + '_addedtext') | ||
expect(resp.body).to.have.property('schematic_url', Workspaces[i].schematic_url.trim() + '_addedtext') | ||
}) | ||
} | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "Using fixtures to represent data", | ||
"email": "[email protected]", | ||
"body": "Fixtures are a great way to mock data for responses to routes" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
declare namespace Cypress { | ||
interface Chainable { | ||
upsertlogin(person: Person): Promise<string>; | ||
} | ||
|
||
type RandomObject = { [key: string]: string }; | ||
|
||
type LoginResponse = { | ||
jwt: string; | ||
//user: Person; | ||
} | ||
|
||
type Person = { | ||
id?: number; | ||
uuid?: string; | ||
owner_pubkey: string; | ||
owner_alias: string; | ||
unique_name: string; | ||
description: string; | ||
tags: String[] | ||
img: string; | ||
created?: number; | ||
updated?: string; | ||
unlisted: boolean; | ||
deleted: boolean; | ||
last_login?: number; | ||
owner_route_hint: string; | ||
owner_contact_key: string; | ||
price_to_meet: number; | ||
new_ticket_time?: number; | ||
twitter_confirmed: boolean; | ||
referred_by: number; | ||
extras: RandomObject; | ||
github_issues: RandomObject; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = (on, config) => { | ||
|
||
on('before:browser:launch', (browser = {}, args) => { | ||
|
||
if (browser.name === 'chrome') { | ||
args.push('--remote-debugging-port=9222') | ||
|
||
// whatever you return here becomes the new args | ||
return args | ||
} | ||
|
||
}) | ||
} |
Binary file removed
BIN
-142 KB
cypress/screenshots/01_workspaces.cy.ts/Edit Mission -- passes (failed).png
Binary file not shown.
Binary file removed
BIN
-231 KB
cypress/screenshots/01_workspaces.cy.ts/Edit Schematics Url -- passes (failed).png
Binary file not shown.
Binary file removed
BIN
-222 KB
cypress/screenshots/01_workspaces.cy.ts/Edit Tactics -- passes (failed).png
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import dotenv from 'dotenv'; | ||
dotenv.config(); | ||
|
||
import { HostName } from './objects/objects'; | ||
|
||
// @ts-check | ||
// @ts-check | ||
/// <reference types="cypress" /> | ||
|
||
Cypress.Commands.add('upsertlogin', (person: Cypress.Person) => { | ||
cy.request({ | ||
method: 'POST', | ||
url: `http://${HostName}/person/upsertlogin`, | ||
headers: {}, | ||
body: person | ||
}).then((response) => response.body); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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') |
Oops, something went wrong.