refactor: replace custom CRM with Monica fork
Some checks failed
Build & Push Monica Image to Gitea Registry / build-and-push (push) Failing after 9s
Some checks failed
Build & Push Monica Image to Gitea Registry / build-and-push (push) Failing after 9s
This commit is contained in:
11
tests/cypress/integration/auth/login_spec.js
vendored
Normal file
11
tests/cypress/integration/auth/login_spec.js
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
describe('Login', function () {
|
||||
it('should not let user sign in with a non-existing account', function () {
|
||||
cy.visit('/');
|
||||
|
||||
cy.get('input[name=email]').type('impossibru@test.com');
|
||||
cy.get('input[name=password]').type('testtest');
|
||||
cy.get('button[type=submit]').click();
|
||||
|
||||
cy.get('.alert').should('exist');
|
||||
});
|
||||
});
|
||||
43
tests/cypress/integration/auth/signup_spec.js
vendored
Normal file
43
tests/cypress/integration/auth/signup_spec.js
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
var faker = require('faker');
|
||||
|
||||
describe('Signup', function () {
|
||||
// @TODO: get emails from Mailtrap with their API and click on the confirmation
|
||||
// link
|
||||
//
|
||||
// it('should sign up and logout', function () {
|
||||
// cy.visit('/register')
|
||||
|
||||
// cy.get('input[name=email]').type('test@test.com')
|
||||
// cy.get('input[name=first_name]').type('test')
|
||||
// cy.get('input[name=last_name]').type('test')
|
||||
// cy.get('input[name=password]').type('testtest')
|
||||
// cy.get('input[name=password_confirmation]').type('testtest')
|
||||
|
||||
// cy.get('input[name=policy]').click()
|
||||
// cy.get('button[type=submit]').click()
|
||||
|
||||
// cy.url().should('include', '/dashboard')
|
||||
|
||||
// cy.get('[data-cy=header-link-logout]').click()
|
||||
|
||||
// cy.contains('Login to your account')
|
||||
// })
|
||||
|
||||
//it('should block registration if policy is not accepted', function () {
|
||||
// cy.register(faker.name.firstName(), faker.name.lastName(), faker.internet.password(), faker.internet.email(), false);
|
||||
// cy.get('.alert').should('exist');
|
||||
//});
|
||||
|
||||
it('should block registration if email is already used', function () {
|
||||
const email = faker.internet.email();
|
||||
|
||||
// test email address
|
||||
cy.register(faker.name.firstName(), faker.name.lastName(), faker.internet.password(), email, true);
|
||||
cy.get('.alert').should('not.exist');
|
||||
|
||||
cy.get('[data-cy=header-link-logout]').click();
|
||||
|
||||
cy.register(faker.name.firstName(), faker.name.lastName(), faker.internet.password(), email, true);
|
||||
cy.get('.alert').should('exist');
|
||||
});
|
||||
});
|
||||
35
tests/cypress/integration/contacts/activities_spec.js
vendored
Normal file
35
tests/cypress/integration/contacts/activities_spec.js
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
describe('Activities', function () {
|
||||
beforeEach(function () {
|
||||
cy.login();
|
||||
cy.createContact('John', 'Doe', 'Man');
|
||||
});
|
||||
|
||||
it('lets you manage an activity', function () {
|
||||
cy.url().should('include', '/people/h:');
|
||||
cy.get('[cy-name=activities-blank-state]').should('be.visible');
|
||||
|
||||
// add an activity
|
||||
cy.createActivity();
|
||||
|
||||
// edit an activity
|
||||
cy.get('[cy-name=activities-body]').should('be.visible')
|
||||
.invoke('attr', 'cy-items').then(function (item) {
|
||||
|
||||
cy.get('[cy-name=edit-activity-button-'+item+']').click();
|
||||
|
||||
cy.get('[name=summary]').clear();
|
||||
cy.get('[name=summary]').type('This is another summary');
|
||||
cy.get('[cy-name=save-activity-button]').click();
|
||||
|
||||
cy.get('[cy-name=activity-body-'+item+']').should('exist');
|
||||
cy.get('[cy-name=activity-body-'+item+']').should('contain', 'This is another summary');
|
||||
|
||||
// delete an activity
|
||||
cy.get('[cy-name=delete-activity-button-'+item+']').click();
|
||||
cy.wait(10);
|
||||
cy.get('[cy-name=confirm-delete-activity]').should('be.visible').click();
|
||||
cy.get('[cy-name=activities-blank-state]').should('be.visible');
|
||||
cy.get('[cy-name=activity-body-'+item+']').should('not.exist');
|
||||
});
|
||||
});
|
||||
});
|
||||
38
tests/cypress/integration/contacts/calls_spec.js
vendored
Normal file
38
tests/cypress/integration/contacts/calls_spec.js
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
var _ = require('lodash');
|
||||
|
||||
describe('Calls', function () {
|
||||
beforeEach(function () {
|
||||
cy.login();
|
||||
cy.createContact('John', 'Doe', 'Man');
|
||||
});
|
||||
|
||||
it('lets you manage a call', function () {
|
||||
cy.url().should('include', '/people/h:');
|
||||
cy.get('[cy-name=calls-blank-state]').should('exist');
|
||||
cy.get('[cy-name=log-call-form]').should('not.be.visible');
|
||||
cy.get('[cy-name=last-talked-to]').should('contain', 'unknown');
|
||||
|
||||
// add a call
|
||||
cy.get('[cy-name=add-call-button]').click();
|
||||
cy.get('[cy-name=log-call-form]').should('be.visible');
|
||||
cy.get('[cy-name=save-call-button]').click();
|
||||
cy.get('[cy-name=calls-blank-state]').should('not.exist');
|
||||
cy.get('[cy-name=last-talked-to]').should('not.contain', 'unknown');
|
||||
|
||||
cy.get('[cy-name=calls-body]').should('be.visible')
|
||||
.invoke('attr', 'cy-items').then(function (items) {
|
||||
let item = _.last(items.split(','));
|
||||
|
||||
cy.get('[cy-name=call-body-'+item+']').should('exist');
|
||||
cy.get('[cy-name=call-body-'+item+']').should('contain', 'John');
|
||||
|
||||
// delete a call
|
||||
cy.get('[cy-name=delete-call-button-'+item+']').should('be.visible');
|
||||
cy.get('[cy-name=delete-call-button-'+item+']').click();
|
||||
cy.get('[cy-name=delete-call-confirm-button-'+item+']').should('be.visible');
|
||||
cy.get('[cy-name=delete-call-confirm-button-'+item+']').click();
|
||||
cy.get('[cy-name=calls-blank-state]').should('exist');
|
||||
cy.get('[cy-name=last-talked-to]').should('contain', 'unknown');
|
||||
});
|
||||
});
|
||||
});
|
||||
95
tests/cypress/integration/contacts/contacts_spec.js
vendored
Normal file
95
tests/cypress/integration/contacts/contacts_spec.js
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
describe('Contacts', function () {
|
||||
beforeEach(function () {
|
||||
cy.login();
|
||||
});
|
||||
|
||||
it('lets you add a contact', function () {
|
||||
cy.createContact('John', 'Doe', 'Man');
|
||||
cy.url().should('include', '/people/h:');
|
||||
cy.get('h1').should('contain', 'John Doe');
|
||||
});
|
||||
|
||||
it('lets you add two contacts in a row', function () {
|
||||
cy.createContact('John', 'Doe', 'Man', 'save_and_add_another');
|
||||
cy.url().should('include', '/people/add');
|
||||
});
|
||||
|
||||
it('requires at least a firstname to add a contact', function () {
|
||||
cy.visit('/people');
|
||||
cy.get('#button-add-contact').click();
|
||||
cy.get('button[name=save]').click();
|
||||
cy.url().should('include', '/people/add');
|
||||
|
||||
cy.get('input[name=first_name]').type('John');
|
||||
cy.get('select[name=gender]').select('Man');
|
||||
cy.get('button[name=save]').click();
|
||||
|
||||
cy.url().should('include', '/people/h:');
|
||||
cy.get('h1').should('contain', 'John');
|
||||
});
|
||||
|
||||
it('lets you edit a contact', function () {
|
||||
cy.createContact('John', 'Doe', 'Man');
|
||||
|
||||
cy.get('#button-edit-contact').click();
|
||||
cy.url().should('include', '/edit');
|
||||
|
||||
cy.get('input[name=firstname]').should('have.value', 'John');
|
||||
cy.get('input[name=lastname]').should('have.value', 'Doe');
|
||||
//TO FIX cy.get('select[name=gender]').should('have.text', 'Man')
|
||||
|
||||
cy.get('input[name=firstname]').clear();
|
||||
cy.get('input[name=firstname]').type('Jane');
|
||||
cy.get('input[name=lastname]').clear();
|
||||
cy.get('button[name=save]').click();
|
||||
|
||||
cy.url().should('include', '/people/h:');
|
||||
cy.get('h1').should('contain', 'Jane');
|
||||
});
|
||||
|
||||
it('lets you delete a contact', function () {
|
||||
cy.createContact('John', 'Doe', 'Man');
|
||||
|
||||
cy.visit('/people');
|
||||
cy.get('.people-list-item').should('contain', 'John Doe');
|
||||
|
||||
// this gets the first content of the list
|
||||
cy.get('tr.people-list-item.bg-white.pointer').click();
|
||||
|
||||
cy.get('#link-delete-contact').click();
|
||||
|
||||
// cypress auto accepts window alerts (confirm or alert)
|
||||
cy.url().should('include', '/people');
|
||||
|
||||
cy.visit('/people');
|
||||
cy.get('.people-list-item').should('not.contain', 'John');
|
||||
});
|
||||
|
||||
it('lets you add a contact as favorite', function () {
|
||||
cy.createContact('John', 'Doe', 'Man');
|
||||
|
||||
cy.visit('/people');
|
||||
|
||||
// this gets the first content of the list
|
||||
cy.get('tr.people-list-item.bg-white.pointer').click();
|
||||
|
||||
// tests if the favorite button can be toggled
|
||||
cy.get('[cy-name=set-favorite]').should('be.visible');
|
||||
cy.get('[cy-name=set-favorite]').click();
|
||||
cy.get('[cy-name=set-favorite]').should('not.be.visible');
|
||||
cy.get('[cy-name=unset-favorite]').should('be.visible');
|
||||
cy.get('[cy-name=unset-favorite]').click();
|
||||
cy.get('[cy-name=set-favorite]').should('be.visible');
|
||||
|
||||
// test to see if a contact appears on top of the contact list if favorited
|
||||
cy.get('[cy-name=set-favorite]').click();
|
||||
cy.visit('/dashboard');
|
||||
cy.createContact('Abc', 'Abc', 'Man');
|
||||
cy.visit('/people');
|
||||
|
||||
cy.get('.people-list-item span').should('contain', 'John Doe');
|
||||
cy.get('.people-list-item svg').should('be.visible');
|
||||
|
||||
cy.get('.people-list-item').should('contain', 'Abc Abc');
|
||||
});
|
||||
});
|
||||
27
tests/cypress/integration/contacts/conversations_spec.js
vendored
Normal file
27
tests/cypress/integration/contacts/conversations_spec.js
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
describe('Conversations', function () {
|
||||
beforeEach(function () {
|
||||
cy.login();
|
||||
cy.createContact('John', 'Doe', 'Man');
|
||||
});
|
||||
|
||||
it('lets you manage a conversation', function () {
|
||||
cy.get('[cy-name=conversation-blank-state]').should('be.visible');
|
||||
|
||||
// add a conversation
|
||||
cy.visit('/people');
|
||||
|
||||
// this gets the first content of the list
|
||||
cy.get('tr.people-list-item.bg-white.pointer').click();
|
||||
|
||||
cy.get('[cy-name=add-conversation-button]').should('be.visible');
|
||||
cy.get('[cy-name=add-conversation-button]').click();
|
||||
cy.url().should('include', '/conversations/create');
|
||||
|
||||
cy.get('[name=contactFieldTypeId]').select('Phone');
|
||||
cy.get('[name=content_1]').type('This is a message');
|
||||
cy.get('[cy-name=save-conversation-button]').click();
|
||||
|
||||
cy.url().should('include', '/people/h:');
|
||||
cy.get('[cy-name=conversation-blank-state]').should('not.be.visible');
|
||||
});
|
||||
});
|
||||
46
tests/cypress/integration/contacts/debts_spec.js
vendored
Normal file
46
tests/cypress/integration/contacts/debts_spec.js
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
describe('Debts', function () {
|
||||
beforeEach(function () {
|
||||
cy.login();
|
||||
cy.createContact('John', 'Doe', 'Man');
|
||||
});
|
||||
|
||||
it('lets you manage a debt', function () {
|
||||
cy.url().should('include', '/people/h:');
|
||||
cy.get('[cy-name=debt-blank-state]').should('be.visible');
|
||||
|
||||
// add a debt
|
||||
cy.get('[cy-name=add-debt-button]').should('be.visible');
|
||||
cy.get('[cy-name=add-debt-button]').click();
|
||||
cy.url().should('include', '/debts/create');
|
||||
|
||||
cy.get('[name=amount]').type('123');
|
||||
cy.get('[cy-name=save-debt-button]').click();
|
||||
|
||||
cy.url().should('include', '/people/h:');
|
||||
cy.get('[cy-name=debt-blank-state]').should('not.be.visible');
|
||||
|
||||
cy.get('[cy-name=debts-body]').should('be.visible')
|
||||
.invoke('attr', 'cy-items').then(function (item) {
|
||||
|
||||
cy.get('[cy-name=debt-item-'+item+']').should('exist');
|
||||
cy.get('[cy-name=debt-item-'+item+']').should('contain', '123');
|
||||
|
||||
// edit a debt
|
||||
cy.get('[cy-name=edit-debt-button-'+item+']').click();
|
||||
cy.url().should('include', '/edit');
|
||||
|
||||
cy.get('[name=amount]').clear();
|
||||
cy.get('[name=amount]').type('234');
|
||||
cy.get('[cy-name=save-debt-button]').click();
|
||||
|
||||
cy.get('[cy-name=debt-item-'+item+']').should('exist');
|
||||
cy.get('[cy-name=debt-item-'+item+']').should('contain', '234');
|
||||
|
||||
// delete a debt
|
||||
cy.get('[cy-name=delete-debt-button-'+item+']').click();
|
||||
cy.get('[cy-name=confirm-delete-debt]').should('be.visible').click();
|
||||
cy.get('[cy-name=debt-blank-state]').should('be.visible');
|
||||
cy.get('[cy-name=debt-item-'+item+']').should('not.exist');
|
||||
});
|
||||
});
|
||||
});
|
||||
50
tests/cypress/integration/contacts/gifts_spec.js
vendored
Normal file
50
tests/cypress/integration/contacts/gifts_spec.js
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
|
||||
Gift page has change recently a lot, let rewrite this test later ...
|
||||
|
||||
###
|
||||
describe('Gifts', function () {
|
||||
beforeEach(function () {
|
||||
cy.login();
|
||||
cy.createContact('John', 'Doe', 'Man');
|
||||
});
|
||||
|
||||
it('lets you manage a gift', function () {
|
||||
cy.url().should('include', '/people/h:');
|
||||
|
||||
// add a gift
|
||||
cy.get('[cy-name=add-gift-button]').should('be.visible');
|
||||
cy.get('[cy-name=add-gift-button]').click();
|
||||
cy.url().should('include', '/gifts/create');
|
||||
|
||||
cy.get('[name=name]').type('This is a gift');
|
||||
cy.get('[cy-name=save-gift-button]').click();
|
||||
|
||||
cy.url().should('include', '/people/h:');
|
||||
|
||||
cy.get('[cy-name=gift-ideas-body]').should('be.visible')
|
||||
.invoke('attr', 'cy-items').then(function (item) {
|
||||
|
||||
cy.get('[cy-name=gift-idea-item-'+item+']').should('exist');
|
||||
cy.get('[cy-name=gift-idea-item-'+item+']').should('contain', 'This is a gift');
|
||||
|
||||
// edit a gift
|
||||
cy.get('[cy-name=edit-gift-button-'+item+']').click();
|
||||
cy.url().should('include', '/gifts/'+item+'/edit');
|
||||
|
||||
cy.get('[name=name]').clear();
|
||||
cy.get('[name=name]').type('This is another gift');
|
||||
cy.get('[cy-name=save-gift-button]').click();
|
||||
|
||||
cy.get('[cy-name=gift-idea-item-'+item+']').should('exist');
|
||||
cy.get('[cy-name=gift-idea-item-'+item+']').should('contain', 'This is another gift');
|
||||
|
||||
// delete an gift
|
||||
cy.get('[cy-name=delete-gift-button-'+item+']').click();
|
||||
cy.get('[cy-name=modal-delete-gift-button-'+item+']').click();
|
||||
cy.get('[cy-name=activities-blank-state]').should('be.visible');
|
||||
cy.get('[cy-name=gift-idea-item-'+item+']').should('not.exist');
|
||||
});
|
||||
});
|
||||
});
|
||||
*/
|
||||
65
tests/cypress/integration/contacts/introductions_spec.js
vendored
Normal file
65
tests/cypress/integration/contacts/introductions_spec.js
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
describe('Introduction', function () {
|
||||
beforeEach(function () {
|
||||
cy.login();
|
||||
cy.createContact('John', 'Doe', 'Man');
|
||||
cy.createContact('Jane', 'Doe', 'Woman');
|
||||
cy.createContact('Joe', 'Shmoe', 'Man');
|
||||
});
|
||||
|
||||
it('lets you fill first met without an introducer', function () {
|
||||
cy.url().should('include', '/people/h:');
|
||||
|
||||
cy.get('.introductions a[href$="introductions/edit"]').click();
|
||||
cy.url().should('include', '/introductions/edit');
|
||||
|
||||
cy.get('textarea[name=first_met_additional_info]').type('Lorem ipsum');
|
||||
cy.get('button.btn-primary[type=submit]').click();
|
||||
|
||||
cy.url().should('include', '/people/h:');
|
||||
cy.get('.alert-success');
|
||||
cy.get('.introductions').contains('Lorem ipsum');
|
||||
});
|
||||
|
||||
it('lets you save first met', function () {
|
||||
cy.url().should('include', '/people/h:');
|
||||
|
||||
cy.get('.introductions a[href$="introductions/edit"]').click();
|
||||
cy.url().should('include', '/introductions/edit');
|
||||
|
||||
cy.get('textarea[name=first_met_additional_info]').type('Lorem ipsum');
|
||||
cy.get('#metThrough > .v-select input').click();
|
||||
cy.get('#metThrough ul[role="listbox"]').contains('John Doe');
|
||||
cy.get('#metThrough ul[role="listbox"]').contains('Jane Doe');
|
||||
cy.get('#metThrough ul[role="listbox"]').contains('Joe Shmoe');
|
||||
|
||||
cy.get('#metThrough ul[role="listbox"]').contains('John Doe').click();
|
||||
|
||||
cy.get('button.btn-primary[type=submit]').click();
|
||||
|
||||
cy.url().should('include', '/people/h:');
|
||||
cy.get('.alert-success');
|
||||
cy.get('.introductions').contains('Lorem ipsum');
|
||||
cy.get('.introductions').contains('John Doe');
|
||||
});
|
||||
|
||||
it('lets you search first met', function () {
|
||||
cy.url().should('include', '/people/h:');
|
||||
|
||||
cy.get('.introductions a[href$="introductions/edit"]').click();
|
||||
cy.url().should('include', '/introductions/edit');
|
||||
|
||||
cy.get('textarea[name=first_met_additional_info]').type('Lorem ipsum');
|
||||
cy.get('#metThrough input[type=search]').type('John');
|
||||
cy.get('#metThrough ul[role="listbox"]').contains('John Doe');
|
||||
cy.get('#metThrough ul[role="listbox"]').should('not.contain', 'Joe Shmoe');
|
||||
cy.get('#metThrough ul[role="listbox"]').should('not.contain', 'Jane Doe');
|
||||
|
||||
cy.get('#metThrough ul[role="listbox"]').contains('John Doe').click();
|
||||
cy.get('button.btn-primary[type=submit]').click();
|
||||
|
||||
cy.url().should('include', '/people/h:');
|
||||
cy.get('.introductions').contains('Lorem ipsum');
|
||||
cy.get('.introductions').contains('John Doe');
|
||||
});
|
||||
|
||||
});
|
||||
45
tests/cypress/integration/contacts/notes_spec.js
vendored
Normal file
45
tests/cypress/integration/contacts/notes_spec.js
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
describe('Notes', function () {
|
||||
beforeEach(function () {
|
||||
cy.login();
|
||||
cy.createContact('John', 'Doe', 'Man');
|
||||
});
|
||||
|
||||
it('lets you manage a note', function () {
|
||||
cy.url().should('include', '/people/h:');
|
||||
cy.get('[cy-name=add-note-button]').should('not.be.visible');
|
||||
|
||||
// add a note
|
||||
cy.get('[cy-name=add-note-textarea]').click();
|
||||
cy.get('[cy-name=add-note-button]').should('be.visible');
|
||||
|
||||
cy.get('[cy-name=add-note-textarea]').type('This is a note');
|
||||
cy.get('[cy-name=add-note-button]').click();
|
||||
|
||||
cy.get('[cy-name=notes-body]').should('be.visible')
|
||||
.invoke('attr', 'cy-items').then(function (item) {
|
||||
|
||||
cy.get('[cy-name=note-body-'+item+']').should('contain', 'This is a note');
|
||||
|
||||
cy.get('[cy-name=edit-note-body-'+item+']').should('not.be.visible');
|
||||
|
||||
// edit a note
|
||||
cy.get('[cy-name=edit-note-button-'+item+']').click();
|
||||
cy.get('[cy-name=edit-note-body-'+item+']').should('be.visible');
|
||||
|
||||
cy.get('[cy-name=edit-note-body-'+item+']').clear();
|
||||
cy.get('[cy-name=edit-note-body-'+item+']').type('This is another note');
|
||||
cy.get('[cy-name=edit-mode-note-button-'+item+']').click();
|
||||
|
||||
cy.get('[cy-name=edit-note-body-'+item+']').should('not.be.visible');
|
||||
cy.get('[cy-name=note-body-'+item+']').should('contain', 'This is another note');
|
||||
|
||||
// delete a note
|
||||
cy.get('[cy-name=modal-delete-note]').should('not.be.visible');
|
||||
cy.get('[cy-name=delete-note-button-'+item+']').click();
|
||||
cy.get('[cy-name=modal-delete-note]').should('be.visible');
|
||||
cy.get('[cy-name=delete-mode-note-button-'+item+']').click();
|
||||
|
||||
cy.get('[cy-name=note-body-'+item+']').should('not.exist');
|
||||
});
|
||||
});
|
||||
});
|
||||
31
tests/cypress/integration/contacts/tasks_spec.js
vendored
Normal file
31
tests/cypress/integration/contacts/tasks_spec.js
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
describe('Tasks', function () {
|
||||
beforeEach(function () {
|
||||
cy.login();
|
||||
cy.createContact('John', 'Doe', 'Man');
|
||||
});
|
||||
|
||||
it('lets you manage a task', function () {
|
||||
cy.url().should('include', '/people/h:');
|
||||
cy.get('[cy-name=task-blank-state]').should('be.visible');
|
||||
|
||||
// add a task
|
||||
cy.get('[cy-name=add-task-button]').click();
|
||||
cy.get('[cy-name=task-add-view]').should('be.visible');
|
||||
|
||||
cy.get('[cy-name=task-add-title]').type('This is a task');
|
||||
cy.get('[cy-name=save-task-button]').click();
|
||||
|
||||
cy.get('[cy-name=tasks-body]').should('be.visible')
|
||||
.invoke('attr', 'cy-items').then(function (item) {
|
||||
|
||||
cy.get('[cy-name=task-item-'+item+']').should('exist');
|
||||
cy.get('[cy-name=task-item-'+item+']').should('contain', 'This is a task');
|
||||
|
||||
// edit a task
|
||||
cy.get('[cy-name=task-toggle-edit-mode]').click();
|
||||
cy.get('[cy-name=task-delete-button-'+item+']').click();
|
||||
|
||||
cy.get('[cy-name=task-blank-state]').should('be.visible');
|
||||
});
|
||||
});
|
||||
});
|
||||
73
tests/cypress/integration/journal/entries_spec.js
vendored
Normal file
73
tests/cypress/integration/journal/entries_spec.js
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
describe('Journal entries', function () {
|
||||
beforeEach(function () {
|
||||
cy.login();
|
||||
cy.createContact('John', 'Doe', 'Man');
|
||||
});
|
||||
|
||||
it('lets you manage a journal entry', function () {
|
||||
cy.visit('/journal');
|
||||
cy.get('[cy-name=journal-blank-state]').should('be.visible');
|
||||
|
||||
// add a journal entry
|
||||
cy.get('[cy-name=add-entry-button]').should('be.visible');
|
||||
cy.get('[cy-name=add-entry-button]').click();
|
||||
cy.url().should('include', '/journal/add');
|
||||
|
||||
cy.get('[name=entry]').type('This is an entry');
|
||||
cy.get('[cy-name=save-entry-button]').click();
|
||||
|
||||
cy.url().should('include', '/journal');
|
||||
cy.get('[cy-name=journal-blank-state]').should('not.be.visible');
|
||||
|
||||
cy.get('[cy-name=journal-entries-body]').should('be.visible')
|
||||
.invoke('attr', 'cy-items').then(function (item) {
|
||||
cy.get('[cy-name=journal-entries-body]')
|
||||
.invoke('attr', 'cy-object-items').then(function (objItem) {
|
||||
|
||||
cy.get('[cy-name=entry-body-'+item+']').should('exist');
|
||||
cy.get('[cy-name=entry-body-'+item+']').should('contain', 'This is an entry');
|
||||
|
||||
// delete a journal entry
|
||||
cy.get('[cy-name=entry-delete-button-'+objItem+']').click();
|
||||
cy.url().should('include', '/journal');
|
||||
cy.get('[cy-name=entry-body-'+item+']').should('not.exist');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('creates a journal entry when creating an activity', function () {
|
||||
cy.createActivity();
|
||||
|
||||
cy.visit('/journal');
|
||||
|
||||
cy.get('[cy-name=journal-blank-state]').should('not.be.visible');
|
||||
|
||||
cy.get('[cy-name=journal-entries-body]').should('be.visible').then((entries) => {
|
||||
let item = entries[0].getAttribute('cy-items');
|
||||
let objItem = entries[0].getAttribute('cy-object-items');
|
||||
|
||||
cy.get('[cy-name=entry-body-'+item+']').should('exist');
|
||||
cy.get('[cy-name=entry-body-'+item+']').should('contain', 'This is a summary');
|
||||
cy.get('[cy-name=entry-delete-button-'+objItem+']').should('not.exist');
|
||||
});
|
||||
});
|
||||
|
||||
it('lets you rate your day', function () {
|
||||
cy.visit('/journal');
|
||||
|
||||
cy.get('[cy-name=journal-blank-state]').should('be.visible');
|
||||
|
||||
cy.get('[cy-name=sad-reaction-button]').click();
|
||||
cy.wait(10);
|
||||
|
||||
cy.get('[cy-name=comment]').should('be.visible');
|
||||
cy.get('[cy-name=save-entry-button]').click();
|
||||
|
||||
cy.get('[cy-name=journal-entries-body]').should('be.visible').then((entries) => {
|
||||
let item = entries[0].getAttribute('cy-items');
|
||||
|
||||
cy.get('[cy-name=entry-body-'+item+']').should('exist');
|
||||
cy.get('[cy-name=entry-delete-button-'+item+']').should('exist');
|
||||
});
|
||||
});
|
||||
});
|
||||
134
tests/cypress/integration/settings/activity_types_spec.js
vendored
Normal file
134
tests/cypress/integration/settings/activity_types_spec.js
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
var _ = require('lodash');
|
||||
|
||||
describe('Settings: activity types', function () {
|
||||
it('doesn\'t let you manage activity types if user is not premium', function () {
|
||||
cy.login();
|
||||
cy.visit('/settings/personalization');
|
||||
cy.get('[cy-name=activity-type-premium-message]').should('be.visible');
|
||||
cy.get('[cy-name=activity-type-edit-button]').should('not.exist');
|
||||
});
|
||||
|
||||
it('lets you manage an activity type category and activity type', function () {
|
||||
cy.login();
|
||||
cy.visit('/');
|
||||
|
||||
// set account as premium
|
||||
cy.get('body').invoke('attr', 'data-account-id').then(function ($accountId) {
|
||||
cy.setPremium($accountId);
|
||||
});
|
||||
|
||||
// make sure that going premium removes restrictions
|
||||
cy.visit('/settings/personalization');
|
||||
cy.get('[cy-name=activity-type-premium-message]').should('not.be.visible');
|
||||
cy.get('[cy-name=activity-types]').should('contain', 'played a sport together');
|
||||
|
||||
// add an activity type category
|
||||
cy.get('[cy-name=add-activity-type-category-button]').click();
|
||||
cy.get('.sweet-modal-overlay').should('be.visible');
|
||||
cy.get('[name=add-category-name]').type('This is an activity type category');
|
||||
cy.get('[cy-name=add-activity-type-category-save-button]').click();
|
||||
cy.wait(10);
|
||||
|
||||
cy.get('[cy-name=activity-types]').should('contain', 'This is an activity type category');
|
||||
cy.get('[cy-name=activity-type-categories]').invoke('attr', 'cy-items').then((items) => {
|
||||
let item = _.last(items.split(','));
|
||||
|
||||
// edit an activity type category
|
||||
cy.get('[cy-name=activity-type-category-edit-button-'+item+']').click();
|
||||
cy.get('.sweet-modal-overlay').should('be.visible');
|
||||
cy.get('[name=update-category-name]').clear();
|
||||
cy.get('[name=update-category-name]').type('This is still an activity type category');
|
||||
cy.get('[cy-name=update-activity-type-category-button]').click();
|
||||
cy.get('[cy-name=activity-types]').should('contain', 'This is still an activity type category');
|
||||
|
||||
// add an activity type
|
||||
cy.get('[cy-name=add-activity-type-button-for-category-'+item+']').click();
|
||||
cy.get('.sweet-modal-overlay').should('be.visible');
|
||||
cy.get('[name=add-type-name]').type('This is activity type 1');
|
||||
cy.get('[cy-name=add-type-button]').click();
|
||||
cy.get('[cy-name=activity-types]').should('contain', 'This is activity type 1');
|
||||
|
||||
// edit an activity type
|
||||
cy.get('[cy-name=activity-types-'+item+']').invoke('attr', 'cy-items').then((items) => {
|
||||
let aitem = _.last(items.split(','));
|
||||
|
||||
cy.get('[cy-name=activity-type-edit-button-'+aitem+']').click();
|
||||
cy.get('.sweet-modal-overlay').should('be.visible');
|
||||
cy.get('[name=update-type-name]').clear();
|
||||
cy.get('[name=update-type-name]').type('This is modified activity type 1');
|
||||
cy.get('[cy-name=update-type-button]').click();
|
||||
cy.wait(10);
|
||||
cy.get('[cy-name=activity-types]').should('contain', 'This is modified activity type 1');
|
||||
});
|
||||
|
||||
// delete an activity type
|
||||
cy.get('[cy-name=add-activity-type-button-for-category-'+item+']').click();
|
||||
cy.get('.sweet-modal-overlay').should('be.visible');
|
||||
cy.get('[name=add-type-name]').type('This is activity type 2');
|
||||
cy.get('[cy-name=add-type-button]').click();
|
||||
cy.get('[cy-name=activity-types]').should('contain', 'This is activity type 2');
|
||||
|
||||
cy.get('[cy-name=activity-types-'+item+']').invoke('attr', 'cy-items').then((items) => {
|
||||
let aitem = _.last(items.split(','));
|
||||
|
||||
cy.get('[cy-name=activity-type-delete-button-'+aitem+']').click();
|
||||
cy.get('[cy-name=delete-type-button]').click();
|
||||
cy.get('[cy-name=activity-types]').should('not.contain', 'This is activity type 2');
|
||||
});
|
||||
|
||||
// now delete the activity type category and make sure it also deletes
|
||||
// the activity type that belonged to it
|
||||
cy.get('[cy-name=activity-type-category-delete-button-'+item+']').click();
|
||||
cy.get('[cy-name=delete-category-button]').click();
|
||||
cy.get('[cy-name=activity-types]').should('not.contain', 'This is still an activity type category');
|
||||
cy.get('[cy-name=activity-types]').should('not.contain', 'This is modified activity type 1');
|
||||
});
|
||||
});
|
||||
|
||||
it('lets you add an activity type and use it', function () {
|
||||
cy.login();
|
||||
cy.visit('/');
|
||||
|
||||
// set account as premium
|
||||
cy.get('body').invoke('attr', 'data-account-id').then(function ($accountId) {
|
||||
cy.setPremium($accountId);
|
||||
});
|
||||
|
||||
// make sure that going premium removes restrictions
|
||||
cy.visit('/settings/personalization');
|
||||
cy.get('[cy-name=activity-type-premium-message]').should('not.be.visible');
|
||||
cy.get('[cy-name=activity-types]').should('contain', 'played a sport together');
|
||||
|
||||
// add an activity type category
|
||||
cy.get('[cy-name=add-activity-type-category-button]').click();
|
||||
cy.get('.sweet-modal-overlay').should('be.visible');
|
||||
cy.get('[name=add-category-name]').type('This is an activity type category');
|
||||
cy.get('[cy-name=add-activity-type-category-save-button]').click();
|
||||
|
||||
cy.get('[cy-name=activity-types]').should('contain', 'This is an activity type category');
|
||||
cy.get('[cy-name=activity-type-categories]').invoke('attr', 'cy-items').then((items) => {
|
||||
let item = _.last(items.split(','));
|
||||
|
||||
// edit an activity type category
|
||||
cy.get('[cy-name=activity-type-category-edit-button-'+item+']').click();
|
||||
cy.get('.sweet-modal-overlay').should('be.visible');
|
||||
cy.get('[name=update-category-name]').clear();
|
||||
cy.get('[name=update-category-name]').type('This is still an activity type category');
|
||||
cy.get('[cy-name=update-activity-type-category-button]').click();
|
||||
cy.get('[cy-name=activity-types]').should('contain', 'This is still an activity type category');
|
||||
|
||||
// add an activity type
|
||||
cy.get('[cy-name=add-activity-type-button-for-category-'+item+']').click();
|
||||
cy.get('.sweet-modal-overlay').should('be.visible');
|
||||
cy.get('[name=add-type-name]').type('This is activity type 1');
|
||||
cy.get('[cy-name=add-type-button]').click();
|
||||
cy.get('[cy-name=activity-types]').should('contain', 'This is activity type 1');
|
||||
|
||||
// make sure the activity type exists on the Add activity page
|
||||
cy.createContact('John', 'Doe', 'Man');
|
||||
cy.get('[cy-name=add-activity-button]').click();
|
||||
cy.get('[cy-name=activities_add_category]').click();
|
||||
cy.get('[name=activity-type-list]').should('contain', 'This is activity type 1');
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user