Skip to content

Commit

Permalink
Fix e2es
Browse files Browse the repository at this point in the history
  • Loading branch information
darkwing committed Sep 20, 2023
1 parent 135ea69 commit 8fb0471
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
9 changes: 6 additions & 3 deletions app/scripts/lib/ens-ipfs/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ export default function setupEnsIpfsResolver({

const ensSiteUrl = `https://app.ens.domains/name/${name}`;

// This is the only case where we can show the loading indicator
// https://github.com/MetaMask/metamask-extension/issues/20910#issuecomment-1723962822
// We cannot show this if useAddressBarEnsResolution is off...
if (useAddressBarEnsResolution && ipfsGateway) {
browser.tabs.update(tabId, { url: 'loading.html' });
}
Expand All @@ -71,7 +70,9 @@ export default function setupEnsIpfsResolver({
// If we're testing ENS domain resolution support,
// we assume the ENS domains URL
if (process.env.IN_TEST) {
browser.tabs.update(tabId, { url });
if (useAddressBarEnsResolution || ipfsGateway) {
browser.tabs.update(tabId, { url });
}
return;
}

Expand Down Expand Up @@ -129,6 +130,8 @@ export default function setupEnsIpfsResolver({
} catch (err) {
console.warn(err);
} finally {
// Only forward to destination URL if a URL exists and
// useAddressBarEnsResolution is properly
if (
url &&
(useAddressBarEnsResolution ||
Expand Down
7 changes: 5 additions & 2 deletions test/e2e/tests/ipfs-ens-resolution.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('Settings', function () {
await driver.quit();
});

it('Does not lookup IPFS data for ENS Domain when switched off', async function () {
it('Does not fetch ENS data for ENS Domain when ENS and IPFS switched off', async function () {
let server;

await withFixtures(
Expand All @@ -54,7 +54,10 @@ describe('Settings', function () {
await driver.clickElement({ text: 'Settings', tag: 'div' });
await driver.clickElement({ text: 'Security & privacy', tag: 'div' });

// turns off IPFS domain resolution
// turns off IPFS setting
await driver.clickElement('[data-testid="ipfsToggle"] .toggle-button');

// turns off ENS domain resolution
await driver.clickElement(
'[data-testid="ipfs-gateway-resolution-container"] .toggle-button',
);
Expand Down

0 comments on commit 8fb0471

Please sign in to comment.