Skip to content
Draft
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
27 changes: 22 additions & 5 deletions .ddev/commands/web/openmage-install
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
## ProjectTypes: magento
## Description: Install OpenMage
## Usage: openmage-install [-d|--default] [-s|--sampledata] [-k|--keep] [-q|--quiet]
## Example: ddev openmage-install -d -s -k
## Flags: [{"Name":"default","Shorthand":"d","Usage":"use default values"},{"Name":"sampledata","Shorthand":"s","Usage":"install sample data"},{"Name":"keep","Shorthand":"k","Usage":"keep sample data package"},{"Name":"quiet","Shorthand":"q","Usage":"silent install with sample data"}]
## Example: ddev openmage-install -d -s -k -x
## Flags: [{"Name":"default","Shorthand":"d","Usage":"use default values"},{"Name":"sampledata","Shorthand":"s","Usage":"install sample data"},{"Name":"keep","Shorthand":"k","Usage":"keep sample data package"},{"Name":"quiet","Shorthand":"q","Usage":"silent install with sample data"},{"Name":"extra","Shorthand":"x","Usage":"install with updated sample data (ddev)"}]

ROOT="${PWD}"

Expand All @@ -26,6 +26,8 @@ while :; do
USE_DEFAULT_FLAG='true'
SAMPLE_DATA_FLAG='true'
;;
-x|--extra)
SAMPLE_DATA_EXTRA_FLAG='true' ;;
--) # End of all options.
shift
break
Expand Down Expand Up @@ -69,10 +71,14 @@ else
fi

if [[ $INSTALL_SAMPLE_DATA =~ ^(yes|y) ]]; then
SAMPLE_DATA_URL=https://github.com/Vinai/compressed-magento-sample-data/raw/master/compressed-magento-sample-data-1.9.2.4.tgz
SAMPLE_DATA_DIRECTORY="${ROOT}/.ddev/.sampleData"

SAMPLE_DATA_URL=https://github.com/Vinai/compressed-magento-sample-data/raw/master/compressed-magento-sample-data-1.9.2.4.tgz
SAMPLE_DATA_FILE=sample_data.tgz

SAMPLE_DATA_OM_URL=https://github.com/sreichel/openmage-sample-data/blob/main/src/sample-data.sql?raw=true
SAMPLE_DATA_OM_FILE=sample_data_om.sql

if [[ ! -d "${SAMPLE_DATA_DIRECTORY}" ]]; then
echo "Creating Sample Data directory..."
mkdir -p "${SAMPLE_DATA_DIRECTORY}"
Expand All @@ -84,6 +90,13 @@ if [[ $INSTALL_SAMPLE_DATA =~ ^(yes|y) ]]; then
wget "${SAMPLE_DATA_URL}" -O "${SAMPLE_DATA_FILE}"
fi

if [[ "${SAMPLE_DATA_EXTRA_FLAG}" ]]; then
if [[ ! -f "${SAMPLE_DATA_DIRECTORY}/${SAMPLE_DATA_OM_FILE}" ]]; then
echo "Downloading extra Sample Data..."
wget "${SAMPLE_DATA_OM_URL}" -O "${SAMPLE_DATA_OM_FILE}"
fi
fi

echo "Uncompressing Sample Data..."
tar xf "${SAMPLE_DATA_FILE}"

Expand All @@ -96,14 +109,18 @@ if [[ $INSTALL_SAMPLE_DATA =~ ^(yes|y) ]]; then
rm -rf "${ROOT}"/"${DDEV_DOCROOT}/var/cache/"*

echo "Importing Sample Data into the database..."
mysql -u db -pdb -h db db < "${SAMPLE_DATA_DIRECTORY}"/magento-sample-data-1.9.2.4/magento_sample_data_for_1.9.2.4.sql
if [[ "${SAMPLE_DATA_EXTRA_FLAG}" ]]; then
mysql -u db -pdb -h db db < "${SAMPLE_DATA_DIRECTORY}/${SAMPLE_DATA_OM_FILE}"
else
mysql -u db -pdb -h db db < "${SAMPLE_DATA_DIRECTORY}"/magento-sample-data-1.9.2.4/magento_sample_data_for_1.9.2.4.sql
fi

# remove sample data
if [[ "${SAMPLE_DATA_KEEP_FLAG}" ]]; then
# shellcheck disable=SC2046
cd "${ROOT}" || exit
echo "Removing uncompressed files..."
rm -rf magento-sample-data-1.9.2.4/
rm -rf "${SAMPLE_DATA_DIRECTORY}"/magento-sample-data-1.9.2.4/
else
cd "${ROOT}" || exit
echo "Removing sample data..."
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- run: ddev composer install

# install openmage
- run: ddev openmage-install -q
- run: ddev openmage-install -q -x

# install cypress-addon
- run: ddev add-on get tyler36/ddev-cypress
Expand Down
39 changes: 39 additions & 0 deletions cypress/e2e/openmage/backend/cms/page.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const route = cy.testRoutes.backend.cms.page;
const validation = cy.openmage.validation;

describe(`Checks admin system "${route.h3}"`, () => {
beforeEach('Log in the user', () => {
Expand All @@ -9,4 +10,42 @@ describe(`Checks admin system "${route.h3}"`, () => {
it(`tests classes and title`, () => {
cy.adminTestRoute(route);
});

it('tests to disable a CMS page that is used in config', () => {
cy.log('Select a CMS page');
cy.get(route._gridTable)
.contains('td', 'no-route')
.click();

cy.log('Disable the CMS page');
cy.get('#page_is_active')
.select('Disabled');

validation.saveAction(route._buttonSaveAndContinue);
cy.get(validation._warningMessage).should('include.text', 'Cannot disable page, it is used in configuration');
cy.get(validation._successMessage).should('include.text', 'The page has been saved.');
});

it('tests to un-asign a CMS page that is used in config', () => {
cy.log('Select a CMS page');
cy.get(route._gridTable)
.contains('td', 'no-route')
.click();

cy.log('Asign another store to the CMS page');
cy.get('#page_store_id')
.select(4);

validation.saveAction(route._buttonSaveAndContinue);
// @todo: fix needed - this test passes because of a Magento bug
cy.get(validation._successMessage).should('include.text', 'The page has been saved.');

cy.log('Restore the default store to the CMS page');
cy.get('#page_store_id')
.select([1, 2, 3]);

validation.saveAction(route._buttonSaveAndContinue);
cy.get(validation._successMessage).should('include.text', 'The page has been saved.');

});
});
4 changes: 4 additions & 0 deletions cypress/support/openmage/config/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ cy.testRoutes = {
url: 'cms_page/index',
h3: 'Manage Pages',
_h3: adminPage._h3,
_gridTable: '#cmsPageGrid_table',
_buttonReset: '.form-buttons button[title="Rest"]',
_buttonSave: '.form-buttons button[title="Save Page"]',
_buttonSaveAndContinue: '.form-buttons button[title="Save and Continue Edit"]',
},
widget: {
_id_parent: adminNav.cms,
Expand Down
Loading