1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 09:57:02 +01:00

E2e settings search msgs (#14386)

* Improve error messages with template literals

* Lint fix

* Changed variable let for const and scope
This commit is contained in:
seaona 2022-04-13 17:26:26 +02:00 committed by GitHub
parent e768119dd0
commit dc3f14ffbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,11 +39,12 @@ describe('Settings Search', function () {
await driver.clickElement({ text: 'Settings', tag: 'div' });
await driver.fill('#search-settings', settingsSearch.general);
await driver.clickElement({ text: 'General', tag: 'span' });
const page = 'General';
await driver.clickElement({ text: page, tag: 'span' });
assert.equal(
await driver.isElementPresent({ text: 'General', tag: 'div' }),
await driver.isElementPresent({ text: page, tag: 'div' }),
true,
'Item does not redirect to correct page',
`${settingsSearch.general} item does not redirect to ${page} view`,
);
},
);
@ -66,11 +67,12 @@ describe('Settings Search', function () {
await driver.fill('#search-settings', settingsSearch.advanced);
// Check if element redirects to the correct page
await driver.clickElement({ text: 'Advanced', tag: 'span' });
const page = 'Advanced';
await driver.clickElement({ text: page, tag: 'span' });
assert.equal(
await driver.isElementPresent({ text: 'Advanced', tag: 'div' }),
await driver.isElementPresent({ text: page, tag: 'div' }),
true,
'Item does not redirect to correct page',
`${settingsSearch.advanced} item does not redirect to ${page} view`,
);
},
);
@ -93,11 +95,12 @@ describe('Settings Search', function () {
await driver.fill('#search-settings', settingsSearch.contacts);
// Check if element redirects to the correct page
await driver.clickElement({ text: 'Contacts', tag: 'span' });
const page = 'Contacts';
await driver.clickElement({ text: page, tag: 'span' });
assert.equal(
await driver.isElementPresent({ text: 'Contacts', tag: 'div' }),
await driver.isElementPresent({ text: page, tag: 'div' }),
true,
'Item does not redirect to correct page',
`${settingsSearch.contacts} item does not redirect to ${page} view`,
);
},
);
@ -120,11 +123,12 @@ describe('Settings Search', function () {
await driver.fill('#search-settings', settingsSearch.security);
// Check if element redirects to the correct page
await driver.clickElement({ text: 'Security', tag: 'span' });
const page = 'Security';
await driver.clickElement({ text: page, tag: 'span' });
assert.equal(
await driver.isElementPresent({ text: 'Security', tag: 'div' }),
await driver.isElementPresent({ text: page, tag: 'div' }),
true,
'Item does not redirect to correct page',
`${settingsSearch.security} item does not redirect to ${page} view`,
);
},
);
@ -147,11 +151,12 @@ describe('Settings Search', function () {
await driver.fill('#search-settings', settingsSearch.alerts);
// Check if element redirects to the correct page
await driver.clickElement({ text: 'Alerts', tag: 'span' });
const page = 'Alerts';
await driver.clickElement({ text: page, tag: 'span' });
assert.equal(
await driver.isElementPresent({ text: 'Alerts', tag: 'div' }),
await driver.isElementPresent({ text: page, tag: 'div' }),
true,
'Item does not redirect to correct page',
`${settingsSearch.alerts} item does not redirect to ${page} view`,
);
},
);
@ -174,11 +179,12 @@ describe('Settings Search', function () {
await driver.fill('#search-settings', settingsSearch.networks);
// Check if element redirects to the correct page
await driver.clickElement({ text: 'Networks', tag: 'span' });
const page = 'Networks';
await driver.clickElement({ text: page, tag: 'span' });
assert.equal(
await driver.isElementPresent({ text: 'Networks', tag: 'div' }),
await driver.isElementPresent({ text: page, tag: 'div' }),
true,
'Item does not redirect to correct page',
`${settingsSearch.networks} item does not redirect to ${page} view`,
);
},
);
@ -201,11 +207,12 @@ describe('Settings Search', function () {
await driver.fill('#search-settings', settingsSearch.experimental);
// Check if element redirects to the correct page
await driver.clickElement({ text: 'Experimental', tag: 'span' });
const page = 'Experimental';
await driver.clickElement({ text: page, tag: 'span' });
assert.equal(
await driver.isElementPresent({ text: 'Experimental', tag: 'div' }),
await driver.isElementPresent({ text: page, tag: 'div' }),
true,
'Item does not redirect to correct page',
`${settingsSearch.experimental} item not redirect to ${page} view`,
);
},
);
@ -228,11 +235,12 @@ describe('Settings Search', function () {
await driver.fill('#search-settings', settingsSearch.about);
// Check if element redirects to the correct page
await driver.clickElement({ text: 'About', tag: 'span' });
const page = 'About';
await driver.clickElement({ text: page, tag: 'span' });
assert.equal(
await driver.isElementPresent({ text: 'About', tag: 'div' }),
await driver.isElementPresent({ text: page, tag: 'div' }),
true,
'Item does not redirect to correct page',
`${settingsSearch.about} item does not redirect to ${page} view`,
);
},
);