Skip to content

Commit

Permalink
Refactor test for full-size view setting
Browse files Browse the repository at this point in the history
  • Loading branch information
dan437 committed Jan 12, 2024
1 parent aad73e0 commit 0661b11
Showing 1 changed file with 4 additions and 56 deletions.
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
const { strict: assert } = require('assert');
const { Key, By, Actions } = require('selenium-webdriver');
const {
withFixtures,
unlockWallet,
openDapp,
defaultGanacheOptions,
getWindowHandles,
WINDOW_TITLES,
} = require('../helpers');
const FixtureBuilder = require('../fixture-builder');

const toggleFullSizeSetting = async (driver) => {
const toggleFullSizeViewSetting = async (driver) => {
await driver.clickElement('[data-testid="account-options-menu-button"]');

await driver.clickElement({ text: 'Settings', tag: 'div' });
await driver.clickElement({ text: 'Advanced', tag: 'div' });

await driver.clickElement(
'[data-testid="advanced-setting-show-extension-in-full-size-view"] .toggle-button > div',
);
};

describe('Full-size Settings @no-mmi', function () {
describe('Full-size View Setting @no-mmi', function () {
it('opens the extension in popup view when opened from a dapp after enabling it in Advanced Settings', async function () {
await withFixtures(
{
Expand All @@ -36,11 +32,9 @@ describe('Full-size Settings @no-mmi', function () {
},
async ({ driver }) => {
await unlockWallet(driver);
await toggleFullSizeSetting(driver);
await toggleFullSizeViewSetting(driver);
await openDapp(driver);

await driver.clickElement('#maliciousPermit');
// TODO
await driver.clickElement('#maliciousPermit'); // Opens the extension in popup view.
const windowHandles = await driver.waitUntilXWindowHandles(
3,
1000,
Expand All @@ -65,50 +59,4 @@ describe('Full-size Settings @no-mmi', function () {
},
);
});

it.only('opens the extension in full-size view after enabling it in Advanced Settings', async function () {
await withFixtures(
{
dapp: true,
fixtures: new FixtureBuilder()
.withNetworkControllerOnMainnet()
.withPermissionControllerConnectedToTestDapp()
.build(),
failOnConsoleError: false,
ganacheOptions: defaultGanacheOptions,
title: this.test.fullTitle(),
},
async ({ driver }) => {
await unlockWallet(driver);

await toggleFullSizeSetting(driver);

const actions = driver.retrieveDriverActions();
console.log(driver.Key, driver.Key.OPTION, driver.Key.M);
const el = await driver.findElement(By.tagName('html'));
console.log({ el });
await actions
.sendKeys(
Key.chord(driver.Key.SHIFT, driver.Key.OPTION, driver.Key.M),
)
.perform();
// await actions
// .keyDown(driver.Key.SHIFT)
// .keyDown(driver.Key.OPTION)
// .keyDown(driver.Key.M)
// .perform();
// .keyDown(driver.Key.OPTION)
// .keyDown(driver.Key.M)
// .perform();
// await driver.wait(40000000);
// await driver
// .actions()
// .keyDown(Key.SHIFT)
// .keyDown(Key.OPTION)
// .keyDown(Key.M)
// .perform();
await getWindowHandles(driver, 2);
},
);
});
});

0 comments on commit 0661b11

Please sign in to comment.