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
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 @@ -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);
});
});
30 changes: 15 additions & 15 deletions cypress/e2e/openmage/backend/system/config/general/general.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
6 changes: 3 additions & 3 deletions cypress/support/openmage/_utils/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ cy.openmage.admin = {
cy.log('Checking for successful login');
cy.url().should('include', cy.openmage.test.backend.dashbord.config.index.url);
},
goToPage: (test, path) =>{
goToPage: (test, section) =>{
cy.log('Go to admin page');
cy.get('body').then($body => {
const popup = '#message-popup-window .message-popup-head a';
Expand All @@ -31,7 +31,7 @@ cy.openmage.admin = {
}
});

cy.log(`Clicking on "${path.title}" menu`);
cy.log(`Clicking on "${section.title}" menu`);
cy.get(test._).click({force: true});
cy.url().should('include', test.url);
},
Expand All @@ -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';
Expand Down
103 changes: 91 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
9 changes: 3 additions & 6 deletions cypress/support/openmage/_utils/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ cy.openmage.validation = {
}
});
},
removeClasses: (path, log = 'Removing validation classes from fields') =>{
cy.log(log);
removeClasses: (path) =>{
cy.log('Removing validation classes from fields');
Object.keys(path.__fields).forEach(field => {
const selector = path.__fields[field]._;
cy
Expand All @@ -47,30 +47,27 @@ cy.openmage.validation = {
},
removeClassesFromInput: () =>{
cy.log('Removing validation classes from all input fields');

const input = '.form-list .value input';
cy.get(input).invoke('removeClass');
},
removeClassesFromSelect: () =>{
cy.log('Removing validation classes from all select fields');

const select = '.form-list .value select';
cy.get(select).invoke('removeClass');
},
removeClassesFromTextarea: () =>{
cy.log('Removing validation classes from all fields');

const textarea = '.form-list .value textarea';
cy.get(textarea).invoke('removeClass');
},
removeClassesAll: () =>{
cy.log('Removing validation classes from all fields');

cy.openmage.validation.removeClassesFromInput();
cy.openmage.validation.removeClassesFromSelect();
cy.openmage.validation.removeClassesFromTextarea();
},
pageElements: (config, path) => {
cy.log('Verifying page elements');
cy.openmage.check.buttons(config, path);
cy.openmage.check.fields(config, path);
cy.openmage.check.grid(config, path);
Expand Down
Loading
Loading