Skip to content

Commit

Permalink
[bitnami/suitecrm] Revisit Helm Chart tests (bitnami#12141)
Browse files Browse the repository at this point in the history
* [bitnami/suitecrm] Revisit Helm Chart tests

Signed-off-by: FraPazGal <[email protected]>

* Update .vib/suitecrm/cypress/cypress/integration/suitecrm_spec.js

Co-authored-by: Jose Antonio Carmona <[email protected]>
Signed-off-by: Francisco de Paz Galán <[email protected]>

Signed-off-by: FraPazGal <[email protected]>
Signed-off-by: Francisco de Paz Galán <[email protected]>
Co-authored-by: Jose Antonio Carmona <[email protected]>
  • Loading branch information
Francisco de Paz Galán and joancafom authored Aug 26, 2022
1 parent 41b9b53 commit 82eb499
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 101 deletions.
7 changes: 2 additions & 5 deletions .vib/suitecrm/cypress/cypress.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
{
"env": {
"username": "user",
"password": "ComplicatedPassword123!4",
"emailServer": "testhost",
"smtpPort": "9125",
"smtpUser": "testHostUser"
"username": "test_user",
"password": "ComplicatedPassword123!4"
},
"hosts": {
"vmware-suitecrm.my": "{{ TARGET_IP }}"
Expand Down
4 changes: 2 additions & 2 deletions .vib/suitecrm/cypress/cypress/fixtures/accounts.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Name,ID,Website,Email Address,Non Primary E-mails,Office Phone,Alternate Phone,Fax,Billing Street,Billing City,Billing State,Billing Postal Code,Billing Country,Shipping Street,Shipping City,Shipping State,Shipping Postal Code,Shipping Country,Description,Type,Industry,Annual Revenue,Employees,SIC Code,Ticker Symbol,Parent Account ID,Ownership,Campaign ID,Rating,Assigned to,Assigned User,Date Created,Date Modified,Modified By,Created By,Deleted,Longitude,Geocode Status,Address,Latitude
Test Account,c76e2660-6542-8b05-ff4d-628deed4e5f7,http:/website.com,[email protected],,123-245-2345,,,Central Street,Central City,,,Country,,,,,,,,,,,,,,,,,user,1,05/25/2022 8:52,05/25/2022 8:52,1,1,0,0,,,0
Test Account 2,c76e2660-6542-8b05-ff4d-628deed4e5f9,http:/website-one.com,[email protected],,123-245-2345,,,Central Street,Central City,,,Country,,,,,,,,,,,,,,,,,user,1,05/25/2022 8:52,05/25/2022 8:52,1,1,0,0,,,0
First Test Account random_id,c76e2660-6542-8b05-ff4d-628deed4e5f7,http:/website.com,[email protected],,123-245-2345,,,Central Street,Central City,,,Country,,,,,,,,,,,,,,,,,user,1,05/25/2022 8:52,05/25/2022 8:52,1,1,0,0,,,0
Second Test Account random_id,c76e2660-6542-8b05-ff4d-628deed4e5f9,http:/website-one.com,[email protected],,123-245-2345,,,Central Street,Central City,,,Country,,,,,,,,,,,,,,,,,user,1,05/25/2022 8:52,05/25/2022 8:52,1,1,0,0,,,0
4 changes: 1 addition & 3 deletions .vib/suitecrm/cypress/cypress/fixtures/contacts.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"newContact": {
"firstName": "Julius Francisco",
"lastName": "Doe",
"address": "Calle de Camino de Santiago"
"lastName": "Lastly"
}
}
9 changes: 0 additions & 9 deletions .vib/suitecrm/cypress/cypress/fixtures/users.json

This file was deleted.

74 changes: 18 additions & 56 deletions .vib/suitecrm/cypress/cypress/integration/suitecrm_spec.js
Original file line number Diff line number Diff line change
@@ -1,48 +1,26 @@
/// <reference types="cypress" />
import { random } from '../support/utils';

it('allows to log in/log out', () => {
cy.login();
cy.get('span[class="error"]').should('not.exist');
cy.contains('SUITECRM DASHBOARD');
cy.visit('/index.php?module=Users&action=Logout');
cy.contains('Log In');
});

it('allows to import accounts', () => {
it('allows to import accounts and list them', () => {
cy.login();
cy.visit('/index.php?module=Accounts&action=index');
cy.contains('Import Accounts').click({ force: true });
cy.get('input[type="file"]').selectFile('cypress/fixtures/accounts.csv');
cy.get('input#import_update').click();
cy.get('#gonext').click();
cy.contains('Here is how the first several rows');
cy.get('#gonext').click();
cy.contains('Check the mappings to make sure that they are what you expect');
cy.get('#gonext').click();
cy.contains('perform a duplicate check');
cy.get('#importnow').click();
cy.contains('View Import Result');
cy.contains('View Accounts').click({ force: true });
cy.get('[title="Edit"]').its('length').should('gt', 1);
});

it('allows adding a new user', () => {
cy.login();
cy.visit('index.php?module=Users&action=index');
cy.contains('Create New User').click({ force: true });
cy.fixture('users').then((user) => {
cy.get('#user_name').type(`${user.newUser.username}.${random}`);
cy.get('#first_name').type(`${user.newUser.firstName}.${random}`);
cy.get('#last_name').type(`${user.newUser.lastName}.${random}`);
cy.get('#Users0emailAddress0').type(`${user.newUser.email}.${random}`);
cy.get('#SAVE_FOOTER').click();
cy.get('#tab2').click();
cy.get('#new_password').type(`${user.newUser.password}.${random}`);
cy.get('#confirm_pwd').type(`${user.newUser.password}.${random}`);
cy.get('#SAVE_FOOTER').click({ force: true });
cy.contains('View Users').click({ force: true });
cy.contains(`${user.newUser.username}.${random}`);
const accountsFile = 'cypress/fixtures/accounts.csv';
cy.readFile(accountsFile).then((data) => {
const randomizedData = data.replace(/Test Account [a-z0-9_]+,/g, `Test Account ${random},`);
cy.writeFile(accountsFile, randomizedData);
});
cy.get('[type="file"]').selectFile(accountsFile);
cy.get('#import_update').click();
for (let i = 2; i < 5; i++) {
cy.get('#gonext').click();
cy.contains(`Step ${i}`);
}
cy.get('#importnow').click();
cy.contains('Exit').click({ force: true });
cy.get('.list').within(() => {
cy.contains(`Test Account ${random}`);
});
});

Expand All @@ -51,24 +29,8 @@ it('allows adding a new contact', () => {
cy.visit('/index.php?module=Contacts&action=index');
cy.contains('Create Contact').click({ force: true });
cy.fixture('contacts').then((contact) => {
cy.get('#account_name').type(`${contact.newContact.firstName}.${random}`);
cy.get('#last_name').type(`${contact.newContact.lastName}.${random}`);
cy.get('#primary_address_street').type(
`${contact.newContact.address}.${random}`
);
cy.get('#SAVE').click();
cy.contains(
'.module-title-text',
`${contact.newContact.lastName}.${random}`
);
cy.contains('Save').click();
cy.contains('h2', `${contact.newContact.lastName}.${random}`);
});
});

it('verifies SMTP configuration', () => {
cy.login();
cy.visit('index.php?module=Administration&action=index');
cy.contains('Email Settings').click();
cy.get('#mail_smtpserver').should('have.value', Cypress.env('emailServer'));
cy.get('#mail_smtpport').should('have.value', Cypress.env('smtpPort'));
cy.get('#mail_smtpuser').should('have.value', Cypress.env('smtpUser'));
});
41 changes: 21 additions & 20 deletions .vib/suitecrm/goss/goss.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
http:
https://suitecrm:{{ .Vars.service.ports.https }}:
status: 200
allow-insecure: true
command:
user-id-test:
exec: if [ "$(id -u)" -eq 0 ]; then exit 1; fi
check-user-info:
exec: id
exit-status: 0
stdout: []
stderr: []
stdout:
- uid={{ .Vars.containerSecurityContext.runAsUser }}
- /groups=.*{{ .Vars.podSecurityContext.fsGroup }}/
file:
/opt/bitnami/suitecrm/sugar_version.json:
mode: "0664"
filetype: file
contains:
- sugar_db_version
- sugar_version
/bitnami/suitecrm:
exists: true
/opt/bitnami/suitecrm/config.php:
mode: "0755"
filetype: file
contains:
- vmware-suitecrm
- dbconfig
filetype: directory
mode: '2775'
owner: root
/etc/hosts:
exists: true
/opt/bitnami/apache/conf/extra/httpd-manual.conf:
mode: "0664"
filetype: file
exists: true
group: root
contains:
{{ range .Vars.hostAliases }}
{{ $ip := .ip }}
{{ range $host := .hostnames }}
- /{{ $ip }}.*{{$host}}/
{{ end }}
{{ end }}
11 changes: 11 additions & 0 deletions .vib/suitecrm/goss/vars.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
hostAliases:
- ip: "127.0.0.1"
hostnames:
- "status.localhost"
podSecurityContext:
fsGroup: 1002
containerSecurityContext:
runAsUser: 1002
service:
ports:
https: 444
7 changes: 4 additions & 3 deletions .vib/suitecrm/vib-publish.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"url": "{SHA_ARCHIVE}",
"path": "/bitnami/suitecrm"
},
"runtime_parameters": "c2VydmljZToKICB0eXBlOiBMb2FkQmFsYW5jZXIKICBwb3J0czoKICAgIGh0dHA6IDgwCnN1aXRlY3JtVXNlcm5hbWU6IHVzZXIKc3VpdGVjcm1QYXNzd29yZDogQ29tcGxpY2F0ZWRQYXNzd29yZDEyMyE0CnN1aXRlY3JtU210cEhvc3Q6IHRlc3Rob3N0CnN1aXRlY3JtU210cFBvcnQ6IDkxMjUKc3VpdGVjcm1TbXRwVXNlcjogdGVzdEhvc3RVc2VyCnN1aXRlY3JtSG9zdDogdm13YXJlLXN1aXRlY3JtLm15",
"runtime_parameters": "c3VpdGVjcm1Vc2VybmFtZTogdGVzdF91c2VyCnN1aXRlY3JtUGFzc3dvcmQ6IENvbXBsaWNhdGVkUGFzc3dvcmQxMjMhNApzdWl0ZWNybUhvc3Q6IHZtd2FyZS1zdWl0ZWNybS5teQpob3N0QWxpYXNlczoKICAtIGlwOiAiMTI3LjAuMC4xIgogICAgaG9zdG5hbWVzOgogICAgICAtICJzdGF0dXMubG9jYWxob3N0Igpjb250YWluZXJQb3J0czoKICBodHRwOiA4MDgxCiAgaHR0cHM6IDg0NDQKcG9kU2VjdXJpdHlDb250ZXh0OgogIGVuYWJsZWQ6IHRydWUKICBmc0dyb3VwOiAxMDAyCmNvbnRhaW5lclNlY3VyaXR5Q29udGV4dDoKICBlbmFibGVkOiB0cnVlCiAgcnVuQXNVc2VyOiAxMDAyCm1hcmlhZGI6CiAgYXV0aDoKICAgIGRhdGFiYXNlOiB0ZXN0X3N1aXRlY3JtX2RhdGFiYXNlCiAgICB1c2VybmFtZTogdGVzdF9zdWl0ZWNybV91c2VybmFtZQogICAgcGFzc3dvcmQ6IHRlc3Rfc3VpdGVjcm1fcGFzc3dvcmQKc2VydmljZToKICB0eXBlOiBMb2FkQmFsYW5jZXIKICBwb3J0czoKICAgIGh0dHA6IDgwCiAgICBodHRwczogNDQ0",
"target_platform": {
"target_platform_id": "{VIB_ENV_TARGET_PLATFORM}",
"size": {
Expand All @@ -46,7 +46,8 @@
},
"remote": {
"workload": "deploy-suitecrm"
}
},
"vars_file": "vars.yaml"
}
},
{
Expand All @@ -58,7 +59,7 @@
"endpoint": "lb-suitecrm-http",
"app_protocol": "HTTP",
"env": {
"username": "user",
"username": "test_user",
"password": "ComplicatedPassword123!4"
}
}
Expand Down
7 changes: 4 additions & 3 deletions .vib/suitecrm/vib-verify.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"url": "{SHA_ARCHIVE}",
"path": "/bitnami/suitecrm"
},
"runtime_parameters": "c2VydmljZToKICB0eXBlOiBMb2FkQmFsYW5jZXIKICBwb3J0czoKICAgIGh0dHA6IDgwCnN1aXRlY3JtVXNlcm5hbWU6IHVzZXIKc3VpdGVjcm1QYXNzd29yZDogQ29tcGxpY2F0ZWRQYXNzd29yZDEyMyE0CnN1aXRlY3JtU210cEhvc3Q6IHRlc3Rob3N0CnN1aXRlY3JtU210cFBvcnQ6IDkxMjUKc3VpdGVjcm1TbXRwVXNlcjogdGVzdEhvc3RVc2VyCnN1aXRlY3JtSG9zdDogdm13YXJlLXN1aXRlY3JtLm15",
"runtime_parameters": "c3VpdGVjcm1Vc2VybmFtZTogdGVzdF91c2VyCnN1aXRlY3JtUGFzc3dvcmQ6IENvbXBsaWNhdGVkUGFzc3dvcmQxMjMhNApzdWl0ZWNybUhvc3Q6IHZtd2FyZS1zdWl0ZWNybS5teQpob3N0QWxpYXNlczoKICAtIGlwOiAiMTI3LjAuMC4xIgogICAgaG9zdG5hbWVzOgogICAgICAtICJzdGF0dXMubG9jYWxob3N0Igpjb250YWluZXJQb3J0czoKICBodHRwOiA4MDgxCiAgaHR0cHM6IDg0NDQKcG9kU2VjdXJpdHlDb250ZXh0OgogIGVuYWJsZWQ6IHRydWUKICBmc0dyb3VwOiAxMDAyCmNvbnRhaW5lclNlY3VyaXR5Q29udGV4dDoKICBlbmFibGVkOiB0cnVlCiAgcnVuQXNVc2VyOiAxMDAyCm1hcmlhZGI6CiAgYXV0aDoKICAgIGRhdGFiYXNlOiB0ZXN0X3N1aXRlY3JtX2RhdGFiYXNlCiAgICB1c2VybmFtZTogdGVzdF9zdWl0ZWNybV91c2VybmFtZQogICAgcGFzc3dvcmQ6IHRlc3Rfc3VpdGVjcm1fcGFzc3dvcmQKc2VydmljZToKICB0eXBlOiBMb2FkQmFsYW5jZXIKICBwb3J0czoKICAgIGh0dHA6IDgwCiAgICBodHRwczogNDQ0",
"target_platform": {
"target_platform_id": "{VIB_ENV_TARGET_PLATFORM}",
"size": {
Expand All @@ -46,7 +46,8 @@
},
"remote": {
"workload": "deploy-suitecrm"
}
},
"vars_file": "vars.yaml"
}
},
{
Expand All @@ -58,7 +59,7 @@
"endpoint": "lb-suitecrm-http",
"app_protocol": "HTTP",
"env": {
"username": "user",
"username": "test_user",
"password": "ComplicatedPassword123!4"
}
}
Expand Down

0 comments on commit 82eb499

Please sign in to comment.