Skip to content

Commit

Permalink
fixed cypress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fvalentiner committed Apr 26, 2024
1 parent d1fa4f1 commit 1087588
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 68 deletions.
132 changes: 70 additions & 62 deletions cypress/e2e/01_workspaces.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,90 +4,98 @@ import { User, HostName, Workspaces } from '../support/objects/objects';
describe('Create Workspaces', () => {
it('passes', () => {
cy.upsertlogin(User).then(value => {
//Create 3 Workspaces
cy.request({
method: 'POST',
url: `${HostName}/workspaces/`,
headers: { 'x-jwt': `${value}` },
body: Workspaces[0]
}).its('body').should('have.property', 'name', Workspaces[0].name.trim());

cy.request({
method: 'POST',
url: `${HostName}/workspaces/`,
headers: { 'x-jwt': `${value}` },
body: Workspaces[1]
});

cy.request({
method: 'POST',
url: `${HostName}/workspaces/`,
headers: { 'x-jwt': `${value}` },
body: Workspaces[2]
});
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 => {
//Create 3 Workspaces
cy.request({
method: 'POST',
url: `${HostName}/workspaces/mission`,
headers: { 'x-jwt': `${value}` },
body: {
uuid: Workspaces[0].uuid,
owner_pubkey: Workspaces[0].owner_pubkey,
mission: 'This is a sample mission for workspace'
}
}).then((resp) => {
expect(resp.status).to.eq(200)
})

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 => {
//Create 3 Workspaces
cy.request({
method: 'POST',
url: `${HostName}/workspaces/tactics`,
headers: { 'x-jwt': `${value}` },
body: {
uuid: Workspaces[0].uuid,
owner_pubkey: Workspaces[0].owner_pubkey,
mission: 'This is a sample tactics and objectives for workspace'
}
}).then((resp) => {
expect(resp.status).to.eq(200)
})

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 => {
//Create 3 Workspaces
cy.request({
method: 'POST',
url: `${HostName}/workspaces/schematicurl`,
headers: { 'x-jwt': `${value}` },
body: {
uuid: Workspaces[0].uuid,
owner_pubkey: Workspaces[0].owner_pubkey,
mission: 'This is a sample schematic url for workspaces'
}
}).then((resp) => {
expect(resp.status).to.eq(200)
})
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')
})
}
})
})
})
12 changes: 6 additions & 6 deletions cypress/support/objects/objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ export const Workspaces = [
name: 'Sample Workspace 2',
owner_pubkey: User.owner_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=',
mission: 'Sample mission for worspace 2',
tactics: 'Sample tactics for workspace 2',
schematic_url: 'https://miro.com/app/board/sampleworkspace2',
schematic_img: '1b281867-2c0e-481e-b508-1aab0e33ab50.jpg'
},
{
Expand All @@ -49,9 +49,9 @@ export const Workspaces = [
name: 'Sample Workspace 3',
owner_pubkey: User.owner_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=',
mission: 'Sample mission for workspaces 3',
tactics: 'Sample tactics for workspace 3',
schematic_url: 'https://miro.com/app/board/sampleworkspace3',
schematic_img: '1b281867-2c0e-481e-b508-1aab0e33ab50.jpg'
}];

Expand Down

0 comments on commit 1087588

Please sign in to comment.