mirror of
https://github.com/wahyd4/charts.git
synced 2026-08-09 05:06:29 +10:00
[bitnami/drupal] Add Cypress and Goss tests to Drupal Chart (#12159)
* [bitnami/drupal] Add Cypress and Goss tests to Drupal Chart Signed-off-by: Michiel <michield@vmware.com>
This commit is contained in:
@@ -11,6 +11,7 @@ on: # rebuild any PRs and main branch changes
|
||||
- 'bitnami/consul/**'
|
||||
- 'bitnami/discourse/**'
|
||||
- 'bitnami/dokuwiki/**'
|
||||
- 'bitnami/drupal/**'
|
||||
- 'bitnami/elasticsearch/**'
|
||||
- 'bitnami/etcd/**'
|
||||
- 'bitnami/external-dns/**'
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"baseUrl": "http://localhost",
|
||||
"env": {
|
||||
"username": "test_user",
|
||||
"password": "ComplicatedPassword123!4"
|
||||
},
|
||||
"defaultCommandTimeout": 30000
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"newArticle": {
|
||||
"title": "newarticle",
|
||||
"altText": "Alternative image text"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1,15 @@
|
||||
/// <reference types="cypress" />
|
||||
import { random } from '../support/utils';
|
||||
|
||||
it('allows creating an article with an image', () => {
|
||||
cy.login();
|
||||
cy.visit('/node/add/article');
|
||||
cy.fixture('articles').then((article) => {
|
||||
cy.get('.text-full[name*=title]').type(`${article.newArticle.title} ${random}`);
|
||||
cy.get('[type=file]').selectFile('cypress/fixtures/images/test_image.jpeg', { force: true });
|
||||
cy.get('input[id*="alt"]').type(`${article.newArticle.altText}`);
|
||||
cy.contains('Save').click();
|
||||
cy.visit('/admin/content');
|
||||
cy.contains(`${article.newArticle.title} ${random}`);
|
||||
})
|
||||
});
|
||||
@@ -0,0 +1,24 @@
|
||||
const COMMAND_DELAY = 2000;
|
||||
|
||||
for (const command of ['click']) {
|
||||
Cypress.Commands.overwrite(command, (originalFn, ...args) => {
|
||||
const origVal = originalFn(...args);
|
||||
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolve(origVal);
|
||||
}, COMMAND_DELAY);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Cypress.Commands.add(
|
||||
'login',
|
||||
(username = Cypress.env('username'), password = Cypress.env('password')) => {
|
||||
cy.visit('/user/login');
|
||||
cy.get('#edit-name').type(username);
|
||||
cy.get('#edit-pass').type(password);
|
||||
cy.contains('input', 'Log in').click();
|
||||
}
|
||||
);
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
// ***********************************************************
|
||||
// This example support/index.js is processed and
|
||||
// loaded automatically before your test files.
|
||||
//
|
||||
// This is a great place to put global configuration and
|
||||
// behavior that modifies Cypress.
|
||||
//
|
||||
// You can change the location of this file or turn off
|
||||
// automatically serving support files with the
|
||||
// 'supportFile' configuration option.
|
||||
//
|
||||
// You can read more here:
|
||||
// https://on.cypress.io/configuration
|
||||
// ***********************************************************
|
||||
|
||||
// Import commands.js using ES2015 syntax:
|
||||
import './commands';
|
||||
|
||||
// Alternatively you can use CommonJS syntax:
|
||||
// require('./commands')
|
||||
@@ -0,0 +1,3 @@
|
||||
/// <reference types="cypress" />
|
||||
|
||||
export let random = (Math.random() + 1).toString(36).substring(7);
|
||||
@@ -0,0 +1,31 @@
|
||||
http:
|
||||
https://drupal:{{ .Vars.service.ports.https }}:
|
||||
status: 200
|
||||
allow-insecure: true
|
||||
command:
|
||||
check-user-info:
|
||||
exec: id
|
||||
exit-status: 0
|
||||
stdout:
|
||||
- uid={{ .Vars.containerSecurityContext.runAsUser }}
|
||||
- /groups=.*{{ .Vars.podSecurityContext.fsGroup }}/
|
||||
file:
|
||||
/bitnami/drupal:
|
||||
exists: true
|
||||
filetype: directory
|
||||
mode: '2775'
|
||||
owner: root
|
||||
/var/run/secrets/kubernetes.io/serviceaccount:
|
||||
exists: {{ .Vars.serviceAccount.automountServiceAccountToken }}
|
||||
filetype: directory
|
||||
mode: "3777"
|
||||
/etc/hosts:
|
||||
exists: true
|
||||
filetype: file
|
||||
contains:
|
||||
{{ range .Vars.hostAliases }}
|
||||
{{ $ip := .ip }}
|
||||
{{ range $host := .hostnames }}
|
||||
- /{{ $ip }}.*{{ $host }}/
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
@@ -0,0 +1,13 @@
|
||||
service:
|
||||
ports:
|
||||
https: 444
|
||||
podSecurityContext:
|
||||
fsGroup: 1002
|
||||
containerSecurityContext:
|
||||
runAsUser: 1002
|
||||
serviceAccount:
|
||||
automountServiceAccountToken: true
|
||||
hostAliases:
|
||||
- ip: 127.0.0.1
|
||||
hostnames:
|
||||
- status.testhost
|
||||
@@ -22,7 +22,7 @@
|
||||
"url": "{SHA_ARCHIVE}",
|
||||
"path": "/bitnami/drupal"
|
||||
},
|
||||
"runtime_parameters": "ImRydXBhbFBhc3N3b3JkIjogIlMzOUJLV2pTa2gi",
|
||||
"runtime_parameters": "ZHJ1cGFsVXNlcm5hbWU6IHRlc3RfdXNlcgpkcnVwYWxQYXNzd29yZDogQ29tcGxpY2F0ZWRQYXNzd29yZDEyMyE0Cm1hcmlhZGI6CiAgYXV0aDoKICAgIGRhdGFiYXNlOiB0ZXN0X2RydXBhbF9kYXRhYmFzZQogICAgdXNlcm5hbWU6IHRlc3RfZHJ1cGFsX3VzZXJuYW1lCiAgICBwYXNzd29yZDogdGVzdF9kcnVwYWxfcGFzc3dvcmQKY29udGFpbmVyUG9ydHM6CiAgaHR0cDogODA4MQogIGh0dHBzOiA4NDQ0CnNlcnZpY2U6CiAgdHlwZTogTG9hZEJhbGFuY2VyCiAgcG9ydHM6CiAgICBodHRwOiA4MAogICAgaHR0cHM6IDQ0NApwb2RTZWN1cml0eUNvbnRleHQ6CiAgZW5hYmxlZDogdHJ1ZQogIGZzR3JvdXA6IDEwMDIKY29udGFpbmVyU2VjdXJpdHlDb250ZXh0OgogIGVuYWJsZWQ6IHRydWUKICBydW5Bc1VzZXI6IDEwMDIKaG9zdEFsaWFzZXM6CiAgLSBpcDogMTI3LjAuMC4xCiAgICBob3N0bmFtZXM6CiAgICAgIC0gc3RhdHVzLnRlc3Rob3N0CnNlcnZpY2VBY2NvdW50OgogIGF1dG9tb3VudFNlcnZpY2VBY2NvdW50VG9rZW46IHRydWU=",
|
||||
"target_platform": {
|
||||
"target_platform_id": "{VIB_ENV_TARGET_PLATFORM}",
|
||||
"size": {
|
||||
@@ -37,6 +37,32 @@
|
||||
"endpoint": "lb-drupal-http",
|
||||
"app_protocol": "HTTP"
|
||||
}
|
||||
},
|
||||
{
|
||||
"action_id": "goss",
|
||||
"params": {
|
||||
"resources": {
|
||||
"path": "/.vib/drupal/goss"
|
||||
},
|
||||
"remote": {
|
||||
"workload": "deploy-drupal"
|
||||
},
|
||||
"vars_file": "vars.yaml"
|
||||
}
|
||||
},
|
||||
{
|
||||
"action_id": "cypress",
|
||||
"params": {
|
||||
"resources": {
|
||||
"path": "/.vib/drupal/cypress"
|
||||
},
|
||||
"endpoint": "lb-drupal-http",
|
||||
"app_protocol": "HTTP",
|
||||
"env": {
|
||||
"username": "test_user",
|
||||
"password": "ComplicatedPassword123!4"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
"url": "{SHA_ARCHIVE}",
|
||||
"path": "/bitnami/drupal"
|
||||
},
|
||||
"runtime_parameters": "ImRydXBhbFBhc3N3b3JkIjogIlMzOUJLV2pTa2gi",
|
||||
"runtime_parameters": "ZHJ1cGFsVXNlcm5hbWU6IHRlc3RfdXNlcgpkcnVwYWxQYXNzd29yZDogQ29tcGxpY2F0ZWRQYXNzd29yZDEyMyE0Cm1hcmlhZGI6CiAgYXV0aDoKICAgIGRhdGFiYXNlOiB0ZXN0X2RydXBhbF9kYXRhYmFzZQogICAgdXNlcm5hbWU6IHRlc3RfZHJ1cGFsX3VzZXJuYW1lCiAgICBwYXNzd29yZDogdGVzdF9kcnVwYWxfcGFzc3dvcmQKY29udGFpbmVyUG9ydHM6CiAgaHR0cDogODA4MQogIGh0dHBzOiA4NDQ0CnNlcnZpY2U6CiAgdHlwZTogTG9hZEJhbGFuY2VyCiAgcG9ydHM6CiAgICBodHRwOiA4MAogICAgaHR0cHM6IDQ0NApwb2RTZWN1cml0eUNvbnRleHQ6CiAgZW5hYmxlZDogdHJ1ZQogIGZzR3JvdXA6IDEwMDIKY29udGFpbmVyU2VjdXJpdHlDb250ZXh0OgogIGVuYWJsZWQ6IHRydWUKICBydW5Bc1VzZXI6IDEwMDIKaG9zdEFsaWFzZXM6CiAgLSBpcDogMTI3LjAuMC4xCiAgICBob3N0bmFtZXM6CiAgICAgIC0gc3RhdHVzLnRlc3Rob3N0CnNlcnZpY2VBY2NvdW50OgogIGF1dG9tb3VudFNlcnZpY2VBY2NvdW50VG9rZW46IHRydWU=",
|
||||
"target_platform": {
|
||||
"target_platform_id": "{VIB_ENV_TARGET_PLATFORM}",
|
||||
"size": {
|
||||
@@ -37,6 +37,32 @@
|
||||
"endpoint": "lb-drupal-http",
|
||||
"app_protocol": "HTTP"
|
||||
}
|
||||
},
|
||||
{
|
||||
"action_id": "goss",
|
||||
"params": {
|
||||
"resources": {
|
||||
"path": "/.vib/drupal/goss"
|
||||
},
|
||||
"remote": {
|
||||
"workload": "deploy-drupal"
|
||||
},
|
||||
"vars_file": "vars.yaml"
|
||||
}
|
||||
},
|
||||
{
|
||||
"action_id": "cypress",
|
||||
"params": {
|
||||
"resources": {
|
||||
"path": "/.vib/drupal/cypress"
|
||||
},
|
||||
"endpoint": "lb-drupal-http",
|
||||
"app_protocol": "HTTP",
|
||||
"env": {
|
||||
"username": "test_user",
|
||||
"password": "ComplicatedPassword123!4"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user