Skip to content

Commit

Permalink
Ready to write acceptance tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
ksuess committed Mar 2, 2023
1 parent ff886ef commit 2330ec1
Show file tree
Hide file tree
Showing 29 changed files with 104 additions and 613 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ RESET=`tput sgr0`
YELLOW=`tput setaf 3`

PLONE_VERSION=6
VOLTO_VERSION=16.10.0
VOLTO_VERSION=16.12.0

ADDON_NAME='@rohberg/volto-searchkit-block'
ADDON_PATH='volto-searchkit-block'
Expand Down
57 changes: 51 additions & 6 deletions acceptance/ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: "3"

services:

addon-acceptance:
build:
context: ../
Expand All @@ -23,14 +22,60 @@ services:
backend-acceptance:
image: plone/plone-backend:${PLONE_VERSION:-6}
command: ./bin/robot-server plone.app.robotframework.testing.VOLTO_ROBOT_TESTING
# command: bin/celery -A collective.elastic.ingest.celery.app multi restart workersearchkitblock --logfile="/app/celery/celery%n%I.log" --pidfile="/app/celery/celery%n.pid" > /dev/null 2>&1 &; bin/robot-server plone.app.robotframework.testing.VOLTO_ROBOT_TESTING > /dev/null 2>&1 &;
volumes:
- ./configuration/ploneconfiguration/:/app/ploneconfiguration/
environment:
ZSERVER_HOST: 0.0.0.0
ZSERVER_PORT: 55001
ADDONS: 'plone.app.robotframework==2.0.0'
APPLY_PROFILES: plone.app.contenttypes:plone-content,plone.restapi:default,plone.volto:default-homepage
CONFIGURE_PACKAGES: plone.app.contenttypes,plone.restapi,plone.volto,plone.volto.cors
# ##### plone.app.robotframework
ZSERVER_HOST: "0.0.0.0"
ZSERVER_PORT: "55001"
APPLY_PROFILES: "plone.app.contenttypes:plone-content,plone.restapi:default,plone.volto:default-homepage, rohberg.elasticsearchblocks:testing"
CONFIGURE_PACKAGES: "plone.app.contenttypes,plone.restapi,plone.volto,plone.volto.cors,rohberg.elasticsearchblocks"
# INSTALL_PRODUCTS: "collective.elastic.plone,collective.elastic.ingest,rohberg.elasticsearchblocks"
# ##### plone-backend docker image
ADDONS: "plone.app.robotframework==2.0.0a6 plone.app.testing==7.0.0a3 plone.app.contenttypes plone.restapi plone.volto celery redis collective.elastic.plone@git+https://github.com/collective/collective.elastic.plone.git collective.elastic.ingest@git+https://github.com/collective/collective.elastic.ingest.git rohberg.elasticsearchblocks@git+https://github.com/rohberg/rohberg.elasticsearchblocks"
SITE: "plone"
# DEVELOP: "git+https://github.com/collective/collective.elastic.plone.git#egg=collective.elastic.plone"

CELERY_BROKER: redis://host.docker.internal:6379
ELASTICSEARCH_INDEX: plone
ELASTICSEARCH_QUERY_SERVER: http://host.docker.internal:9200
ELASTICSEARCH_QUERY_USE_SSL: 0

# CELERY_BROKER: redis://localhost:6379/0
ELASTICSEARCH_INGEST_SERVER: host.docker.internal:9200
ELASTICSEARCH_INGEST_USE_SSL: 0

PLONE_SERVICE: http://127.0.0.1:55001
PLONE_PATH: Plone
PLONE_USER: admin
PLONE_PASSWORD: secret

ANALYSIS_FILE: /app/ploneconfiguration/elasticsearch-analysis.json
MAPPINGS_FILE: /app/ploneconfiguration/elasticsearch-mappings.json
PREPROCESSINGS_FILE: /app/ploneconfiguration/elasticsearch-preprocessings.json
ports:
- 55001:55001
profiles:
- dev
- prod
depends_on:
- redis
- elk
elk:
image: ksuess/rohberg-elk-mac:rc2
# image: sebp/elk:oss-8.1.0
environment:
# ES_CORS_ALLOW_ORIGIN: "/https?://(.*)localhost(.*)/"
ES_CORS_ALLOW_ORIGIN: "*"
ports:
- "5601:5601"
- "9200:9200"
- "5044:5044"
volumes:
- ./configuration/elasticsearchconfiguration/elasticsearch-keywords.txt:/etc/elasticsearch/elasticsearch-keywords.txt
- ./configuration/elasticsearchconfiguration/elasticsearch-lexicon.txt:/etc/elasticsearch/elasticsearch-lexicon.txt
redis:
image: redis/redis-stack-server:latest
ports:
- 6379:6379
114 changes: 1 addition & 113 deletions acceptance/cypress/tests/blocks.cy.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getSlateEditorAndType } from '../support/slate';

