diff --git a/cypress/e2e/openmage/backend/system/config/catalog/configswatches.cy.js b/cypress/e2e/openmage/backend/system/config/catalog/configswatches.cy.js index 735f4bc87fc..9600afb632b 100644 --- a/cypress/e2e/openmage/backend/system/config/catalog/configswatches.cy.js +++ b/cypress/e2e/openmage/backend/system/config/catalog/configswatches.cy.js @@ -1,3 +1,4 @@ +const config = cy.openmage.test.backend.system.config; const test = cy.openmage.test.backend.system.config.catalog.configswatches.config; const validate = { dimension: { @@ -44,7 +45,7 @@ describe(`Checks admin system "${test.section.title}" settings`, () => { .should('have.value', value); }); - cy.adminSaveConfiguration(); + config.clickSave(); cy.log('Checking for error messages'); const error = cy.openmage.validation.digits.error; @@ -71,7 +72,7 @@ describe(`Checks admin system "${test.section.title}" settings`, () => { .should('have.value', ''); }); - cy.adminSaveConfiguration(); + config.clickSave(); cy.log('Checking for error messages'); const error = cy.openmage.validation.requiredEntry.error; diff --git a/cypress/e2e/openmage/backend/system/config/catalog/sitemap.cy.js b/cypress/e2e/openmage/backend/system/config/catalog/sitemap.cy.js index 1a000996ba1..d63269bd471 100644 --- a/cypress/e2e/openmage/backend/system/config/catalog/sitemap.cy.js +++ b/cypress/e2e/openmage/backend/system/config/catalog/sitemap.cy.js @@ -1,3 +1,4 @@ +const config = cy.openmage.test.backend.system.config; const test = cy.openmage.test.backend.system.config.catalog.sitemap.config; const validation = cy.openmage.validation; @@ -8,7 +9,7 @@ describe(`Checks admin system "${test.section.title}" settings`, () => { cy.openmage.admin.goToSection(test.section); }); - const fields = test.section.priority; + const fields = test.section.__groupPriority; it(`tests save empty values, no js`, () => { validation.fillFields(fields, validation.requiredEntry); @@ -16,25 +17,25 @@ describe(`Checks admin system "${test.section.title}" settings`, () => { const message = 'An error occurred while saving this configuration: The priority must be between 0 and 1.'; const screenshot = 'message.sytem.config.catalog.sitemap.saveEmptyWithoutJs'; - cy.openmage.test.backend.system.config.clickSave(); + config.clickSave(); validation.hasErrorMessage(message, { screenshot: true, filename: screenshot }); }); it(`tests invalid string priority`, () => { validation.fillFields(fields, validation.number, validation.test.string); - cy.openmage.test.backend.system.config.clickSave(); + config.clickSave(); validation.validateFields(fields, validation.number); }); it(`tests invalid number priority`, () => { validation.fillFields(fields, validation.numberRange, validation.test.numberGreater1); - cy.openmage.test.backend.system.config.clickSave(); + config.clickSave(); validation.validateFields(fields, validation.numberRange); }); it(`tests empty priority`, () => { validation.fillFields(fields, validation.requiredEntry); - cy.openmage.test.backend.system.config.clickSave(); + config.clickSave(); validation.validateFields(fields, validation.requiredEntry); }); }); \ No newline at end of file diff --git a/cypress/e2e/openmage/backend/system/config/general/general.cy.js b/cypress/e2e/openmage/backend/system/config/general/general.cy.js index b04a627cb8b..c79abc5ac23 100644 --- a/cypress/e2e/openmage/backend/system/config/general/general.cy.js +++ b/cypress/e2e/openmage/backend/system/config/general/general.cy.js @@ -15,56 +15,56 @@ describe(`Checks admin system "${test.section.title}" settings`, () => { it(`tests ENV override`, () => { // test overrides in default config scope cy.get(fields.name._).should('have.value', 'ENV name default'); - cy.get(fields.name.label).should('have.text', labelEnv); + cy.get(fields.name._label).should('have.text', labelEnv); cy.get(fields.phone._).should('have.value', ''); - cy.get(fields.phone.label).should('have.text', labelStoreView); + cy.get(fields.phone._label).should('have.text', labelStoreView); cy.get(fields.address._).should('have.value', ''); - cy.get(fields.address.label).should('have.text', labelStoreView); + cy.get(fields.address._label).should('have.text', labelStoreView); // test overrides in website scope cy.openmage.admin.goToConfigScope(test.section, 'website_base'); cy.get(fields.name._).should('have.value', 'ENV name default'); - cy.get(fields.name.label).should('have.text', labelEnv); + cy.get(fields.name._label).should('have.text', labelEnv); cy.get(fields.phone._).should('have.value', 'ENV phone website'); - cy.get(fields.phone.label).should('have.text', labelEnv); + cy.get(fields.phone._label).should('have.text', labelEnv); cy.get(fields.address._).should('have.value', ''); - cy.get(fields.address.label).should('have.text', labelStoreView); + cy.get(fields.address._label).should('have.text', labelStoreView); // test overrides in English/default store view cy.openmage.admin.goToConfigScope(test.section, 'store_default'); cy.get(fields.name._).should('have.value', 'ENV name default'); - cy.get(fields.name.label).should('have.text', labelEnv); + cy.get(fields.name._label).should('have.text', labelEnv); cy.get(fields.phone._).should('have.value', 'ENV phone website'); - cy.get(fields.phone.label).should('have.text', labelEnv); + cy.get(fields.phone._label).should('have.text', labelEnv); cy.get(fields.address._).should('have.value', ''); - cy.get(fields.address.label).should('have.text', labelStoreView); + cy.get(fields.address._label).should('have.text', labelStoreView); // test overrides in French store view cy.openmage.admin.goToConfigScope(test.section, 'store_french'); cy.get(fields.name._).should('have.value', 'ENV name default'); - cy.get(fields.name.label).should('have.text', labelEnv); + cy.get(fields.name._label).should('have.text', labelEnv); cy.get(fields.phone._).should('have.value', 'ENV phone website'); - cy.get(fields.phone.label).should('have.text', labelEnv); + cy.get(fields.phone._label).should('have.text', labelEnv); cy.get(fields.address._).should('have.value', ''); - cy.get(fields.address.label).should('have.text', labelStoreView); + cy.get(fields.address._label).should('have.text', labelStoreView); // test overrides in German store view cy.openmage.admin.goToConfigScope(test.section, 'store_german'); cy.get(fields.name._).should('have.value', 'ENV name default'); - cy.get(fields.name.label).should('have.text', labelEnv); + cy.get(fields.name._label).should('have.text', labelEnv); cy.get(fields.phone._).should('have.value', 'ENV phone website'); - cy.get(fields.phone.label).should('have.text', labelEnv); + cy.get(fields.phone._label).should('have.text', labelEnv); cy.get(fields.address._).should('have.value', 'ENV address store'); - cy.get(fields.address.label).should('have.text', labelEnv); + cy.get(fields.address._label).should('have.text', labelEnv); }); }); \ No newline at end of file diff --git a/cypress/support/openmage/_utils/admin.js b/cypress/support/openmage/_utils/admin.js index d3f31832fe2..57c277408c1 100644 --- a/cypress/support/openmage/_utils/admin.js +++ b/cypress/support/openmage/_utils/admin.js @@ -41,7 +41,7 @@ cy.openmage.admin = { cy.get(section._).click({force: true}); cy.url().should('include', section.url); }, - goToConfigScope: (section, value) =>{ + goToConfigScope: (section, value) => { cy.log('Go to store switcher config scope'); cy.log(`Clicking on "${value}" menu`); const selector = 'select#store_switcher'; diff --git a/cypress/support/openmage/_utils/test.js b/cypress/support/openmage/_utils/test.js index 597889f4d18..17864f8ff3e 100644 --- a/cypress/support/openmage/_utils/test.js +++ b/cypress/support/openmage/_utils/test.js @@ -6,7 +6,13 @@ cy.openmage.test.backend = {}; /** * Base configuration for backend tests - * @type {{_button: string, _title: string, __buttons: {}, __buttonsSets: {}}} + * @type {{ + * _button: string, + * _title: string, + * __buttons: {}, + * __buttonsSets: {}, + * __systemConfig: {} + * }} * @private */ cy.openmage.test.backend.__base = { @@ -14,11 +20,19 @@ cy.openmage.test.backend.__base = { _title: 'h3.icon-head', __buttons: {}, __buttonsSets: {}, + __systemConfig: {}, }; /** * Base buttons configuration for backend tests - * @type {{add: {}, save: {}, saveAndContinue: {}, delete: {}, back: {}, reset: {}}} + * @type {{ + * add: {}, + * save: {}, + * saveAndContinue: {}, + * delete: {}, + * back: {}, + * reset: {} + * }} * @private */ cy.openmage.test.backend.__base.__buttons = { @@ -40,7 +54,11 @@ cy.openmage.test.backend.__base.__buttons.add = { /** * Configuration for "Save" button - * @type {{_: string, __class: string[], click: cy.openmage.test.backend.__base.__buttons.save.click}} + * @type {{ + * _: string, + * __class: string[], + * click: cy.openmage.test.backend.__base.__buttons.save.click + * }} */ cy.openmage.test.backend.__base.__buttons.save = { _: cy.openmage.test.backend.__base._button + '[title="Save"]', @@ -52,7 +70,11 @@ cy.openmage.test.backend.__base.__buttons.save = { /** * Configuration for "Save and Continue Edit" button - * @type {{_: string, __class: string[], click: cy.openmage.test.backend.__base.__buttons.saveAndContinue.click}} + * @type {{ + * _: string, + * __class: string[], + * click: cy.openmage.test.backend.__base.__buttons.saveAndContinue.click + * }} */ cy.openmage.test.backend.__base.__buttons.saveAndContinue = { _: cy.openmage.test.backend.__base._button + '[title="Save and Continue Edit"]', @@ -64,7 +86,11 @@ cy.openmage.test.backend.__base.__buttons.saveAndContinue = { /** * Configuration for "Delete" button - * @type {{_: string, __class: string[], click: cy.openmage.test.backend.__base.__buttons.delete.click}} + * @type {{ + * _: string, + * __class: string[], + * click: cy.openmage.test.backend.__base.__buttons.delete.click + * }} */ cy.openmage.test.backend.__base.__buttons.delete = { _: cy.openmage.test.backend.__base._button + '[title="Delete"]', @@ -76,7 +102,11 @@ cy.openmage.test.backend.__base.__buttons.delete = { /** * Configuration for "Back" button - * @type {{_: string, __class: string[], click: cy.openmage.test.backend.__base.__buttons.back.click}} + * @type {{ + * _: string, + * __class: string[], + * click: cy.openmage.test.backend.__base.__buttons.back.click + * }} */ cy.openmage.test.backend.__base.__buttons.back = { _: cy.openmage.test.backend.__base._button + '[title="Back"]', @@ -88,7 +118,11 @@ cy.openmage.test.backend.__base.__buttons.back = { /** * Configuration for "Reset" button - * @type {{_: string, __class: string[], click: cy.openmage.test.backend.__base.__buttons.reset.click}} + * @type {{ + * _: string, + * __class: string[], + * click: cy.openmage.test.backend.__base.__buttons.reset.click + * }} */ cy.openmage.test.backend.__base.__buttons.reset = { _: cy.openmage.test.backend.__base._button + '[title="Reset"]', @@ -100,7 +134,11 @@ cy.openmage.test.backend.__base.__buttons.reset = { /** * Configuration for "Print" button - * @type {{__class: string[], click: cy.openmage.test.backend.__base.__buttons.print.click, _: string}} + * @type {{ + * _: string, + * __class: string[], + * click: cy.openmage.test.backend.__base.__buttons.print.click + * }} */ cy.openmage.test.backend.__base.__buttons.print = { _: cy.openmage.test.backend.__base._button + '[title="Print"]', @@ -112,7 +150,11 @@ cy.openmage.test.backend.__base.__buttons.print = { /** * Configuration for "Send Email" button - * @type {{__class: string[], click: cy.openmage.test.backend.__base.__buttons.email.click, _: string}} + * @type {{ + * _: string, + * __class: string[], + * click: cy.openmage.test.backend.__base.__buttons.email.click + * }} */ cy.openmage.test.backend.__base.__buttons.email = { _: cy.openmage.test.backend.__base._button + '[title="Send Email"]', @@ -124,7 +166,11 @@ cy.openmage.test.backend.__base.__buttons.email = { /** * Configuration for "Convert to Plain Text" button - * @type {{__class: string[], click: cy.openmage.test.backend.__base.__buttons.convertToPlain.click, _: string}} + * @type {{ + * _: string, + * __class: string[], + * click: cy.openmage.test.backend.__base.__buttons.convertToPlain.click + * }} */ cy.openmage.test.backend.__base.__buttons.convertToPlain = { _: cy.openmage.test.backend.__base._button + '[title="Convert to Plain Text"]', @@ -136,7 +182,11 @@ cy.openmage.test.backend.__base.__buttons.convertToPlain = { /** * Configuration for "Convert to Plain Text" button - * @type {{__class: string[], click: cy.openmage.test.backend.__base.__buttons.preview.click, _: string}} + * @type {{ + * _: string, + * __class: string[], + * click: cy.openmage.test.backend.__base.__buttons.preview.click + * }} */ cy.openmage.test.backend.__base.__buttons.preview = { _: cy.openmage.test.backend.__base._button + '[title="Preview Template"]', @@ -148,7 +198,11 @@ cy.openmage.test.backend.__base.__buttons.preview = { /** * Configuration for "Save and Apply" button - * @type {{__class: string[], click: cy.openmage.test.backend.__base.__buttons.saveAndApply.click, _: string}} + * @type {{ + * _: string, + * __class: string[], + * click: cy.openmage.test.backend.__base.__buttons.saveAndApply.click + * }} */ cy.openmage.test.backend.__base.__buttons.saveAndApply = { _: cy.openmage.test.backend.__base._button + '[title="Save and Apply"]', @@ -237,6 +291,31 @@ cy.openmage.test.backend.__base.__buttonsSets.sales = { back: cy.openmage.test.backend.__base.__buttons.back, }; +/** + * Configuration for admin system base "System Configuration" settings + * @type {{ + * _: string, + * _nav: string, + * _title: string, + * url: string, + * labels: {}, + * section: {} + * }} + */ +cy.openmage.test.backend.__base.__systemConfig = { + _: '#nav-admin-system-config', + _nav: '#nav-admin-system', + _title: cy.openmage.test.backend.__base._title, + url: 'system_config/index', + labels: {}, + section: {}, +}; + +cy.openmage.test.backend.__base.__systemConfig.labels = { + env: '[ENV]', + store: '[STORE VIEW]', +}; + /** * Namespace for backend tests * @type {{}} @@ -285,10 +364,12 @@ cy.openmage.test.backend.system.config = { cy.openmage.test.backend.system.config.catalog = {}; cy.openmage.test.backend.system.config.catalog.configswatches = {}; cy.openmage.test.backend.system.config.catalog.sitemap = {}; +cy.openmage.test.backend.system.config.catalog.sitemap.config = cy.openmage.test.backend.__base.__systemConfig; cy.openmage.test.backend.system.config.customer = {}; cy.openmage.test.backend.system.config.customer.promo = {}; cy.openmage.test.backend.system.config.general = {}; cy.openmage.test.backend.system.config.general.general = {}; +cy.openmage.test.backend.system.config.general.general.config = cy.openmage.test.backend.__base.__systemConfig; cy.openmage.test.backend.system.currency = {}; cy.openmage.test.backend.system.design = {}; cy.openmage.test.backend.system.email = {}; diff --git a/cypress/support/openmage/backend/system/config/catalog/sitemap.js b/cypress/support/openmage/backend/system/config/catalog/sitemap.js index 01975dae489..dcc56cf43e4 100644 --- a/cypress/support/openmage/backend/system/config/catalog/sitemap.js +++ b/cypress/support/openmage/backend/system/config/catalog/sitemap.js @@ -1,18 +1,5 @@ -const base = cy.openmage.test.backend.__base; const test = cy.openmage.test.backend.system.config.catalog.sitemap; -/** - * Configuration for admin system "Google Sitemap" settings - * @type {{_: string, _nav: string, _title: string, url: string, section: {}}} - */ -test.config = { - _: '#nav-admin-system-config', - _nav: '#nav-admin-system', - _title: base._title, - url: 'system_config/index', - section: {}, -} - /** * Section "Google Sitemap" * @type {{_: string, title: string, url: string}} @@ -24,19 +11,50 @@ test.config.section = { } /** - * Fields for "Priority" group - * @type {{__fields: {product: {_: string}, page: {_: string}, category: {_: string}}}} + * Category settings + * @type {{__fields: {priority: {_: string}}}} */ -test.config.section.priority = { +test.config.section.category = { __fields: { - category: { + priority: { _: '#sitemap_category_priority', }, - product: { + } +}; + +/** + * Product settings + * @type {{__fields: {priority: {_: string}}}} + */ +test.config.section.product = { + __fields: { + priority: { _: '#sitemap_product_priority', }, - page: { + } +}; + +/** + * Page settings + * @type {{__fields: {priority: {_: string}}}} + */ +test.config.section.page = { + __fields: { + priority: { _: '#sitemap_page_priority', }, } }; + +/** + * Group of priority fields + * @type {{__fields: {product: {_: string}, page: {_: string}, category: {_: string}}}} + * @private + */ +test.config.section.__groupPriority = { + __fields: { + category: test.config.section.category.__fields.priority, + page: test.config.section.page.__fields.priority, + product: test.config.section.product.__fields.priority, + } +} \ No newline at end of file diff --git a/cypress/support/openmage/backend/system/config/general/general.js b/cypress/support/openmage/backend/system/config/general/general.js index 68e2936a3f3..3c9e00ecb1e 100644 --- a/cypress/support/openmage/backend/system/config/general/general.js +++ b/cypress/support/openmage/backend/system/config/general/general.js @@ -1,50 +1,47 @@ -const base = cy.openmage.test.backend.__base; const test = cy.openmage.test.backend.system.config.general.general; -/** - * Configuration for admin system "General" settings - * @type {{_: string, _nav: string, _title: string, url: string, section: {}}} - */ -test.config = { - _: '#nav-admin-system-config', - _nav: '#nav-admin-system', - _title: base._title, - url: 'system_config/index', - section: {}, -} - /** * Section "General" - * @type {{_: string, title: string, url: string}} + * @type {{ + * _: string, + * title: string, + * url: string, + * storeInformation: {} + * }} */ test.config.section = { _: '#section-general', title: 'General', url: 'system_config/edit/section/general', + storeInformation: {}, } /** * Fields for "Store information" group - * @type {{__fields: {name: {_: string}, phone: {_: string}, hours: {_: string}, address: {_: string}}}} + * @type {{ + * _: string, + * __fields: {} */ test.config.section.storeInformation = { _: '#general_store_information-head', - __fields: { - name: { - _: '#general_store_information_name', - label: '#row_general_store_information_name .scope-label', - }, - phone: { - _: '#general_store_information_phone', - label: '#row_general_store_information_phone .scope-label', - }, - hours: { - _: '#general_store_information_hours', - label: '#row_general_store_information_hours .scope-label', - }, - address: { - _: '#general_store_information_address', - label: '#row_general_store_information_address .scope-label', - }, - } + __fields: {}, +} + +test.config.section.storeInformation.__fields = { + name: { + _: '#general_store_information_name', + _label: '#row_general_store_information_name .scope-label', + }, + phone: { + _: '#general_store_information_phone', + _label: '#row_general_store_information_phone .scope-label', + }, + hours: { + _: '#general_store_information_hours', + _label: '#row_general_store_information_hours .scope-label', + }, + address: { + _: '#general_store_information_address', + _label: '#row_general_store_information_address .scope-label', + }, };