Skip to content

Commit

Permalink
Merge pull request #401 from hasgeek/membership
Browse files Browse the repository at this point in the history
Adds Organization admin and Project crew memberships, with Project participant Proposal memberships pending.
  • Loading branch information
jace authored Apr 27, 2020
2 parents 3cc8004 + 866ed8b commit 0c48e65
Show file tree
Hide file tree
Showing 172 changed files with 4,323 additions and 1,108 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
all:
cd funnel/assets; make

build:
cd funnel/assets; make assetsonly
5 changes: 5 additions & 0 deletions funnel/assets/cypress/fixtures/profile.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"title": "testcypressproject",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit",
"logo_url": "https://images.hasgeek.com/embed/file/fa971c8b503941de9f6ef5c53af02be7"
}
16 changes: 16 additions & 0 deletions funnel/assets/cypress/fixtures/user.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
{
"owner": {
"username": "profile-cypress",
"password": "cypress123"
},
"admin": {
"username": "admin-user",
"password": "cypress129"
},
"concierge": {
"username": "concierge-user",
"password": "cypress341"
},
"usher": {
"username": "usher-cypress",
"password": "cypress566"
},
"editor": {
"username": "editor-cypress",
"password": "cypress900"
},
"user": {
"username": "member-user",
"password": "cypress341"
Expand Down
20 changes: 20 additions & 0 deletions funnel/assets/cypress/integration/00_addProfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
describe('Profile', function() {
const owner = require('../fixtures/user.json').owner;
const profile = require('../fixtures/profile.json');

it('Create a new profile', function() {
cy.login('/organizations', owner.username, owner.password);

cy.get('a')
.contains('new organization')
.click();
cy.location('pathname').should('contain', '/new');

cy.get('#title').type(profile.title);
cy.get('#name').type(profile.title);
cy.get('#is_public_profile').click();
cy.get('button')
.contains('Next')
.click();
});
});
52 changes: 52 additions & 0 deletions funnel/assets/cypress/integration/01_addCrewtoProfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
describe('Adding crew to profile', function() {
const owner = require('../fixtures/user.json').owner;
const admin = require('../fixtures/user.json').admin;
const profile = require('../fixtures/profile.json');

Cypress.on('uncaught:exception', (err, runnable) => {
return false;
});

it('Add new member to profile and edit roles', function() {
cy.server();
cy.route('**/edit').as('edit-form');
cy.route('POST', '**/edit').as('edit-member');
cy.route('GET', '**/delete').as('delete-form');
cy.route('POST', '**/delete').as('delete-member');

cy.login('/' + profile.title, owner.username, owner.password);
cy.get('a[data-cy-btn="profile-crew"]').click();

cy.add_member(admin.username, 'owner');

cy.get('[data-cy="member"]')
.contains(admin.username)
.click();
cy.wait('@edit-form');
cy.get('button[data-cy-btn="revoke"]').click();
cy.wait('@delete-form');
cy.get('button')
.contains('Delete')
.click();
cy.wait('@delete-member');
cy.get('[data-cy="member"]')
.contains(admin.username)
.should('not.exist');

cy.add_member(admin.username, 'owner');
cy.get('[data-cy="member"]')
.contains(admin.username)
.click();
cy.wait('@edit-form');
cy.get('#is_owner-0').click();
cy.get('button')
.contains('Edit membership')
.click();
cy.wait('@edit-member');
cy.get('[data-cy="member"]')
.contains(admin.username)
.parents('.user-box')
.find('[data-cy="role"]')
.contains('Admin');
});
});
29 changes: 29 additions & 0 deletions funnel/assets/cypress/integration/02_verifyAdminRoles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
describe('Profile admin roles', function() {
const owner = require('../fixtures/user.json').owner;
const admin = require('../fixtures/user.json').admin;
const profile = require('../fixtures/profile.json');

it('Check roles of profile admins', function() {
cy.login('/' + profile.title, admin.username, admin.password);

cy.get('a[data-cy-btn="edit-details"]').click();
cy.get('#field-description')
.find('.CodeMirror textarea')
.type(profile.description, { force: true });
cy.get('#logo_url').type(profile.logo_url);
cy.get('button')
.contains('Save changes')
.click();

cy.get('a[data-cy-btn="profile-crew"]').click();
cy.get('button[data-cy-btn="add-member"]').should('not.exist');
cy.get('[data-cy="member"]')
.contains(admin.username)
.click();
cy.get('#member-form', { timeout: 10000 }).should('not.be.visible');
cy.get('[data-cy="member"]')
.contains(owner.username)
.click();
cy.get('#member-form', { timeout: 10000 }).should('not.be.visible');
});
});
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
describe('Project', function() {
const admin = require('../fixtures/user.json').admin;
const profile = require('../fixtures/profile.json');
const project = require('../fixtures/project.json');

it('Create a new project', function() {
cy.login('/testcypressproject', admin.username, admin.password);
cy.login('/' + profile.title, admin.username, admin.password);

cy.get('a[data-cy="new-project"]').click();
cy.location('pathname').should('contain', '/new');
Expand Down
31 changes: 31 additions & 0 deletions funnel/assets/cypress/integration/04_addCrewtoProject.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
describe('Adding crew', function() {
const owner = require('../fixtures/user.json').owner;
const admin = require('../fixtures/user.json').admin;
const concierge = require('../fixtures/user.json').concierge;
const usher = require('../fixtures/user.json').usher;
const editor = require('../fixtures/user.json').editor;
const profile = require('../fixtures/profile.json');
const project = require('../fixtures/project.json');

Cypress.on('uncaught:exception', (err, runnable) => {
return false;
});

it('Add crew to project', function() {
cy.login('/' + profile.title, admin.username, admin.password);
cy.get('[data-cy-project="' + project.title + '"]')
.first()
.click();
cy.location('pathname').should('contain', project.url);
cy.get('a[data-cy-navbar="crew"]').click();
cy.get('[data-cy="member"]')
.contains(admin.username)
.parents('.user-box')
.find('[data-cy="role"]')
.contains('Editor');

cy.add_member(concierge.username, 'concierge');
cy.add_member(usher.username, 'usher');
cy.add_member(editor.username, 'editor');
});
});
33 changes: 33 additions & 0 deletions funnel/assets/cypress/integration/05_verifyEditorRoles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
describe('Verify roles of editor', function() {
const editor = require('../fixtures/user.json').editor;
const profile = require('../fixtures/profile.json');
const project = require('../fixtures/project.json');

it('Access available for editor in project settings', function() {
// Failing now - project in draft state is not visible to editor
// cy.login('/' + profile.title +, editor.username, editor.password);
// cy.get('[data-cy-project="' + project.title + '"]')
// .first()
// .click();

cy.login(
'/' + profile.title + '/' + project.url,
editor.username,
editor.password
);
cy.location('pathname').should('contain', project.url);
cy.get('a[data-cy-navbar="settings"]').click();
cy.location('pathname').should('contain', 'settings');
cy.get('a[data-cy="edit"]').should('exist');
cy.get('a[data-cy="add-livestream"]').should('exist');
cy.get('a[data-cy="manage-venues"]').should('exist');
cy.get('a[data-cy="add-cfp"]').should('exist');
cy.get('a[data-cy="edit-schedule"]').should('exist');
cy.get('a[data-cy="manage-labels"]').should('exist');
cy.get('a[data-cy="setup-events"]').should('not.exist');
cy.get('a[data-cy="scan-checkin"]').should('not.exist');
cy.get('a[data-cy="download-csv"]').should('exist');
cy.get('a[data-cy="download-json"]').should('exist');
cy.get('a[data-cy="download-schedule-json"]').should('exist');
});
});
19 changes: 0 additions & 19 deletions funnel/assets/cypress/integration/06_confirmProposeBtn.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
describe('Publish project', function() {
const admin = require('../fixtures/user.json').admin;
const editor = require('../fixtures/user.json').editor;
const profile = require('../fixtures/profile.json');
const project = require('../fixtures/project.json');

it('Publish project', function() {
cy.login('/testcypressproject', admin.username, admin.password);
// Failing now - project in draft state is not visible to editor
// cy.login('/' + profile.title, editor.username, editor.password);
// cy.get('[data-cy-project="' + project.title + '"]')
// .first()
// .click();

cy.login(
'/' + profile.title + '/' + project.url,
editor.username,
editor.password
);

cy.get('[data-cy-project="' + project.title + '"]')
.first()
.click();
cy.location('pathname').should('contain', project.url);
cy.get('a[data-cy-navbar="settings"]').click();
cy.location('pathname').should('contain', 'settings');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
describe('Manage project venue', function() {
const admin = require('../fixtures/user.json').admin;
const editor = require('../fixtures/user.json').editor;
const profile = require('../fixtures/profile.json');
const project = require('../fixtures/project.json');

it('Add venue', function() {
cy.login(
'/testcypressproject/' + project.url,
admin.username,
admin.password
'/' + profile.title + '/' + project.url,
editor.username,
editor.password
);

cy.get('a[data-cy-navbar="settings"]').click();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
describe('Add CFP to project', function() {
const admin = require('../fixtures/user.json').admin;
const editor = require('../fixtures/user.json').editor;
const cfp = require('../fixtures/cfp.json');
const profile = require('../fixtures/profile.json');
const project = require('../fixtures/project.json');

it('Add CFP', function() {
cy.login(
'/testcypressproject/' + project.url,
admin.username,
admin.password
'/' + profile.title + '/' + project.url,
editor.username,
editor.password
);

cy.get('a[data-cy-navbar="settings"]').click();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
describe('Add labels to project', function() {
const admin = require('../fixtures/user.json').admin;
const editor = require('../fixtures/user.json').editor;
const profile = require('../fixtures/profile.json');
const project = require('../fixtures/project.json');
const labels = require('../fixtures/labels.json');

it('Add labels', function() {
cy.login(
'/testcypressproject/' + project.url,
admin.username,
admin.password
'/' + profile.title + '/' + project.url,
editor.username,
editor.password
);

cy.get('a[data-cy-navbar="settings"]').click();
Expand Down Expand Up @@ -102,8 +103,8 @@ describe('Add labels to project', function() {
.trigger('mouseover', { which: 1, force: true, view: window })
.trigger('mousedown', { which: 1, force: true, view: window })
.trigger('mousemove', {
pageX: 230,
pageY: 550,
pageX: 500,
pageY: 610,
force: true,
view: window,
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
describe('Add a new proposal', function() {
const user = require('../fixtures/user.json').user;
const profile = require('../fixtures/profile.json');
const proposal = require('../fixtures/proposal.json');
const project = require('../fixtures/project.json');
const labels = require('../fixtures/labels.json');

it('Add proposal', function() {
cy.login('/testcypressproject', user.username, user.password);
cy.login('/' + profile.title, user.username, user.password);

cy.get('a[data-cy-project="' + project.title + '"]').click();
cy.location('pathname').should('contain', project.url);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
describe('Confirm proposal', function() {
const admin = require('../fixtures/user.json').admin;
const editor = require('../fixtures/user.json').editor;
const profile = require('../fixtures/profile.json');
const proposal = require('../fixtures/proposal.json');
const project = require('../fixtures/project.json');
const labels = require('../fixtures/labels.json');

it('Confirm proposal', function() {
cy.login('/testcypressproject', admin.username, admin.password);
cy.login('/' + profile.title, editor.username, editor.password);

cy.get('a[data-cy-project="' + project.title + '"]').click();
cy.location('pathname').should('contain', project.url);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
describe('Add livestream', function() {
const admin = require('../fixtures/user.json').admin;
const editor = require('../fixtures/user.json').editor;
const profile = require('../fixtures/profile.json');
const project = require('../fixtures/project.json');

it('Adding livestream youtube url to project', function() {
cy.login('/testcypressproject', admin.username, admin.password);
cy.login('/' + profile.title, editor.username, editor.password);

cy.get('[data-cy-project="' + project.title + '"]')
.first()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
describe('Add session to schedule and publish', function() {
const admin = require('../fixtures/user.json').admin;
const editor = require('../fixtures/user.json').editor;
const session = require('../fixtures/session.json');
const proposal = require('../fixtures/proposal.json');
const profile = require('../fixtures/profile.json');
const project = require('../fixtures/project.json');

it('Update schedule', function() {
Expand All @@ -11,7 +12,7 @@ describe('Add session to schedule and publish', function() {
cy.route('**/schedule').as('session-form');
cy.route('POST', '**/schedule').as('add-session');

cy.login('/testcypressproject', admin.username, admin.password);
cy.login('/' + profile.title, editor.username, editor.password);

cy.get('a[data-cy-project="' + project.title + '"]').click();
cy.location('pathname').should('contain', project.url);
Expand Down
Loading

0 comments on commit 0c48e65

Please sign in to comment.