Skip to content

Commit

Permalink
updated spec
Browse files Browse the repository at this point in the history
  • Loading branch information
NidhiKJha committed Oct 2, 2024
1 parent 631cca9 commit 8b33f63
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 4 deletions.
55 changes: 51 additions & 4 deletions test/e2e/tests/connections/connect.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const {
const FixtureBuilder = require('../../fixture-builder');

describe('Connections page', function () {
it('should disconnect when click on Disconnect button in connections page', async function () {
it('should show connections page', async function () {
await withFixtures(
{
dapp: true,
Expand All @@ -36,6 +36,10 @@ describe('Connections page', function () {
'[data-testid ="account-options-menu-button"]',
);
await driver.clickElement({ text: 'All Permissions', tag: 'div' });
await driver.clickElementAndWaitToDisappear({
text: 'Got it',
tag: 'button',
});
await driver.clickElement({
text: '127.0.0.1:8080',
tag: 'p',
Expand All @@ -50,13 +54,56 @@ describe('Connections page', function () {
tag: 'p',
});
assert.ok(connectionsPageNetworkInfo, 'Connections Page is defined');
},
);
});
it('should disconnect when click on Disconnect button in connections page', async function () {
await withFixtures(
{
dapp: true,
fixtures: new FixtureBuilder().build(),
title: this.test.fullTitle(),
ganacheOptions: defaultGanacheOptions,
},
async ({ driver, ganacheServer }) => {
await logInWithBalanceValidation(driver, ganacheServer);
await connectToDapp(driver);

// It should render connected status for button if dapp is connected
const getConnectedStatus = await driver.waitForSelector({
css: '#connectButton',
text: 'Connected',
});
assert.ok(getConnectedStatus, 'Account is connected to Dapp');

// Switch to extension Tab
await driver.switchToWindowWithTitle(
WINDOW_TITLES.ExtensionInFullScreenView,
);
await driver.clickElement(
'[data-testid ="account-list-item-menu-button"]',
'[data-testid ="account-options-menu-button"]',
);
await driver.clickElement({ text: 'All Permissions', tag: 'div' });
await driver.clickElementAndWaitToDisappear({
text: 'Got it',
tag: 'button',
});
await driver.clickElement({
text: '127.0.0.1:8080',
tag: 'p',
});
const connectionsPageAccountInfo = await driver.isElementPresent({
text: 'See your accounts and suggest transactions',
tag: 'p',
});
assert.ok(connectionsPageAccountInfo, 'Connections Page is defined');
const connectionsPageNetworkInfo = await driver.isElementPresent({
text: 'Use your enabled networks',
tag: 'p',
});
assert.ok(connectionsPageNetworkInfo, 'Connections Page is defined');
await driver.clickElement({ text: 'Disconnect', tag: 'button' });
await driver.clickElement('[data-testid ="disconnect-all"]');
await driver.clickElement('button[aria-label="Back"]');
await driver.clickElement({ text: 'All Permissions', tag: 'div' });
const noAccountConnected = await driver.isElementPresent({
text: 'MetaMask isn’t connected to this site',
tag: 'p',
Expand Down
4 changes: 4 additions & 0 deletions test/e2e/tests/metrics/dapp-viewed.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,10 @@ describe('Dapp viewed Event @no-mmi', function () {
text: '127.0.0.1:8080',
tag: 'p',
});
await driver.clickElement({
text: 'Disconnect',
tag: 'button',
});
await driver.clickElement('[data-testid ="disconnect-all"]');
// validate dapp is not connected
await driver.clickElement(
Expand Down

0 comments on commit 8b33f63

Please sign in to comment.