Skip to content

Commit

Permalink
Merge pull request #1658 from MahtabBukhari/feature-add-features-to-w…
Browse files Browse the repository at this point in the history
…orkspaces-modify-delete

Feature add features to workspaces modify delete
  • Loading branch information
elraphty authored May 20, 2024
2 parents 88b4d2a + b6ed5d1 commit 3b00e29
Show file tree
Hide file tree
Showing 21 changed files with 2,422 additions and 436 deletions.
40 changes: 40 additions & 0 deletions cypress/e2e/02_repositories.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { User, HostName, Workspaces, Repositories } from '../support/objects/objects';


describe('Create Repositories for Workspace', () => {
it('passes', () => {
cy.upsertlogin(User).then(value => {
for(let i = 0; i <= 1; i++) {
cy.request({
method: 'POST',
url: `${HostName}/workspaces/repositories`,
headers: { 'x-jwt': `${value}` },
body: Repositories[i]
}).its('body').then(body => {
expect(body).to.have.property('name').and.equal(Repositories[i].name.trim());
expect(body).to.have.property('url').and.equal(Repositories[i].url.trim());
});
}
})
})
})


describe('Check Repositories Values', () => {
it('passes', () => {
cy.upsertlogin(User).then(value => {
cy.request({
method: 'GET',
url: `${HostName}/workspaces/repositories/` + Repositories[0].workspace_uuid,
headers: { 'x-jwt': `${ value }` },
body: {}
}).then((resp) => {
expect(resp.status).to.eq(200)
expect(resp.body[0]).to.have.property('name', Repositories[0].name.trim())
expect(resp.body[0]).to.have.property('url', Repositories[0].url.trim())
expect(resp.body[1]).to.have.property('name', Repositories[1].name.trim())
expect(resp.body[1]).to.have.property('url', Repositories[1].url.trim())
})
})
})
})
122 changes: 79 additions & 43 deletions cypress/e2e/03_features.cy.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
import { User, HostName, Workspaces, Repositories, Features } from '../support/objects/objects';
import { User, HostName, Features } from '../support/objects/objects';



