This repository has been archived by the owner on Sep 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add 'Install the browser extension' alert + animation #14399
Merged
Merged
Changes from 11 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
31a7564
establish communication between RepoContainer and UserNavItem, refact…
tjkandala 24d1d6c
simplify approach, implement animations
tjkandala 32e1a75
Merge branch 'tj/code-host-popup' into tj/install-alert
tjkandala 4f2930e
Merge branch 'tj/code-host-popup' into tj/install-alert
tjkandala d257f0c
implement user avatar animation
tjkandala e7c5166
display different alert for chrome users
tjkandala dc6df12
explain animation hook
tjkandala 7fa519e
add integration test for alert
tjkandala 5358b14
add snapshot test for alert
tjkandala efdcb94
update nav tests
tjkandala 6a585a7
add all code host and browser alerts to storybook
tjkandala f9bb4b3
improve snapshot tests for alert
tjkandala b6176ba
remove debug hooks
tjkandala dbc251c
remove unused imports
tjkandala File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -219,8 +219,11 @@ describe('Blob viewer', () => { | |
|
||
describe('browser extension discoverability', () => { | ||
const HOVER_THRESHOLD = 3 | ||
const HOVER_COUNT_KEY = 'hover-count' | ||
it(`shows a popover about the browser extension when the user has seen ${HOVER_THRESHOLD} hovers and clicks "View on [code host]" button`, async () => { | ||
await driver.page.goto(`${driver.sourcegraphBaseUrl}/github.com/sourcegraph/test/-/blob/test.ts`) | ||
await driver.page.evaluate(() => localStorage.removeItem('hover-count')) | ||
await driver.page.reload() | ||
|
||
await driver.page.waitForSelector('.test-go-to-code-host', { visible: true }) | ||
// Close new tab after clicking link | ||
|
@@ -259,9 +262,42 @@ describe('Blob viewer', () => { | |
) | ||
}) | ||
|
||
it.skip(`shows an alert about the browser extension when the user has seen ${HOVER_THRESHOLD} hovers`, async () => { | ||
it(`shows an alert about the browser extension when the user has seen ${HOVER_THRESHOLD} hovers`, async () => { | ||
await driver.page.goto(`${driver.sourcegraphBaseUrl}/github.com/sourcegraph/test/-/blob/test.ts`) | ||
// TODO | ||
await driver.page.evaluate(HOVER_COUNT_KEY => localStorage.removeItem(HOVER_COUNT_KEY), HOVER_COUNT_KEY) | ||
await driver.page.reload() | ||
Comment on lines
266
to
+268
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a better way to clear Fwiw, the test still passed every time I ran it without reloading after clearing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is all I can think of - would ensure 100% reproducability: beforeEach(async () => {
await driver.page.evaluate(() => localStorage.clear())
}) |
||
|
||
// Alert should not be visible before the user reaches the hover threshold | ||
assert( | ||
!(await driver.page.$('.install-browser-extension-alert')), | ||
'Expected "Install browser extension" alert to not be displayed before user reaches hover threshold' | ||
) | ||
|
||
// Click 'console' and 'log' $HOVER_THRESHOLD times combined | ||
await driver.page.waitForSelector('.test-log-token', { visible: true }) | ||
for (let index = 0; index < HOVER_THRESHOLD; index++) { | ||
await driver.page.click(index % 2 === 0 ? '.test-log-token' : '.test-console-token') | ||
await driver.page.waitForSelector('.hover-overlay', { visible: true }) | ||
} | ||
await driver.page.reload() | ||
|
||
await driver.page.waitForSelector('.repo-header') | ||
// Alert should be visible now that the user has seen $HOVER_THRESHOLD hovers | ||
assert( | ||
!!(await driver.page.$('.install-browser-extension-alert')), | ||
'Expected "Install browser extension" alert to be displayed after user reaches hover threshold' | ||
) | ||
|
||
// Dismiss alert | ||
await driver.page.click('.test-close-alert') | ||
await driver.page.reload() | ||
|
||
await driver.page.waitForSelector('.repo-header') | ||
// Alert should not show up now that the user has dismissed it once | ||
assert( | ||
!(await driver.page.$('.install-browser-extension-alert')), | ||
'Expected "Install browser extension" alert to not be displayed before user dismisses it once' | ||
) | ||
}) | ||
}) | ||
}) | ||
|
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
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will remove after design review