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
Original file line number Diff line number Diff line change
@@ -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: {
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
11 changes: 6 additions & 5 deletions cypress/e2e/openmage/backend/system/config/catalog/sitemap.cy.js
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -8,33 +9,33 @@ 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);
validation.removeClasses(fields);

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);
});
});
Empty file.
1 change: 1 addition & 0 deletions cypress/support/e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import './openmage/backend/system/cache'
import './openmage/backend/system/config/catalog/configswatches'
import './openmage/backend/system/config/catalog/sitemap'
import './openmage/backend/system/config/customer/promo'
import './openmage/backend/system/config/general/general'
import './openmage/backend/system/currency'
import './openmage/backend/system/design'
import './openmage/backend/system/email'
Expand Down
7 changes: 7 additions & 0 deletions cypress/support/openmage/_utils/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ cy.openmage.admin = {
cy.get(section._).click({force: true});
cy.url().should('include', section.url);
},
goToConfigScope: (section, value) => {
cy.log('Go to store switcher config scope');
cy.log(`Clicking on "${value}" menu`);
const selector = 'select#store_switcher';
cy.get(selector).select(value); // acts like clicking
cy.url().should('include', section.url);
},
}

cy.openmage.admin.username = {
Expand Down
107 changes: 95 additions & 12 deletions cypress/support/openmage/_utils/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,33 @@ 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 = {
_button: 'div.content-header .form-buttons button',
_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 = {
Expand All @@ -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"]',
Expand All @@ -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"]',
Expand All @@ -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"]',
Expand All @@ -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"]',
Expand All @@ -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"]',
Expand All @@ -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"]',
Expand All @@ -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"]',
Expand All @@ -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"]',
Expand All @@ -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"]',
Expand All @@ -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"]',
Expand Down Expand Up @@ -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 {{}}
Expand Down Expand Up @@ -285,8 +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 = {};
Expand Down
11 changes: 7 additions & 4 deletions cypress/support/openmage/_utils/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@ cy.openmage.validation = {
cy.log('Filling fields with invalid values');
Object.keys(path.__fields).forEach(field => {
const selector = path.__fields[field]._;
cy
.get(selector)
.clear({ force: true })
.should('have.class', validation.css);

if (validation.css !== undefined) {
cy
.get(selector)
.clear({ force: true })
.should('have.class', validation.css);
}

if (value !== '') {
cy
Expand Down
56 changes: 37 additions & 19 deletions cypress/support/openmage/backend/system/config/catalog/sitemap.js
Original file line number Diff line number Diff line change
@@ -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}}
Expand All @@ -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,
}
}
Loading
Loading