From 6f5008722db0b5693b98365daff0b0c07bb93393 Mon Sep 17 00:00:00 2001 From: Jose Antonio Carmona Date: Mon, 12 Dec 2022 17:08:49 +0100 Subject: [PATCH] [bitnami/redmine] Revisit tests (#13785) Signed-off-by: Jose Antonio Carmona Signed-off-by: Jose Antonio Carmona --- .vib/redmine/cypress/cypress.json | 3 +- .../cypress/cypress/fixtures/settings.json | 8 --- .../cypress/cypress/fixtures/smtps.json | 7 -- .../cypress/cypress/fixtures/users.json | 9 --- .../cypress/integration/redmine_spec.js | 66 ++----------------- .../cypress/cypress/support/commands.js | 9 ++- .vib/redmine/goss/goss.yaml | 38 ++--------- .vib/redmine/goss/vars.yaml | 4 ++ .vib/redmine/vib-publish.json | 5 +- .vib/redmine/vib-verify.json | 5 +- 10 files changed, 26 insertions(+), 128 deletions(-) delete mode 100644 .vib/redmine/cypress/cypress/fixtures/settings.json delete mode 100644 .vib/redmine/cypress/cypress/fixtures/smtps.json delete mode 100644 .vib/redmine/cypress/cypress/fixtures/users.json create mode 100644 .vib/redmine/goss/vars.yaml diff --git a/.vib/redmine/cypress/cypress.json b/.vib/redmine/cypress/cypress.json index 0edeb31cc9..fcb7fa8fcc 100644 --- a/.vib/redmine/cypress/cypress.json +++ b/.vib/redmine/cypress/cypress.json @@ -2,9 +2,8 @@ "baseUrl": "http://localhost", "pageLoadTimeout": 240000, "defaultCommandTimeout": 80000, - "env": { - "username": "user", + "username": "bitnamiTest", "password": "ComplicatedPassword123!4" } } diff --git a/.vib/redmine/cypress/cypress/fixtures/settings.json b/.vib/redmine/cypress/cypress/fixtures/settings.json deleted file mode 100644 index 3c74415f85..0000000000 --- a/.vib/redmine/cypress/cypress/fixtures/settings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "newSetting": { - "appTitle": "VMWare", - "database": "Mysql", - "environment": "production", - "versionControl": "Git" - } -} diff --git a/.vib/redmine/cypress/cypress/fixtures/smtps.json b/.vib/redmine/cypress/cypress/fixtures/smtps.json deleted file mode 100644 index dfe1aeb3b6..0000000000 --- a/.vib/redmine/cypress/cypress/fixtures/smtps.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "newSMTP": { - "smtpEmailAddress": "redmine@vmware.net", - "header": "Please take a look at this issue", - "footer": "You can change the notification preferences" - } -} diff --git a/.vib/redmine/cypress/cypress/fixtures/users.json b/.vib/redmine/cypress/cypress/fixtures/users.json deleted file mode 100644 index 81fb3aacb2..0000000000 --- a/.vib/redmine/cypress/cypress/fixtures/users.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "newUser": { - "userName": "JaneJessica", - "password": "someComplicatedPass12345!", - "firstName": "Jane Doe Jess", - "lastName": "Doe", - "email": "thisisanemail@email.com" - } -} diff --git a/.vib/redmine/cypress/cypress/integration/redmine_spec.js b/.vib/redmine/cypress/cypress/integration/redmine_spec.js index 8e15df2394..c331926b2e 100644 --- a/.vib/redmine/cypress/cypress/integration/redmine_spec.js +++ b/.vib/redmine/cypress/cypress/integration/redmine_spec.js @@ -1,29 +1,6 @@ /// import { random } from '../support/utils'; -it('allows admin to login/logout', () => { - cy.login(); - cy.contains('#flash_error').should('not.exist'); - cy.contains('Sign out').click(); - cy.contains('Sign in'); -}); - -it('allows user to register', () => { - cy.visit('/account/register'); - cy.fixture('users').then((user) => { - cy.get('#user_login').type(`${user.newUser.userName}.${random}`); - cy.get('#user_password').type(`${user.newUser.password}.${random}`); - cy.get('#user_password_confirmation').type( - `${user.newUser.password}.${random}` - ); - cy.get('#user_firstname').type(`${user.newUser.firstName}.${random}`); - cy.get('#user_lastname').type(`${user.newUser.lastName}.${random}`); - cy.get('#user_mail').type(`.${random}${user.newUser.email}`); - }); - cy.get('[type="submit"]').click(); - cy.contains('Your account was created'); -}); - it('allows admin to create a project and an issue with file uploaded', () => { cy.login(); cy.visit('/projects'); @@ -41,46 +18,13 @@ it('allows admin to create a project and an issue with file uploaded', () => { cy.fixture('issues').then((issue) => { cy.get('#issue_subject').type(`${issue.newIssue.subject}.${random}`); cy.get('#issue_description').type(issue.newIssue.description); - cy.get('input[type="file"]').selectFile('cypress/fixtures/issues.json'); + cy.get('[type="file"]').selectFile('cypress/fixtures/issues.json'); }); cy.get('[name="commit"]').click(); cy.contains('#flash_notice', 'created'); - cy.contains('issues.json'); -}); - -it('allows admins to verify SMTP is enabled and modify it', () => { - cy.login(); - cy.visit('/settings?tab=notifications'); - cy.fixture('smtps').then((smtp) => { - cy.get('#settings_mail_from') - .clear() - .type(`${smtp.newSMTP.smtpEmailAddress}.${random}`); - cy.get('#settings_emails_header') - .scrollIntoView() - .clear() - .type(`${smtp.newSMTP.header}.${random}`); - cy.get('#settings_emails_footer') - .clear() - .type(`${smtp.newSMTP.footer}.${random}`); - }); - cy.contains('[type="submit"]', 'Save').click({ force: true }); - cy.contains('Successful update'); -}); - -it('allows admin to modify and observe application configuration', () => { - cy.login(); - cy.visit('/admin'); - cy.contains('Settings').click(); - cy.fixture('settings').then((setting) => { - cy.get('#settings_app_title') - .clear() - .type(`${setting.newSetting.appTitle}.${random}`); - - cy.contains('input', 'Save').click(); - cy.contains('#flash_notice', 'Successful update'); - cy.visit('/admin/info'); - cy.contains(setting.newSetting.database); - cy.contains(setting.newSetting.environment); - cy.contains(setting.newSetting.versionControl); + cy.contains('issues.json').click(); + cy.fixture('issues').then((uploadedFile) => { + cy.contains(uploadedFile.newIssue.subject); + cy.contains(uploadedFile.newIssue.description); }); }); diff --git a/.vib/redmine/cypress/cypress/support/commands.js b/.vib/redmine/cypress/cypress/support/commands.js index ae5d109f2a..0ef1ec9401 100644 --- a/.vib/redmine/cypress/cypress/support/commands.js +++ b/.vib/redmine/cypress/cypress/support/commands.js @@ -15,10 +15,9 @@ for (const command of ['click']) { Cypress.Commands.add( 'login', (username = Cypress.env('username'), password = Cypress.env('password')) => { - cy.visit('/'); - cy.contains('Sign in').click(); - cy.get('input#username').type(username); - cy.get('input#password').type(password); - cy.get('input[type="submit"]').click(); + cy.visit('/login'); + cy.get('#username').type(username); + cy.get('#password').type(password); + cy.get('#login-submit').click(); } ); diff --git a/.vib/redmine/goss/goss.yaml b/.vib/redmine/goss/goss.yaml index f2d414b77d..1c85446b62 100644 --- a/.vib/redmine/goss/goss.yaml +++ b/.vib/redmine/goss/goss.yaml @@ -1,40 +1,14 @@ -command: - ruby-version-test: - exec: ruby -v - exit-status: 0 - stdout: - - ruby - stderr: [ ] - timeout: 20000 file: - /bitnami/redmine/config/configuration.yml: - mode: "0664" - filetype: file + /bitnami/redmine: exists: true - group: root - contains: - - "smtp_settings" - - "attachments_storage_path" + filetype: directory + mode: '0775' + owner: redmine /bitnami/redmine/config/database.yml: mode: "0664" filetype: file exists: true group: root contains: - - "postgresql" - - "redmine" - /bitnami/redmine/files: - mode: "0775" - filetype: directory - exists: true - group: root - /opt/bitnami/mysql: - mode: "0755" - filetype: directory - exists: true - group: root - /opt/bitnami/postgresql: - mode: "0755" - filetype: directory - exists: true - group: root + - /username.*{{ .Vars.mariadb.auth.username }}/ + - /password.*{{ .Vars.mariadb.auth.password }}/ \ No newline at end of file diff --git a/.vib/redmine/goss/vars.yaml b/.vib/redmine/goss/vars.yaml new file mode 100644 index 0000000000..0b57850204 --- /dev/null +++ b/.vib/redmine/goss/vars.yaml @@ -0,0 +1,4 @@ +mariadb: + auth: + username: bn_test_redmine + password: bitnami_test_password \ No newline at end of file diff --git a/.vib/redmine/vib-publish.json b/.vib/redmine/vib-publish.json index da4bacb910..4e40ebf5ac 100644 --- a/.vib/redmine/vib-publish.json +++ b/.vib/redmine/vib-publish.json @@ -22,7 +22,7 @@ "url": "{SHA_ARCHIVE}", "path": "/bitnami/redmine" }, - "runtime_parameters": "cmVkbWluZVVzZXJuYW1lOiB1c2VyCnJlZG1pbmVQYXNzd29yZDogQ29tcGxpY2F0ZWRQYXNzd29yZDEyMyE0CnNlcnZpY2U6CiAgcG9ydDogODAKICB0eXBlOiBMb2FkQmFsYW5jZXIKc210cEhvc3Q6IGVtYWlsaG9zdApzbXRwUG9ydDogOTAwMApzbXRwVXNlcjogc210cF91c2VyCnNtdHBQYXNzd29yZDogc210cF91c2VyX3Bhc3N3b3Jk", + "runtime_parameters": "cmVkbWluZVVzZXJuYW1lOiBiaXRuYW1pVGVzdApyZWRtaW5lUGFzc3dvcmQ6IENvbXBsaWNhdGVkUGFzc3dvcmQxMjMhNApzZXJ2aWNlOgogIHBvcnQ6IDgwCiAgdHlwZTogTG9hZEJhbGFuY2VyCmRhdGFiYXNlVHlwZTogbWFyaWFkYgptYXJpYWRiOgogIGVuYWJsZWQ6IHRydWUKICBhdXRoOgogICAgdXNlcm5hbWU6IGJuX3Rlc3RfcmVkbWluZQogICAgcGFzc3dvcmQ6IGJpdG5hbWlfdGVzdF9wYXNzd29yZA==", "target_platform": { "target_platform_id": "{VIB_ENV_ALTERNATIVE_TARGET_PLATFORM}", "size": { @@ -44,6 +44,7 @@ "resources": { "path": "/.vib/redmine/goss" }, + "vars_file": "vars.yaml", "remote": { "workload": "deploy-redmine" } @@ -58,7 +59,7 @@ "endpoint": "lb-redmine-http", "app_protocol": "HTTP", "env": { - "username": "user", + "username": "bitnamiTest", "password": "ComplicatedPassword123!4" } } diff --git a/.vib/redmine/vib-verify.json b/.vib/redmine/vib-verify.json index 994652651c..dd5070a878 100644 --- a/.vib/redmine/vib-verify.json +++ b/.vib/redmine/vib-verify.json @@ -22,7 +22,7 @@ "url": "{SHA_ARCHIVE}", "path": "/bitnami/redmine" }, - "runtime_parameters": "cmVkbWluZVVzZXJuYW1lOiB1c2VyCnJlZG1pbmVQYXNzd29yZDogQ29tcGxpY2F0ZWRQYXNzd29yZDEyMyE0CnNlcnZpY2U6CiAgcG9ydDogODAKICB0eXBlOiBMb2FkQmFsYW5jZXIKc210cEhvc3Q6IGVtYWlsaG9zdApzbXRwUG9ydDogOTAwMApzbXRwVXNlcjogc210cF91c2VyCnNtdHBQYXNzd29yZDogc210cF91c2VyX3Bhc3N3b3Jk", + "runtime_parameters": "cmVkbWluZVVzZXJuYW1lOiBiaXRuYW1pVGVzdApyZWRtaW5lUGFzc3dvcmQ6IENvbXBsaWNhdGVkUGFzc3dvcmQxMjMhNApzZXJ2aWNlOgogIHBvcnQ6IDgwCiAgdHlwZTogTG9hZEJhbGFuY2VyCmRhdGFiYXNlVHlwZTogbWFyaWFkYgptYXJpYWRiOgogIGVuYWJsZWQ6IHRydWUKICBhdXRoOgogICAgdXNlcm5hbWU6IGJuX3Rlc3RfcmVkbWluZQogICAgcGFzc3dvcmQ6IGJpdG5hbWlfdGVzdF9wYXNzd29yZA==", "target_platform": { "target_platform_id": "{VIB_ENV_ALTERNATIVE_TARGET_PLATFORM}", "size": { @@ -44,6 +44,7 @@ "resources": { "path": "/.vib/redmine/goss" }, + "vars_file": "vars.yaml", "remote": { "workload": "deploy-redmine" } @@ -58,7 +59,7 @@ "endpoint": "lb-redmine-http", "app_protocol": "HTTP", "env": { - "username": "user", + "username": "bitnamiTest", "password": "ComplicatedPassword123!4" } }