-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into reapply-withkeyring-refactor
- Loading branch information
Showing
38 changed files
with
391 additions
and
327 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { strict as assert } from 'assert'; | ||
import { Driver } from '../webdriver/driver'; | ||
import { MockedEndpoint } from '../mock-e2e'; | ||
|
||
const TIMEOUT_DEFAULT = 10 * 1000; // 10 Seconds | ||
|
||
export async function expectMockRequest( | ||
driver: Driver, | ||
mockedEndpoint: MockedEndpoint, | ||
{ timeout }: { timeout?: number } = {}, | ||
) { | ||
await driver.wait(async () => { | ||
const isPending = await mockedEndpoint.isPending(); | ||
return isPending === false; | ||
}, timeout ?? TIMEOUT_DEFAULT); | ||
} | ||
|
||
export async function expectNoMockRequest( | ||
driver: Driver, | ||
mockedEndpoint: MockedEndpoint, | ||
{ timeout }: { timeout?: number } = {}, | ||
) { | ||
await driver.delay(timeout ?? TIMEOUT_DEFAULT); | ||
|
||
const isPending = await mockedEndpoint.isPending(); | ||
|
||
assert.ok(isPending, 'Expected no requests'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { MockttpServer } from 'mockttp'; | ||
import FixtureBuilder from '../../fixture-builder'; | ||
import { | ||
defaultGanacheOptions, | ||
unlockWallet, | ||
withFixtures, | ||
} from '../../helpers'; | ||
import { | ||
expectMockRequest, | ||
expectNoMockRequest, | ||
} from '../../helpers/mock-server'; | ||
|
||
async function mockSentrySession(mockServer: MockttpServer) { | ||
return [ | ||
await mockServer | ||
.forPost(/sentry/u) | ||
.withBodyIncluding('"type":"session"') | ||
.withBodyIncluding('"status":"exited"') | ||
.thenCallback(() => { | ||
return { | ||
statusCode: 200, | ||
json: {}, | ||
}; | ||
}), | ||
]; | ||
} | ||
|
||
describe('Sessions', function () { | ||
it('sends session in UI if metrics enabled', async function () { | ||
await withFixtures( | ||
{ | ||
fixtures: new FixtureBuilder() | ||
.withMetaMetricsController({ | ||
participateInMetaMetrics: true, | ||
}) | ||
.build(), | ||
ganacheOptions: defaultGanacheOptions, | ||
title: this.test?.fullTitle(), | ||
testSpecificMock: mockSentrySession, | ||
manifestFlags: { | ||
doNotForceSentryForThisTest: true, | ||
}, | ||
}, | ||
async ({ driver, mockedEndpoint }) => { | ||
await unlockWallet(driver); | ||
await expectMockRequest(driver, mockedEndpoint[0], { timeout: 3000 }); | ||
}, | ||
); | ||
}); | ||
|
||
it('does not send session in UI if metrics disabled @no-mmi', async function () { | ||
await withFixtures( | ||
{ | ||
fixtures: new FixtureBuilder() | ||
.withMetaMetricsController({ | ||
participateInMetaMetrics: false, | ||
}) | ||
.build(), | ||
ganacheOptions: defaultGanacheOptions, | ||
title: this.test?.fullTitle(), | ||
testSpecificMock: mockSentrySession, | ||
manifestFlags: { | ||
doNotForceSentryForThisTest: true, | ||
}, | ||
}, | ||
async ({ driver, mockedEndpoint }) => { | ||
await unlockWallet(driver); | ||
await expectNoMockRequest(driver, mockedEndpoint[0], { timeout: 3000 }); | ||
}, | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.