context('Blocks Acceptance Tests', () => {
describe('Text Block Tests', () => {
describe('Searchkit Block Tests', () => {
beforeEach(() => {
// given a logged in editor and a page in edit mode
cy.visit('/');
Expand Down Expand Up @@ -85,117 +85,5 @@ context('Blocks Acceptance Tests', () => {
cy.get('.block.__grid').findByText('My Page');
});

it('As editor I can add a Teaser Grid', function () {
cy.getSlate().click();
cy.get('.button .block-add-button').click({ force: true });
cy.get('.blocks-chooser .mostUsed .button.teaserGrid').click({
force: true,
});
cy.findByText('2 columns').click();
cy.get(
'.teaserGrid.two [data-rbd-draggable-context-id]:first-child',
).click();
cy.get(
'#sidebar-properties .inline.field.text:first-of-type() .objectbrowser-field:first-of-type() .ui.button.action svg',
).click();
cy.findByLabelText('Select My Page').dblclick();
// This is because the objectbrowser doesn't shows the content
cy.wait(500);
cy.get(
'#sidebar-properties .inline.field.text:nth-of-type(5) .objectbrowser-field:first-of-type() .ui.button.action svg',
).click();
cy.findByText('My Image', { selector: 'span' }).click();
cy.get(
'.teaserGrid.two [data-rbd-draggable-context-id]:nth-child(2)',
).click();
cy.get(
'#sidebar-properties .inline.field.text:first-of-type() .objectbrowser-field:first-of-type() .ui.button.action svg',
).click();
cy.findByLabelText('Select My Page').dblclick();

// This is because the objectbrowser doesn't shows the content
cy.wait(500);
cy.get(
'#sidebar-properties .inline.field.text:nth-of-type(5) .objectbrowser-field:first-of-type() .ui.button.action svg',
).click();
cy.findByLabelText('Select My Image').dblclick();

cy.get('#toolbar-save').click();
cy.wait(500);

//then we are able to get the My Page in view Mode.
cy.get('.block.teaserGrid .two.column .column:first-child h2').should(
'have.text',
'My Page',
);
});

it('As editor I can add an Image Grid', function () {
cy.getSlate().click();
cy.get('.button .block-add-button').click({ force: true });
cy.get('.blocks-chooser .mostUsed .button.imagesGrid').click({
force: true,
});
cy.findByText('2 columns').click();
cy.get(
'.imagesGrid.two [data-rbd-draggable-context-id]:first-child .toolbar-inner .buttons:first-child button',
).click();
cy.findByLabelText('Select My Image').dblclick();
cy.get(
'.imagesGrid.two [data-rbd-draggable-context-id]:first-child',
).click();
cy.get('#field-alt').click().type('My Image');

cy.get(
'.imagesGrid.two [data-rbd-draggable-context-id]:last-child .toolbar-inner .buttons:first-child button',
).click();
cy.findByLabelText('Select My Image').dblclick();
cy.get(
'.imagesGrid.two [data-rbd-draggable-context-id]:last-child',
).click();
cy.get('#field-alt').click().type('My Image');

cy.get('#toolbar-save').click();

//then we should have AltText My Image present in view mode
cy.findAllByAltText('My Image').should('have.length', 2);
});

it('As editor I can add a Grid with slate block on it', function () {
cy.get('.block .slate-editor [contenteditable=true]').click();

cy.get('.button .block-add-button').click({ force: true });
cy.get('.blocks-chooser .mostUsed .button.__grid').click({ force: true });
cy.findByText('2 columns').click();

cy.get('button[aria-label="Add grid block in position 1"]').click();
cy.get('.blocks-chooser [aria-label="Unfold Text blocks"]').click();
cy.get('.blocks-chooser .text .button.slate').click();
// cy.get('.block.__grid.selected .slate-editor [contenteditable=true]')
// .wait(10000)
// .type('Colorless green ideas sleep furiously.');
cy.scrollTo('top');

getSlateEditorAndType(
'.block.__grid.selected .slate-editor [contenteditable=true]',
'Colorless green ideas sleep furiously.',
).setSelection('furiously');
cy.scrollTo('top');
cy.wait(1000);
cy.scrollTo('top');
cy.get(
'.slate-inline-toolbar .ui.buttons .button-wrapper a[title="Add link"]',
).click();
cy.get('.link-form-container input').type('https://google.com{enter}');

cy.get('#toolbar-save').click();

cy.get('.block.__grid.centered.two p').contains(
'Colorless green ideas sleep furiously.',
);
cy.get('.block.__grid.centered.two p a')
.should('have.attr', 'href')
.and('include', 'https://google.com');
});
});
});
49 changes: 0 additions & 49 deletions acceptance/cypress/tests/teaser.cy.js

This file was deleted.

56 changes: 51 additions & 5 deletions acceptance/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,60 @@ services:
backend-acceptance:
image: plone/plone-backend:${PLONE_VERSION:-6}
command: ./bin/robot-server plone.app.robotframework.testing.VOLTO_ROBOT_TESTING
# command: bin/celery -A collective.elastic.ingest.celery.app multi restart workersearchkitblock --logfile="/app/celery/celery%n%I.log" --pidfile="/app/celery/celery%n.pid" > /dev/null 2>&1 &; bin/robot-server plone.app.robotframework.testing.VOLTO_ROBOT_TESTING > /dev/null 2>&1 &;
volumes:
- ./configuration/ploneconfiguration/:/app/ploneconfiguration/
environment:
ZSERVER_HOST: 0.0.0.0
ZSERVER_PORT: 55001
ADDONS: 'plone.app.robotframework==2.0.0'
APPLY_PROFILES: plone.app.contenttypes:plone-content,plone.restapi:default,plone.volto:default-homepage
CONFIGURE_PACKAGES: plone.app.contenttypes,plone.restapi,plone.volto,plone.volto.cors
# ##### plone.app.robotframework
ZSERVER_HOST: "0.0.0.0"
ZSERVER_PORT: "55001"
APPLY_PROFILES: "plone.app.contenttypes:plone-content,plone.restapi:default,plone.volto:default-homepage, rohberg.elasticsearchblocks:testing"
CONFIGURE_PACKAGES: "plone.app.contenttypes,plone.restapi,plone.volto,plone.volto.cors,rohberg.elasticsearchblocks"
# INSTALL_PRODUCTS: "collective.elastic.plone,collective.elastic.ingest,rohberg.elasticsearchblocks"
# ##### plone-backend docker image
ADDONS: "plone.app.robotframework==2.0.0a6 plone.app.testing==7.0.0a3 plone.app.contenttypes plone.restapi plone.volto celery redis collective.elastic.plone@git+https://github.com/collective/collective.elastic.plone.git collective.elastic.ingest@git+https://github.com/collective/collective.elastic.ingest.git rohberg.elasticsearchblocks@git+https://github.com/rohberg/rohberg.elasticsearchblocks"
SITE: "plone"
# DEVELOP: "git+https://github.com/collective/collective.elastic.plone.git#egg=collective.elastic.plone"

CELERY_BROKER: redis://host.docker.internal:6379
ELASTICSEARCH_INDEX: plone
ELASTICSEARCH_QUERY_SERVER: http://host.docker.internal:9200
ELASTICSEARCH_QUERY_USE_SSL: 0

# CELERY_BROKER: redis://localhost:6379/0
ELASTICSEARCH_INGEST_SERVER: host.docker.internal:9200
ELASTICSEARCH_INGEST_USE_SSL: 0

PLONE_SERVICE: http://127.0.0.1:55001
PLONE_PATH: Plone
PLONE_USER: admin
PLONE_PASSWORD: secret

ANALYSIS_FILE: /app/ploneconfiguration/elasticsearch-analysis.json
MAPPINGS_FILE: /app/ploneconfiguration/elasticsearch-mappings.json
PREPROCESSINGS_FILE: /app/ploneconfiguration/elasticsearch-preprocessings.json
ports:
- 55001:55001
profiles:
- dev
- prod
depends_on:
- redis
- elk
elk:
image: ksuess/rohberg-elk-mac:rc2
# image: sebp/elk:oss-8.1.0
environment:
# ES_CORS_ALLOW_ORIGIN: "/https?://(.*)localhost(.*)/"
ES_CORS_ALLOW_ORIGIN: "*"
ports:
- "5601:5601"
- "9200:9200"
- "5044:5044"
volumes:
- ./configuration/elasticsearchconfiguration/elasticsearch-keywords.txt:/etc/elasticsearch/elasticsearch-keywords.txt
- ./configuration/elasticsearchconfiguration/elasticsearch-lexicon.txt:/etc/elasticsearch/elasticsearch-lexicon.txt
redis:
image: redis/redis-stack-server:latest
ports:
- 6379:6379
46 changes: 0 additions & 46 deletions api/Makefile

This file was deleted.

Loading

0 comments on commit 2330ec1

Please sign in to comment.