Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 479 imagem destaque nao renderiza #481

Merged
merged 4 commits into from
Jun 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Changelog
1.5.2 (unreleased)
^^^^^^^^^^^^^^^^^^

- Imagem de destaque opcional acima da barra de destaques volta a ser renderizada. (fecha `#479 <https://github.com/plonegovbr/brasil.gov.portal/issues/479>`_)
[idgserpro]

- Altera ordem de registro de javascript do collective.upload e collective.portlet.calendar para corrigir alinhamento do título (refs. `brasil.gov.agenda#82 <https://github.com/plonegovbr/brasil.gov.agenda/issues/82>`_).
[idgserpro]

Expand Down Expand Up @@ -758,3 +761,4 @@ Changelog
.. _`#359`: https://github.com/plonegovbr/brasil.gov.portal/issues/359
.. _`#360`: https://github.com/plonegovbr/brasil.gov.portal/issues/360
.. _`#463`: https://github.com/plonegovbr/brasil.gov.portal/issues/463
.. _`#479`: https://github.com/plonegovbr/brasil.gov.portal/issues/479
2 changes: 1 addition & 1 deletion src/brasil/gov/portal/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ var PBrasil = {
carregaDestaques: function(){

if ($('#featured-content').length > 0) {
$('#featured-content').load(portal_url + '/destaques #em-destaque');
$('#featured-content').load(portal_url + '/destaques #content .row');
}

},
Expand Down
84 changes: 84 additions & 0 deletions src/brasil/gov/portal/tests/robot/test_viewlet_destaques.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
*** Settings ***

Resource brasil/gov/portal/tests/robot/keywords.robot
Resource collective/cover/tests/cover.robot

Library Remote ${PLONE_URL}/RobotRemote

Test Setup Abrir navegador
Test Teardown Fechar todos os navegadores

*** Variables ***

${tile_location} 'collective.cover.richtext'
${edit_link_selector} css=a.edit-tile-link
${pasta_exemplos} xpath=//a[contains(@href, "pastas-com-exemplos-de-pecas")]
${exemplo_imagem} xpath=//input[contains(@href, "/pastas-com-exemplos-de-pecas/foto-200-x-130.jpg")]

*** Keywords ***

Todos os tiles viewlet destaque renderizadas
Ir para ${PLONE_URL}
Wait Until Page Contains Element css=div#featured-content div.row div div.tile div#em-destaque
Wait Until Page Contains Element css=div#featured-content div.row div div.tile-default div.cover-richtext-tile


*** Test Cases ***

Criar banner destaque
# Todos os keywords de collective.cover têm como premissa as strings em
# inglês na interface.
# Como os testes de brasil.gov.portal são em português, existiam duas
# formas de aproveitar os keywords de collective.cover:
# 1 - Customizando os keywords, aqui nesse arquivo, mas aí alterações que
# fossem feitas futuramente lá teriam de ser replicadas aqui;
# 2 - Setar o site em inglês apenas para esse teste.
# A longo prazo, é mais vantajoso setar o site em inglês, por envolver
# menos customização e não impactar os demais testes.
Enable Autologin as Site Administrator
Ir para ${PLONE_URL}/@@language-controlpanel
Wait Until Page Contains Element xpath=//select[@id='form.default_language']
Select From List xpath=//select[@id='form.default_language'] en
Clicar botao Salvar

Ir para ${PLONE_URL}/destaques/layoutedit
Add Tile ${tile_location}
Save Cover Layout

# FIXME: Por algum motivo, na build https://travis-ci.org/plonegovbr/brasil.gov.portal/builds/387898576#L1972
# ocorre o erro por usar a keyword "Compose Cover". Essa keyword já é usada
# em test_capa.robot e não dá problema. Em browsers mais novos (como 52.6.0esr)
# esse erro não ocorre. Dessa forma, irei direto para a url "compose" com
# outra keyword. Quando atualizarmos o browser nos testes, podemos voltar a
# usar a keyword "Compose Cover" para manter a consistência de nomes.
Ir para ${PLONE_URL}/destaques/compose
Page Should Contain Please edit the tile to enter some text.

Click Link ${edit_link_selector}
Wait Until Page Contains Edit Rich Text Tile
Sleep 1s Wait for TinyMCE to load
Wait For Condition return typeof tinyMCE !== "undefined" && tinyMCE.activeEditor !== null && document.getElementById(tinyMCE.activeEditor.id) !== null
Click Link Insert/Edit Image
Select frame id=mce_inlinepopups_16_ifr
Wait Until Page Contains Element ${pasta_exemplos}
Click Element ${pasta_exemplos}
# Clico aqui mudando a listagem para "lista" para facilitar a expressão abaixo.
Click Link css=a#listview
# Seleciona o objeto resolveuid/896b6f9794fa4bfcac5cadbca080e33f
Wait Until Page Contains Element ${exemplo_imagem}
Click Element ${exemplo_imagem}
Clicar botao OK
Unselect Frame
Clicar botao Save
Todos os tiles viewlet destaque renderizadas

# Testa mudança de visão
Ir para ${PLONE_URL}/destaques
Click Element css=dl#plone-contentmenu-display
Click Link css=a#plone-contentmenu-display-view
Todos os tiles viewlet destaque renderizadas

Ir para ${PLONE_URL}/destaques
Click Element css=dl#plone-contentmenu-display
Click Link css=a#plone-contentmenu-display-standard
Todos os tiles viewlet destaque renderizadas
2 changes: 1 addition & 1 deletion src/brasil/gov/portal/tests/test_upgrades.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def test_profile_version(self):

def test_registered_steps(self):
steps = len(self.setup.listUpgrades(self.profile_id)[0])
self.assertEqual(steps, 3)
self.assertEqual(steps, 4)

def test_css_upload_before_css_portlet_calendar(self):
title = u'Altera ordem de arquivos css'
Expand Down
7 changes: 6 additions & 1 deletion src/brasil/gov/portal/upgrades/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,10 @@ def upgrade_profile(setup, profile_id):


def csscookresources(portal_setup=None):

api.portal.get_tool('portal_css').cookResources()
logger.info('Css resources were cooked')


def jscookresources(context):
api.portal.get_tool('portal_javascripts').cookResources()
logger.info('Javascript resources were cooked')
8 changes: 7 additions & 1 deletion src/brasil/gov/portal/upgrades/v10804/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,17 @@
/>

<genericsetup:upgradeStep
title="Cook Resources"
title="Cook Css Resources"
description="Atualiza estilos da configuração do brasil.gov.portal."
handler="brasil.gov.portal.upgrades.csscookresources"
/>

<genericsetup:upgradeStep
title="Cook Js Resources"
description="Atualiza javascripts da configuração do brasil.gov.portal."
handler="brasil.gov.portal.upgrades.jscookresources"
/>

</genericsetup:upgradeSteps>

</configure>