Skip to content

Commit

Permalink
Fix acceptance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ericof committed Jul 31, 2023
1 parent 4bae649 commit b70b9a3
Show file tree
Hide file tree
Showing 7 changed files with 2,056 additions and 2,610 deletions.
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ start-test-acceptance-server: ## Start acceptance server
.PHONY: start-test-acceptance-server-prod
start-test-acceptance-server-prod: ## Start acceptance server
${ACCEPTANCE} --profile prod up -d

.PHONY: test-acceptance
test-acceptance: ## Start Cypress
(cd acceptance && ./node_modules/.bin/cypress open)
Expand All @@ -151,7 +150,7 @@ test-acceptance-headless: ## Run cypress tests in CI

.PHONY: stop-test-acceptance-server
stop-test-acceptance-server: ## Stop acceptance server
${ACCEPTANCE} down
${ACCEPTANCE} --profile prod --profile dev down

.PHONY: status-test-acceptance-server
status-test-acceptance-server: ## Status of Acceptance Server
Expand Down
10 changes: 1 addition & 9 deletions acceptance/cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -1,9 +1 @@
import '@plone/volto/cypress/add-commands';

// Set PLONE_SITE_ID and PLONE_API_URL as cypress environment variables
// if testing without using localhost or a site id of `plone`.

// --- CUSTOM COMMANDS -------------------------------------------------------------
Cypress.Commands.add('custom_command', () => {
// Custom code here...
});
import '@plone/volto-testing/cypress/support/commands';
34 changes: 34 additions & 0 deletions acceptance/cypress/tests/blocks.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
context('Blocks Acceptance Tests', () => {
describe('Text Block Tests', () => {
beforeEach(() => {
// given a logged in editor and a page in edit mode
cy.visit('/');
cy.autologin();
cy.createContent({
contentType: 'Document',
contentId: 'document',
contentTitle: 'Test document',
});
cy.visit('/document');
cy.waitForResourceToLoad('document');
cy.navigate('/document/edit');
});

it('As editor I can add a Follow Us block', function () {
cy.intercept('PATCH', '/**/document').as('edit');
cy.intercept('GET', '/**/document').as('content');
cy.intercept('GET', '/**/Document').as('schema');

cy.getSlate().click();
cy.get('.button .block-add-button').click({ force: true });
cy.get('.blocks-chooser .common .button.follow_us').click({
force: true,
});
cy.get('#blockform-fieldset-default .ui.input #field-title')
.click()
.type('Redes sociais');
cy.get('.inline.field.field-wrapper-animate .ui.checkbox').click();
cy.get('#toolbar-save').click();
});
});
});
2 changes: 1 addition & 1 deletion acceptance/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ x-addon: &addon
- ${CURRENT_DIR}:/app/src/addons/${ADDON_PATH}/
environment:
RAZZLE_INTERNAL_API_PATH: http://backend-acceptance:55001/plone
RAZZLE_API_PATH: http://localhost:8080/Plone
RAZZLE_API_PATH: http://localhost:55001/plone
HOST: 0.0.0.0
tty: true
profiles:
Expand Down
Loading

0 comments on commit b70b9a3

Please sign in to comment.