-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add release notes modal (#9006)
- Loading branch information
1 parent
09617b2
commit 757ddc8
Showing
23 changed files
with
708 additions
and
227 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,8 @@ | ||
{ | ||
"title": "Check Out This Release 😀", | ||
"version": "1.2.3", | ||
"bannerImage": "cypress-banner.jpg", | ||
"content": "<h1>This is a great release</h1><h2>dolor sit amet 😀 4️⃣ 👽 👍 🌎</h2><h3>consectetur adipiscing elit</h3><h4>sed do eiusmod </h4><h5>tempor incididunt</h5><h6>ut labore et</h6><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod \ntempor incididunt ut labore et dolore magna aliqua. </p><ul><li><p><b>bold</b> text</p></li><li><p><i>italic</i> text</p><ul><li><p><a href=\"https://example.com/link-one\">link</a><u></u></p></li><li><p><u>underlined</u> text</p></li></ul></li></ul><ul><li><p>some <code>code</code> here</p></li></ul><ol><li><p>one</p></li><li><p>two</p><ol><li><p>aaay</p></li><li><p>beee</p></li></ol></li><li><p>three</p></li></ol><blockquote><p>Here's a blockquote</p></blockquote><hr/><p>Duis aute irure dolor in <a href=\"https://example.com/link-two\">reprehenderit</a> in voluptate \nvelit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint \noccaecat cupidatat non proident, sunt in culpa qui officia deserunt \nmollit anim id est laborum.</p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod \ntempor incididunt ut labore et dolore magna aliqua. </p><p></p>", | ||
"externalLink": "https://example.com", | ||
"externalLinkText": "Check out this blog post for more information 👍" | ||
} |
152 changes: 152 additions & 0 deletions
152
packages/desktop-gui/cypress/integration/release_notes_spec.js
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,152 @@ | ||
import { deferred } from '../support/util' | ||
|
||
describe('Release Notes', () => { | ||
let ipc | ||
let releaseNotes | ||
let getReleaseNotes | ||
|
||
beforeEach(() => { | ||
let user | ||
|
||
cy.fixture('user').then((theUser) => user = theUser) | ||
cy.fixture('release_notes').then((theReleaseNotes) => releaseNotes = theReleaseNotes) | ||
cy.route2('cypress-banner.jpg', { fixture: 'cypress-banner.jpg' }) | ||
|
||
cy.visitIndex().then((win) => { | ||
ipc = win.App.ipc | ||
|
||
cy.stub(ipc, 'getCurrentUser').resolves(user) | ||
cy.stub(ipc, 'externalOpen') | ||
cy.stub(ipc, 'getOptions').resolves({ version: '1.0.0' }) | ||
cy.stub(ipc, 'updaterCheck').resolves('1.2.3') | ||
|
||
getReleaseNotes = deferred() | ||
cy.stub(ipc, 'getReleaseNotes').returns(getReleaseNotes.promise) | ||
|
||
win.App.start() | ||
}) | ||
}) | ||
|
||
it('opens modal after clicking "Learn more" on update notice', () => { | ||
cy.get('.update-notice').contains('Learn more').click() | ||
cy.get('.update-modal').should('be.visible') | ||
}) | ||
|
||
it('shows loading spinner when loading release notes', () => { | ||
cy.get('.update-notice').contains('Learn more').click() | ||
cy.get('.update-modal .loader') | ||
}) | ||
|
||
it('shows update instructions if no release notes for version', () => { | ||
getReleaseNotes.resolve(null) | ||
cy.get('.update-notice').contains('Learn more').click() | ||
cy.contains('Update to Version 1.2.3').should('be.visible') | ||
}) | ||
|
||
it('shows update instructions if getting release notes errors', () => { | ||
getReleaseNotes.reject(new Error('something went wrong')) | ||
cy.get('.update-notice').contains('Learn more').click() | ||
cy.contains('Update to Version 1.2.3').should('be.visible') | ||
}) | ||
|
||
describe('when there are release notes (with all fields included)', () => { | ||
beforeEach(() => { | ||
getReleaseNotes.resolve(releaseNotes) | ||
cy.get('.update-notice').contains('Learn more').click() | ||
}) | ||
|
||
it('shows release notes title', () => { | ||
cy.contains(releaseNotes.title) | ||
}) | ||
|
||
it('title handles emoji', () => { | ||
cy.get('.release-notes h4').should('include.text', '😀') | ||
}) | ||
|
||
it('shows banner image', () => { | ||
cy.get('.release-notes img').should('have.attr', 'src', releaseNotes.bannerImage) | ||
cy.get('.release-notes img').should('have.attr', 'width', '548') | ||
}) | ||
|
||
it('shows content', () => { | ||
cy.get('.release-notes .contents') | ||
.shadow() | ||
.find('h1') | ||
.should('have.text', 'This is a great release') | ||
}) | ||
|
||
it('content handles emoji', () => { | ||
cy.get('.release-notes .contents') | ||
.shadow() | ||
.find('h2') | ||
.should('include.text', '😀 4️⃣ 👽 👍 🌎') | ||
}) | ||
|
||
it('opens links in content externally', () => { | ||
cy.get('.release-notes .contents') | ||
.shadow() | ||
.find('a') | ||
.each(($a) => { | ||
cy.wrap($a).click().then(() => { | ||
expect(ipc.externalOpen).to.be.calledWith($a.attr('href')) | ||
}) | ||
}) | ||
}) | ||
|
||
it('shows update button', () => { | ||
cy.contains('button', 'Update Now') | ||
}) | ||
|
||
it('shows instructions when clicking update button', () => { | ||
cy.contains('button', 'Update Now').click() | ||
cy.contains(releaseNotes.title).should('not.exist') | ||
cy.contains('Update to Version 1.2.3').should('be.visible') | ||
}) | ||
|
||
it('shows external link', () => { | ||
cy.get('.release-notes .external-link') | ||
.scrollIntoView() | ||
.should('be.visible') | ||
.find('button') | ||
.should('have.text', releaseNotes.externalLinkText) | ||
}) | ||
|
||
it('external link text handles emoji', () => { | ||
cy.get('.release-notes .external-link') | ||
.should('include.text', '👍') | ||
}) | ||
|
||
it('opens external link externally', () => { | ||
cy.get('.release-notes .external-link').click().then(() => { | ||
expect(ipc.externalOpen).to.be.calledWith(releaseNotes.externalLink) | ||
}) | ||
}) | ||
}) | ||
|
||
describe('when there are release notes (with some fields omitted)', () => { | ||
beforeEach(() => { | ||
cy.get('.update-notice').contains('Learn more').click() | ||
}) | ||
|
||
it('does not show banner image if there is not one', () => { | ||
releaseNotes.bannerImage = undefined | ||
getReleaseNotes.resolve(releaseNotes) | ||
|
||
cy.get('.release-notes img').should('not.exist') | ||
}) | ||
|
||
it('does not show external link if link is not specified', () => { | ||
releaseNotes.externalLink = undefined | ||
getReleaseNotes.resolve(releaseNotes) | ||
|
||
cy.get('.release-notes .external-link').should('not.exist') | ||
}) | ||
|
||
it('does not show external link if link text is not specified', () => { | ||
releaseNotes.externalLinkText = undefined | ||
getReleaseNotes.resolve(releaseNotes) | ||
|
||
cy.get('.release-notes .external-link').should('not.exist') | ||
}) | ||
}) | ||
}) |
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.
757ddc8
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.
Circle has built the
linux x64
version of the Test Runner.Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.
Run this command to install the pre-release locally:
757ddc8
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.
AppVeyor has built the
win32 x64
version of the Test Runner.Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.
Run this command to install the pre-release locally:
757ddc8
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.
AppVeyor has built the
win32 ia32
version of the Test Runner.Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.
Run this command to install the pre-release locally: