diff --git a/.vib/prestashop/cypress/cypress.json b/.vib/prestashop/cypress/cypress.json index 1854f539f..c751c02fd 100644 --- a/.vib/prestashop/cypress/cypress.json +++ b/.vib/prestashop/cypress/cypress.json @@ -1,7 +1,7 @@ { "env": { - "username": "user", - "email": "user@example.com", + "username": "bitnamiTest", + "email": "bitnamiTest@example.com", "password": "ComplicatedPassword123!4" }, "hosts": { diff --git a/.vib/prestashop/cypress/cypress/fixtures/customers.json b/.vib/prestashop/cypress/cypress/fixtures/customers.json index d42fb3729..03233b307 100644 --- a/.vib/prestashop/cypress/cypress/fixtures/customers.json +++ b/.vib/prestashop/cypress/cypress/fixtures/customers.json @@ -9,11 +9,5 @@ "state": "California", "zipcode": "94304" } - }, - "newCustomer": { - "firstName": "Maurice", - "lastName": "Canard", - "email": "lecanard@example.com", - "password": "Sup3rComplicated!" } } diff --git a/.vib/prestashop/cypress/cypress/fixtures/images/product_image.png b/.vib/prestashop/cypress/cypress/fixtures/images/product_image.png deleted file mode 100644 index 87ad739c0..000000000 Binary files a/.vib/prestashop/cypress/cypress/fixtures/images/product_image.png and /dev/null differ diff --git a/.vib/prestashop/cypress/cypress/fixtures/products.json b/.vib/prestashop/cypress/cypress/fixtures/products.json deleted file mode 100644 index c07ce3e1b..000000000 --- a/.vib/prestashop/cypress/cypress/fixtures/products.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "newProduct": { - "name": "Painting: Wiedergeboren", - "price": "13.0" - } -} diff --git a/.vib/prestashop/cypress/cypress/integration/prestashop_spec.js b/.vib/prestashop/cypress/cypress/integration/prestashop_spec.js index 768be7e67..8d7b14f0b 100644 --- a/.vib/prestashop/cypress/cypress/integration/prestashop_spec.js +++ b/.vib/prestashop/cypress/cypress/integration/prestashop_spec.js @@ -12,97 +12,36 @@ it('allows a user to place an order and an admin to list it', () => { cy.visit('/order'); cy.fixture('customers').then((customers) => { cy.get('form#customer-form').within(() => { - cy.get('input#field-id_gender-1').check(); - cy.get('input#field-firstname').type(customers.shopper.firstName); - cy.get('input#field-lastname').type(customers.shopper.lastName); - cy.get('input#field-email').type(`${random}${customers.shopper.email}`); - cy.get('input[name="customer_privacy"]').check(); - cy.get('input[name="psgdpr"]').check(); + cy.get('#field-id_gender-1').check(); + cy.get('#field-firstname').type(customers.shopper.firstName); + cy.get('#field-lastname').type(customers.shopper.lastName); + cy.get('#field-email').type(`${random}${customers.shopper.email}`); + cy.get('[name="customer_privacy"]').check(); + cy.get('[name="psgdpr"]').check(); cy.contains('button', 'Continue').click(); }); cy.get('div.js-address-form').within(() => { - cy.get('input#field-address1').type(customers.shopper.address.street); - cy.get('input#field-city').type(customers.shopper.address.city); - cy.get('select#field-id_state').select(customers.shopper.address.state); - cy.get('input#field-postcode').type(customers.shopper.address.zipcode); + cy.get('#field-address1').type(customers.shopper.address.street); + cy.get('#field-city').type(customers.shopper.address.city); + cy.get('#field-id_state').select(customers.shopper.address.state); + cy.get('#field-postcode').type(customers.shopper.address.zipcode); cy.contains('button', 'Continue').click(); }); cy.get('form#js-delivery').within(() => { cy.contains('button', 'Continue').click(); }); - cy.get('input#payment-option-1').click(); - cy.get('input[id*="conditions_to_approve"]').click(); + cy.get('#payment-option-1').click(); + cy.get('[id*="conditions_to_approve"]').click(); cy.contains('button', 'Place order').click(); cy.contains('order is confirmed'); cy.login(); cy.contains('a[href*="sell/orders/?"]', 'Orders').click(); - cy.contains('li#subtab-AdminOrders', 'Orders').click(); + cy.get('#subtab-AdminOrders').click(); cy.get('td[class*="column-reference"]').first().click(); cy.contains(`${random}${customers.shopper.email}`); }); }); -it('allows registering a new product', () => { - cy.login(); - cy.contains('[href*="catalog/products"]', 'Catalog').click(); - cy.contains('[href*="catalog/products"]', 'Products').click(); - cy.get('div.header-toolbar').within(() => { - cy.contains('[href*="catalog/products/new"]', 'New product').click(); - }); - - cy.fixture('products').then((products) => { - cy.get('input[placeholder="Enter your product name"]').type( - `${products.newProduct.name} ${random}` - ); - cy.get('input[type="file"][accept="image/*"]').selectFile( - 'cypress/fixtures/images/product_image.png', - { force: true } - ); - cy.get('input#form_step1_price_shortcut').type(products.newProduct.price); - cy.contains('input#submit', 'Save').click(); - cy.contains('Settings updated'); - - cy.contains('[href*="catalog/products"]', 'Products').click(); - cy.contains(`${products.newProduct.name} ${random}`); - }); -}); - -it('allows registering a new customer', () => { - cy.login(); - cy.contains('[href*="sell/customers"]', 'Customers').click(); - cy.contains('li#subtab-AdminCustomers', 'Customers').click(); - cy.get('div.header-toolbar').within(() => { - cy.contains('[href*="customers/new"]', 'Add new customer').click(); - }); - - cy.fixture('customers').then((customers) => { - cy.get('input#customer_first_name').type(customers.newCustomer.firstName); - cy.get('input#customer_last_name').type(customers.newCustomer.lastName); - cy.get('input#customer_email').type( - `${random}.${customers.newCustomer.email}` - ); - cy.get('input#customer_password').type(customers.newCustomer.password); - cy.get('button#save-button').click(); - cy.contains('Successful creation'); - cy.contains(`${random}.${customers.newCustomer.email}`); - }); - cy.clearCookies(); - cy.clearLocalStorage(); -}); - -it('has payments activated', () => { - cy.login(); - cy.contains('[href*="payment/payment_methods"]', 'Payment').click(); - cy.contains('[href*="payment/payment_methods"]', 'Payment Methods').click(); - const DEFAULT_ACTIVE_PAY_METHODS = ['Bank transfer', 'Payments by check']; - - cy.contains('div.card', 'Active payment').within(() => { - DEFAULT_ACTIVE_PAY_METHODS.forEach((method) => { - cy.contains(method); - }); - }); -}); - it('allows performing backups', () => { cy.login(); cy.contains( diff --git a/.vib/prestashop/cypress/cypress/support/commands.js b/.vib/prestashop/cypress/cypress/support/commands.js index ef88db796..982d8ba74 100644 --- a/.vib/prestashop/cypress/cypress/support/commands.js +++ b/.vib/prestashop/cypress/cypress/support/commands.js @@ -26,18 +26,10 @@ Cypress.Commands.add( 'login', (email = Cypress.env('email'), password = Cypress.env('password')) => { cy.visit('/administration/index.php'); - cy.get('input#email').type(email); - cy.get('input#passwd').type(password); - cy.get('button#submit_login').click(); - cy.get('div#error').should('not.exist'); + cy.get('#email').type(email); + cy.get('#passwd').type(password); + cy.get('#submit_login').click(); cy.contains('Dashboard'); - cy.get('body').then(($body) => { - if ( - $body.find('button[class*="onboarding-button-shut-down"]').length > 0 - ) { - cy.get('button[class*="onboarding-button-shut-down"]').click(); - } - }); } ); diff --git a/.vib/prestashop/goss/goss.yaml b/.vib/prestashop/goss/goss.yaml index 401079aaf..403d8346c 100644 --- a/.vib/prestashop/goss/goss.yaml +++ b/.vib/prestashop/goss/goss.yaml @@ -1,33 +1,44 @@ +http: + http://localhost:{{ .Vars.containerPorts.http }}: + status: 302 + no-follow-redirects: true + https://localhost:{{ .Vars.containerPorts.https }}: + status: 302 + allow-insecure: true + no-follow-redirects: true command: - apcu-caching-support: - exec: /opt/bitnami/php/bin/php -i | grep --quiet apcu - exit-status: 0 - stdout: [ ] - stderr: [ ] - timeout: 40000 - prestashop-version-ok: - exec: cat /opt/bitnami/prestashop/app/AppKernel.php | grep --quiet $(echo $APP_VERSION | tr "-" ".") - exit-status: 0 - stdout: [ ] - stderr: [ ] - timeout: 40000 prestashop-cli-list-commands: - exec: /opt/bitnami/php/bin/php /opt/bitnami/prestashop/bin/console prestashop:list:commands-and-queries + exec: /opt/bitnami/php/bin/php /opt/bitnami/prestashop/bin/console prestashop:config get PS_COOKIE_CHECKIP exit-status: 0 stdout: - - "Class:" - - "Type:" - stderr: [ ] - timeout: 40000 + - /PS_COOKIE_CHECKIP={{ (eq .Vars.prestashopCookieCheckIP "yes") | int }}/ + check-user-info: + exec: id + exit-status: 0 + stdout: + - uid={{ .Vars.containerSecurityContext.runAsUser }} + - /groups=.*{{ .Vars.podSecurityContext.fsGroup }}/ file: - /opt/bitnami/prestashop: - filetype: symlink - linked-to: /bitnami/prestashop + /etc/hosts: exists: true + filetype: file + contains: + {{ range .Vars.hostAliases }} + {{ $ip := .ip }} + {{ range $host := .hostnames }} + - /{{ $ip }}.*{{ $host }}/ + {{ end }} + {{ end }} + /bitnami/prestashop: + exists: true + filetype: directory + mode: '2775' + owner: root /opt/bitnami/prestashop/app/config/parameters.php: mode: "0644" filetype: file exists: true contains: - - {{ printf "/database_name.*%s/" .Env.PRESTASHOP_DATABASE_NAME }} - - {{ printf "/database_user.*%s/" .Env.PRESTASHOP_DATABASE_USER }} \ No newline at end of file + - /database_name.*{{ .Vars.mariadb.auth.database }}/ + - /database_user.*{{ .Vars.mariadb.auth.username }}/ + - /database_password.*{{ .Vars.mariadb.auth.password }}/ \ No newline at end of file diff --git a/.vib/prestashop/goss/vars.yaml b/.vib/prestashop/goss/vars.yaml new file mode 100644 index 000000000..fcf234bc5 --- /dev/null +++ b/.vib/prestashop/goss/vars.yaml @@ -0,0 +1,17 @@ +hostAliases: + - ip: "127.0.0.1" + hostnames: + - "status.localhost" +prestashopCookieCheckIP: "no" +containerPorts: + http: 8081 + https: 8444 +podSecurityContext: + fsGroup: 1002 +containerSecurityContext: + runAsUser: 1002 +mariadb: + auth: + database: bitnami_test_prestashop + username: bn_test_prestashop + password: bitnami_test_prestashop \ No newline at end of file diff --git a/.vib/prestashop/vib-publish.json b/.vib/prestashop/vib-publish.json index 82244f4cd..dcf592629 100644 --- a/.vib/prestashop/vib-publish.json +++ b/.vib/prestashop/vib-publish.json @@ -22,7 +22,7 @@ "url": "{SHA_ARCHIVE}", "path": "/bitnami/prestashop" }, - "runtime_parameters": "cHJlc3Rhc2hvcFVzZXJuYW1lOiB1c2VyCnByZXN0YXNob3BFbWFpbDogdXNlckBleGFtcGxlLmNvbQpwcmVzdGFzaG9wUGFzc3dvcmQ6IENvbXBsaWNhdGVkUGFzc3dvcmQxMjMhNApwcmVzdGFzaG9wSG9zdDogdm13YXJlLXByZXN0YXNob3AubXkKc2VydmljZToKICB0eXBlOiBMb2FkQmFsYW5jZXIKICBwb3J0czoKICAgIGh0dHA6IDgwCg==", + "runtime_parameters": "aG9zdEFsaWFzZXM6CiAgLSBpcDogIjEyNy4wLjAuMSIKICAgIGhvc3RuYW1lczoKICAgICAgLSAic3RhdHVzLmxvY2FsaG9zdCIKcHJlc3Rhc2hvcFNraXBJbnN0YWxsOiBmYWxzZQpwcmVzdGFzaG9wSG9zdDogdm13YXJlLXByZXN0YXNob3AubXkKcHJlc3Rhc2hvcFVzZXJuYW1lOiBiaXRuYW1pVGVzdApwcmVzdGFzaG9wRW1haWw6IGJpdG5hbWlUZXN0QGV4YW1wbGUuY29tCnByZXN0YXNob3BQYXNzd29yZDogQ29tcGxpY2F0ZWRQYXNzd29yZDEyMyE0CnByZXN0YXNob3BDb29raWVDaGVja0lQOiAibm8iCmNvbnRhaW5lclBvcnRzOgogIGh0dHA6IDgwODEKICBodHRwczogODQ0NApwb2RTZWN1cml0eUNvbnRleHQ6CiAgZW5hYmxlZDogdHJ1ZQogIGZzR3JvdXA6IDEwMDIKY29udGFpbmVyU2VjdXJpdHlDb250ZXh0OgogIGVuYWJsZWQ6IHRydWUKICBydW5Bc1VzZXI6IDEwMDIKc2VydmljZToKICB0eXBlOiBMb2FkQmFsYW5jZXIKICBwb3J0czoKICAgIGh0dHA6IDgwCm1hcmlhZGI6CiAgZW5hYmxlZDogdHJ1ZQogIGF1dGg6CiAgICBkYXRhYmFzZTogYml0bmFtaV90ZXN0X3ByZXN0YXNob3AKICAgIHVzZXJuYW1lOiBibl90ZXN0X3ByZXN0YXNob3AKICAgIHBhc3N3b3JkOiBiaXRuYW1pX3Rlc3RfcHJlc3Rhc2hvcA==", "target_platform": { "target_platform_id": "{VIB_ENV_TARGET_PLATFORM}", "size": { @@ -44,6 +44,7 @@ "resources": { "path": "/.vib/prestashop/goss" }, + "vars_file": "vars.yaml", "remote": { "workload": "deploy-prestashop" } @@ -58,7 +59,8 @@ "endpoint": "lb-prestashop-http", "app_protocol": "HTTP", "env": { - "username": "user", + "username": "bitnamiTest", + "email": "bitnamiTest@example.com", "password": "ComplicatedPassword123!4" } } diff --git a/.vib/prestashop/vib-verify.json b/.vib/prestashop/vib-verify.json index 16ac8fa4a..81786f5b1 100644 --- a/.vib/prestashop/vib-verify.json +++ b/.vib/prestashop/vib-verify.json @@ -22,7 +22,7 @@ "url": "{SHA_ARCHIVE}", "path": "/bitnami/prestashop" }, - "runtime_parameters": "cHJlc3Rhc2hvcFVzZXJuYW1lOiB1c2VyCnByZXN0YXNob3BFbWFpbDogdXNlckBleGFtcGxlLmNvbQpwcmVzdGFzaG9wUGFzc3dvcmQ6IENvbXBsaWNhdGVkUGFzc3dvcmQxMjMhNApwcmVzdGFzaG9wSG9zdDogdm13YXJlLXByZXN0YXNob3AubXkKc2VydmljZToKICB0eXBlOiBMb2FkQmFsYW5jZXIKICBwb3J0czoKICAgIGh0dHA6IDgwCg==", + "runtime_parameters": "aG9zdEFsaWFzZXM6CiAgLSBpcDogIjEyNy4wLjAuMSIKICAgIGhvc3RuYW1lczoKICAgICAgLSAic3RhdHVzLmxvY2FsaG9zdCIKcHJlc3Rhc2hvcFNraXBJbnN0YWxsOiBmYWxzZQpwcmVzdGFzaG9wSG9zdDogdm13YXJlLXByZXN0YXNob3AubXkKcHJlc3Rhc2hvcFVzZXJuYW1lOiBiaXRuYW1pVGVzdApwcmVzdGFzaG9wRW1haWw6IGJpdG5hbWlUZXN0QGV4YW1wbGUuY29tCnByZXN0YXNob3BQYXNzd29yZDogQ29tcGxpY2F0ZWRQYXNzd29yZDEyMyE0CnByZXN0YXNob3BDb29raWVDaGVja0lQOiAibm8iCmNvbnRhaW5lclBvcnRzOgogIGh0dHA6IDgwODEKICBodHRwczogODQ0NApwb2RTZWN1cml0eUNvbnRleHQ6CiAgZW5hYmxlZDogdHJ1ZQogIGZzR3JvdXA6IDEwMDIKY29udGFpbmVyU2VjdXJpdHlDb250ZXh0OgogIGVuYWJsZWQ6IHRydWUKICBydW5Bc1VzZXI6IDEwMDIKc2VydmljZToKICB0eXBlOiBMb2FkQmFsYW5jZXIKICBwb3J0czoKICAgIGh0dHA6IDgwCm1hcmlhZGI6CiAgZW5hYmxlZDogdHJ1ZQogIGF1dGg6CiAgICBkYXRhYmFzZTogYml0bmFtaV90ZXN0X3ByZXN0YXNob3AKICAgIHVzZXJuYW1lOiBibl90ZXN0X3ByZXN0YXNob3AKICAgIHBhc3N3b3JkOiBiaXRuYW1pX3Rlc3RfcHJlc3Rhc2hvcA==", "target_platform": { "target_platform_id": "{VIB_ENV_TARGET_PLATFORM}", "size": { @@ -44,6 +44,7 @@ "resources": { "path": "/.vib/prestashop/goss" }, + "vars_file": "vars.yaml", "remote": { "workload": "deploy-prestashop" } @@ -58,7 +59,8 @@ "endpoint": "lb-prestashop-http", "app_protocol": "HTTP", "env": { - "username": "user", + "username": "bitnamiTest", + "email": "bitnamiTest@example.com", "password": "ComplicatedPassword123!4" } }