describe('Create Features for Workspace', () => {
it('passes', () => {
cy.upsertlogin(User).then(value => {
for(let i = 0; i <= 2; i++) {
for (let i = 0; i <= 2; i++) {
cy.request({
method: 'POST',
url: `${HostName}/features`,
headers: { 'x-jwt': `${value}` },
body: Features[i]
}).its('body').should('have.property', 'name', Features[i].name.trim())
.its('body').should('have.property', 'brief', Features[i].brief.trim())
.its('body').should('have.property', 'requirements', Features[i].requirements.trim())
.its('body').should('have.property', 'architecture', Features[i].architecture.trim())
}).its('body').then(body => {
expect(body).to.have.property('name').and.equal(Features[i].name.trim());
expect(body).to.have.property('brief').and.equal(Features[i].brief.trim());
expect(body).to.have.property('requirements').and.equal(Features[i].requirements.trim());
expect(body).to.have.property('architecture').and.equal(Features[i].architecture.trim());
});
}
})
})
Expand All @@ -23,7 +25,7 @@ describe('Create Features for Workspace', () => {
describe('Modify name for Feature', () => {
it('passes', () => {
cy.upsertlogin(User).then(value => {
for(let i = 0; i <= 2; i++) {
for (let i = 0; i <= 2; i++) {
cy.request({
method: 'POST',
url: `${HostName}/features`,
Expand All @@ -32,10 +34,12 @@ describe('Modify name for Feature', () => {
uuid: Features[i].uuid,
name: Features[i].name + "_addtext"
}
}).its('body').should('have.property', 'name', Features[i].name.trim() + "_addtext")
.its('body').should('have.property', 'brief', Features[i].brief.trim())
.its('body').should('have.property', 'requirements', Features[i].requirements.trim())
.its('body').should('have.property', 'architecture', Features[i].architecture.trim())
}).its('body').then(body => {
expect(body).to.have.property('name').and.equal(Features[i].name.trim() + " _addtext");
expect(body).to.have.property('brief').and.equal(Features[i].brief.trim());
expect(body).to.have.property('requirements').and.equal(Features[i].requirements.trim());
expect(body).to.have.property('architecture').and.equal(Features[i].architecture.trim());
});
}
})
})
Expand All @@ -44,7 +48,7 @@ describe('Modify name for Feature', () => {
describe('Modify brief for Feature', () => {
it('passes', () => {
cy.upsertlogin(User).then(value => {
for(let i = 0; i <= 2; i++) {
for (let i = 0; i <= 2; i++) {
cy.request({
method: 'POST',
url: `${HostName}/features`,
Expand All @@ -53,10 +57,12 @@ describe('Modify brief for Feature', () => {
uuid: Features[i].uuid,
brief: Features[i].brief + "_addtext"
}
}).its('body').should('have.property', 'name', Features[i].name.trim() + "_addtext")
.its('body').should('have.property', 'brief', Features[i].brief.trim() + "_addtext")
.its('body').should('have.property', 'requirements', Features[i].requirements.trim())
.its('body').should('have.property', 'architecture', Features[i].architecture.trim())
}).its('body').then(body => {
expect(body).to.have.property('name').and.equal(Features[i].name.trim() + " _addtext");
expect(body).to.have.property('brief').and.equal(Features[i].brief.trim() + " _addtext");
expect(body).to.have.property('requirements').and.equal(Features[i].requirements.trim());
expect(body).to.have.property('architecture').and.equal(Features[i].architecture.trim());
});
}
})
})
Expand All @@ -65,7 +71,7 @@ describe('Modify brief for Feature', () => {
describe('Modify requirements for Feature', () => {
it('passes', () => {
cy.upsertlogin(User).then(value => {
for(let i = 0; i <= 2; i++) {
for (let i = 0; i <= 2; i++) {
cy.request({
method: 'POST',
url: `${HostName}/features`,
Expand All @@ -74,10 +80,12 @@ describe('Modify requirements for Feature', () => {
uuid: Features[i].uuid,
requirements: Features[i].requirements + "_addtext"
}
}).its('body').should('have.property', 'name', Features[i].name.trim() + "_addtext")
.its('body').should('have.property', 'brief', Features[i].brief.trim() + "_addtext")
.its('body').should('have.property', 'requirements', Features[i].requirements.trim() + "_addtext")
.its('body').should('have.property', 'architecture', Features[i].architecture.trim())
}).its('body').then(body => {
expect(body).to.have.property('name').and.equal(Features[i].name.trim() + " _addtext");
expect(body).to.have.property('brief').and.equal(Features[i].brief.trim() + " _addtext");
expect(body).to.have.property('requirements').and.equal(Features[i].requirements.trim() + " _addtext");
expect(body).to.have.property('architecture').and.equal(Features[i].architecture.trim());
});
}
})
})
Expand All @@ -86,7 +94,7 @@ describe('Modify requirements for Feature', () => {
describe('Modify architecture for Feature', () => {
it('passes', () => {
cy.upsertlogin(User).then(value => {
for(let i = 0; i <= 2; i++) {
for (let i = 0; i <= 2; i++) {
cy.request({
method: 'POST',
url: `${HostName}/features`,
Expand All @@ -95,10 +103,12 @@ describe('Modify architecture for Feature', () => {
uuid: Features[i].uuid,
architecture: Features[i].architecture + "_addtext"
}
}).its('body').should('have.property', 'name', Features[i].name.trim() + "_addtext")
.its('body').should('have.property', 'brief', Features[i].brief.trim() + "_addtext")
.its('body').should('have.property', 'requirements', Features[i].requirements.trim() + "_addtext")
.its('body').should('have.property', 'architecture', Features[i].architecture.trim() + "_addtext")
}).its('body').then(body => {
expect(body).to.have.property('name').and.equal(Features[i].name.trim() + " _addtext");
expect(body).to.have.property('brief').and.equal(Features[i].brief.trim() + " _addtext");
expect(body).to.have.property('requirements').and.equal(Features[i].requirements.trim() + " _addtext");
expect(body).to.have.property('architecture').and.equal(Features[i].architecture.trim() + " _addtext");
});
}
})
})
Expand All @@ -110,37 +120,62 @@ describe('Get Features for Workspace', () => {
cy.upsertlogin(User).then(value => {
cy.request({
method: 'GET',
url: `${HostName}/workspaces/${Features[0].workspace_uuid}/features`, //changed from url: `${HostName}/features/forworkspace/` + Features[0].workspace_uuid, please update the routes file and any other change needed.
url: `${HostName}/workspaces/${Features[0].workspace_uuid}/features`,
headers: { 'x-jwt': `${ value }` },
body: {}
body: {}
}).then((resp) => {
expect(resp.status).to.eq(200)
for(let i = 0; i <= 2; i++) {
expect(resp.body[i]).to.have.property('name', Features[i].name.trim() + "_addtext")
expect(resp.body[i]).to.have.property('brief', Features[i].brief.trim() + "_addtext")
expect(resp.body[i]).to.have.property('requirements', Features[i].requirements.trim() + "_addtext")
expect(resp.body[i]).to.have.property('architecture', Features[i].architecture.trim() + "_addtext")
}
resp.body.forEach((feature) => {
const expectedFeature = Features.find(f => f.uuid === feature.uuid);
expect(feature).to.have.property('name', expectedFeature.name.trim() + " _addtext");
expect(feature).to.have.property('brief', expectedFeature.brief.trim() + " _addtext");
expect(feature).to.have.property('requirements', expectedFeature.requirements.trim() + " _addtext");
expect(feature).to.have.property('architecture', expectedFeature.architecture.trim() + " _addtext");
});
})
})
})
})

describe('Old Get Features for Workspace', () => {
it('passes', () => {
cy.upsertlogin(User).then(value => {
cy.request({
method: 'GET',
url: `${HostName}/features/forworkspace/` + Features[0].workspace_uuid,
headers: { 'x-jwt': `${value}` },
body: {}
}).then((resp) => {
expect(resp.status).to.eq(200);
if (resp.status === 200) {
resp.body.forEach((feature) => {
const expectedFeature = Features.find(f => f.uuid === feature.uuid);
expect(feature).to.have.property('name', expectedFeature.name.trim() + " _addtext");
expect(feature).to.have.property('brief', expectedFeature.brief.trim() + " _addtext");
expect(feature).to.have.property('requirements', expectedFeature.requirements.trim() + " _addtext");
expect(feature).to.have.property('architecture', expectedFeature.architecture.trim() + " _addtext");
});
}
});
})
})
})

describe('Get Feature by uuid', () => {
it('passes', () => {
cy.upsertlogin(User).then(value => {
for(let i = 0; i <= 2; i++) {
for (let i = 0; i <= 2; i++) {
cy.request({
method: 'GET',
url: `${HostName}/features/`+ Features[i].uuid,
headers: { 'x-jwt': `${ value }` },
body: {}
body: {}
}).then((resp) => {
expect(resp.status).to.eq(200)
expect(resp.body).to.have.property('name', Features[i].name.trim() + "_addtext")
expect(resp.body).to.have.property('brief', Features[i].brief.trim() + "_addtext")
expect(resp.body).to.have.property('requirements', Features[i].requirements.trim() + "_addtext")
expect(resp.body).to.have.property('architecture', Features[i].architecture.trim() + "_addtext")
expect(resp.body).to.have.property('name', Features[i].name.trim() + " _addtext")
expect(resp.body).to.have.property('brief', Features[i].brief.trim() + " _addtext")
expect(resp.body).to.have.property('requirements', Features[i].requirements.trim() + " _addtext")
expect(resp.body).to.have.property('architecture', Features[i].architecture.trim() + " _addtext")
})
}
})
Expand All @@ -154,7 +189,7 @@ describe('Delete Feature by uuid', () => {
method: 'DELETE',
url: `${HostName}/features/${Features[0].uuid}`,
headers: { 'x-jwt': `${ value }` },
body: {}
body: {}
}).then((resp) => {
expect(resp.status).to.eq(200)
})
Expand All @@ -166,10 +201,11 @@ describe('Check delete by uuid', () => {
it('passes', () => {
cy.upsertlogin(User).then(value => {
cy.request({
method: 'GET',
method: 'DELETE',
url: `${HostName}/features/${Features[0].uuid}`,
headers: { 'x-jwt': `${ value }` },
body: {}
body: {},
failOnStatusCode: false
}).then((resp) => {
expect(resp.status).to.eq(404);
})
Expand Down
117 changes: 117 additions & 0 deletions cypress/e2e/04_user_stories.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
import { User, HostName, UserStories } from '../support/objects/objects';

describe('Create user stories for Feature', () => {
it('passes', () => {
cy.upsertlogin(User).then(value => {
for (let i = 0; i <= 5; i++) {
cy.request({
method: 'POST',
url: `${HostName}/features/story`,
headers: { 'x-jwt': `${value}` },
body: UserStories[i]
}).its('body').then(body => {
expect(body).to.have.property('uuid').and.equal(UserStories[i].uuid.trim());
expect(body).to.have.property('feature_uuid').and.equal(UserStories[i].feature_uuid.trim());
expect(body).to.have.property('description').and.equal(UserStories[i].description.trim());
expect(body).to.have.property('priority').and.equal(UserStories[i].priority);
});
}
})
})
})

describe('Modify user story description', () => {
it('passes', () => {
cy.upsertlogin(User).then(value => {
for (let i = 0; i <= 5; i++) {
cy.request({
method: 'POST',
url: `${HostName}/features/story`,
headers: { 'x-jwt': `${value}` },
body: {
uuid: UserStories[i].uuid,
description: UserStories[i].description + "_addtext"
}
}).its('body').then(body => {
expect(body).to.have.property('uuid').and.equal(UserStories[i].uuid.trim());
expect(body).to.have.property('feature_uuid').and.equal(UserStories[i].feature_uuid.trim());
expect(body).to.have.property('description').and.equal(UserStories[i].description.trim() + " _addtext");
expect(body).to.have.property('priority').and.equal(UserStories[i].priority);
});
}
})
})
})

describe('Get user stories for feature', () => {
it('passes', () => {
cy.upsertlogin(User).then(value => {
cy.request({
method: 'GET',
url: `${HostName}/features/${UserStories[0].feature_uuid}/story`,
headers: { 'x-jwt': `${value}` },
body: {}
}).then((resp) => {
expect(resp.status).to.eq(200)
for (let i = 0; i <= 5; i++) {
expect(resp.body[i]).to.have.property('uuid').and.equal(UserStories[i].uuid.trim());
expect(resp.body[i]).to.have.property('feature_uuid').and.equal(UserStories[i].feature_uuid.trim());
expect(resp.body[i]).to.have.property('description').and.equal(UserStories[i].description.trim() + " _addtext");
expect(resp.body[i]).to.have.property('priority').and.equal(UserStories[i].priority);
}
})
})
})
})

describe('Get story by uuid', () => {
it('passes', () => {
cy.upsertlogin(User).then(value => {
for (let i = 0; i <= 5; i++) {
cy.request({
method: 'GET',
url: `${HostName}/features/${UserStories[0].feature_uuid}/story/${UserStories[i].uuid}`,
headers: { 'x-jwt': `${value}` },
body: {}
}).then((resp) => {
expect(resp.status).to.eq(200);
expect(resp.body).to.have.property('uuid').and.equal(UserStories[i].uuid.trim());
expect(resp.body).to.have.property('feature_uuid').and.equal(UserStories[i].feature_uuid.trim());
expect(resp.body).to.have.property('description').and.equal(UserStories[i].description.trim() + " _addtext");
expect(resp.body).to.have.property('priority').and.equal(UserStories[i].priority);
});
}
});
});
});

describe('Delete story by uuid', () => {
it('passes', () => {
cy.upsertlogin(User).then(value => {
cy.request({
method: 'DELETE',
url: `${HostName}/features/${UserStories[0].feature_uuid}/story/${UserStories[0].uuid}`,
headers: { 'x-jwt': `${value}` },
body: {}
}).then((resp) => {
expect(resp.status).to.eq(200)
})
})
})
})

describe('Check delete by uuid', () => {
it('passes', () => {
cy.upsertlogin(User).then(value => {
cy.request({
method: 'DELETE',
url: `${HostName}/features/${UserStories[0].feature_uuid}/story/${UserStories[0].uuid}`,
headers: { 'x-jwt': `${value}` },
body: {},
failOnStatusCode: false
}).then((resp) => {
expect(resp.status).to.eq(404);
})
})
})
})
Loading

0 comments on commit 3b00e29

Please sign in to comment.