Skip to content

Commit

Permalink
Merge branch 'develop' into electron-3-from-develop
Browse files Browse the repository at this point in the history
  • Loading branch information
flotwig committed Aug 20, 2019
2 parents b3ec1b5 + 7e2ca83 commit 7247a60
Show file tree
Hide file tree
Showing 19 changed files with 784 additions and 611 deletions.
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@
"@cypress/bumpercar": "2.0.9",
"@cypress/commit-message-install": "2.7.0",
"@cypress/env-or-json-file": "2.0.0",
"@cypress/eslint-plugin-dev": "3.7.1",
"@cypress/eslint-plugin-json": "3.2.1",
"@cypress/eslint-plugin-dev": "3.7.2",
"@cypress/eslint-plugin-json": "3.2.3",
"@cypress/github-commit-status-check": "1.5.0",
"@cypress/npm-run-all": "4.0.5",
"@cypress/questions-remain": "1.0.1",
Expand Down Expand Up @@ -189,7 +189,11 @@
"testing"
],
"lint-staged": {
"*.{js,jsx,ts,tsx,coffee,json,eslintrc}": [
"*.coffee": [
"npm run stop-only -- --folder",
"git add"
],
"*.{js,jsx,ts,tsx,json,eslintrc}": [
"npm run stop-only -- --folder",
"eslint --fix",
"git add"
Expand Down
28 changes: 26 additions & 2 deletions packages/desktop-gui/cypress/fixtures/specs.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,32 @@
"relative": "cypress/unit/admin_users/admin/users/bar_list_spec.coffee"
},
{
"name": "admin_users/admin/users/all/admin/baz_list_spec.coffee",
"relative": "cypress/unit/admin_users/admin/users/all/admin/baz_list_spec.coffee"
"name": "admin_users/admin/users/all/admin/one_list_spec.coffee",
"relative": "cypress/unit/admin_users/admin/users/all/admin/one_list_spec.coffee"
},
{
"name": "admin_users/admin/users/all/admin/two_list_spec.coffee",
"relative": "cypress/unit/admin_users/admin/users/all/admin/two_list_spec.coffee"
},
{
"name": "admin_users/admin/users/all/admin/three_list_spec.coffee",
"relative": "cypress/unit/admin_users/admin/users/all/admin/three_list_spec.coffee"
},
{
"name": "admin_users/admin/users/all/admin/four_list_spec.coffee",
"relative": "cypress/unit/admin_users/admin/users/all/admin/four_list_spec.coffee"
},
{
"name": "admin_users/admin/users/all/admin/five_list_spec.coffee",
"relative": "cypress/unit/admin_users/admin/users/all/admin/five_list_spec.coffee"
},
{
"name": "admin_users/admin/users/all/admin/six_list_spec.coffee",
"relative": "cypress/unit/admin_users/admin/users/all/admin/six_list_spec.coffee"
},
{
"name": "admin_users/admin/users/all/admin/last_list_spec.coffee",
"relative": "cypress/unit/admin_users/admin/users/all/admin/last_list_spec.coffee"
}
]
}
4 changes: 2 additions & 2 deletions packages/desktop-gui/cypress/fixtures/specs_windows.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
"relative": "cypress\\unit\\admin_users\\admin\\users\\bar_list_spec.coffee"
},
{
"name": "admin_users\\admin\\users\\all\\admin\\baz_list_spec.coffee",
"relative": "cypress\\unit\\admin_users\\admin\\users\\all\\admin\\baz_list_spec.coffee"
"name": "admin_users\\admin\\users\\all\\admin\\last_list_spec.coffee",
"relative": "cypress\\unit\\admin_users\\admin\\users\\all\\admin\\last_list_spec.coffee"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ describe('ErrorMessage', function () {
this.ipc.openProject.rejects({ name: 'Error', message: this.longErrMessage, stack: '[object Object]↵' })
this.start()

cy.get('#updates-available').should('be.visible')
cy.get('.updates-available').should('be.visible')
.contains('New updates are available')

cy.get('.error')
Expand Down
80 changes: 30 additions & 50 deletions packages/desktop-gui/cypress/integration/project_mode_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,77 +2,57 @@ describe('Project Mode', function () {
beforeEach(function () {
cy.fixture('user').as('user')
cy.fixture('config').as('config')

cy.fixture('specs').as('specs')
})

context('Mac', function () {
beforeEach(function () {
cy.visitIndex().then((win) => {
let start = win.App.start

this.win = win
this.ipc = win.App.ipc

this.config.projectName = 'my-kitchen-sink'
cy.visitIndex().then((win) => {
this.start = win.App.start
this.ipc = win.App.ipc

cy.stub(this.ipc, 'onMenuClicked')
cy.stub(this.ipc, 'onFocusTests')
cy.stub(this.ipc, 'getOptions').resolves({ projectRoot: '/foo/bar' })
cy.stub(this.ipc, 'updaterCheck').resolves(false)
cy.stub(this.ipc, 'openProject').resolves(this.config)
cy.stub(this.ipc, 'getSpecs').yields(null, this.specs)
this.config.projectName = 'my-kitchen-sink'

this.getCurrentUser = this.util.deferred()
cy.stub(this.ipc, 'onMenuClicked')
cy.stub(this.ipc, 'onFocusTests')
cy.stub(this.ipc, 'getOptions').resolves({ projectRoot: '/foo/bar' })
cy.stub(this.ipc, 'updaterCheck').resolves(false)
cy.stub(this.ipc, 'openProject').resolves(this.config)
cy.stub(this.ipc, 'getSpecs')

start()
})
this.getCurrentUser = this.util.deferred()
})
})

it('goes straight to project specs list', () => {
cy.shouldBeOnProjectSpecs()
})
it('displays footer on bottom when loading (issue #4888)', function () {
const openProject = this.util.deferred()

it('sets title as project path', () => {
cy.title().should('eq', '/foo/bar')
})
this.ipc.openProject.resolves(openProject.promise)
this.start()

it('shows project name in nav', function () {
cy.get('.main-nav .nav:first-child div')
.should('contain', this.config.projectName)
.and('not.contain', 'foo')
})
cy.get('footer').invoke('position').its('top').should('be.gt', 50)
})

context('Windows', function () {
describe('when specs load', function () {
beforeEach(function () {
cy.visitIndex().then((win) => {
let start;

({ start, ipc: this.ipc } = win.App)

cy.stub(this.ipc, 'onMenuClicked')
cy.stub(this.ipc, 'onFocusTests')
cy.stub(this.ipc, 'getOptions').resolves({ projectRoot: 'C:\\foo\\bar' })
cy.stub(this.ipc, 'updaterCheck').resolves(false)
cy.stub(this.ipc, 'openProject').resolves(this.config)
cy.stub(this.ipc, 'getSpecs').yields(null, this.specs)

this.getCurrentUser = this.util.deferred()

start()
})
this.ipc.getSpecs.yields(null, this.specs)
})

it('goes straight to project specs list', () => {
it('goes straight to project specs list', function () {
this.start()
cy.shouldBeOnProjectSpecs()
})

it('sets title as project path', () => {
it('sets title as project path on Mac/Linux', function () {
this.start()
cy.title().should('eq', '/foo/bar')
})

it('sets title as project path on Windows', function () {
this.ipc.getOptions.resolves({ projectRoot: 'C:\\foo\\bar' })
this.start()
cy.title().should('eq', 'C:\\foo\\bar')
})

it('shows project name in nav', function () {
this.start()
cy.get('.main-nav .nav:first-child div')
.should('contain', this.config.projectName)
.and('not.contain', 'foo')
Expand Down
42 changes: 25 additions & 17 deletions packages/desktop-gui/cypress/integration/specs_list_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ describe('Specs List', function () {
this.win = win
this.ipc = win.App.ipc

this.numSpecs = this.specs.integration.length + this.specs.unit.length

cy.stub(this.ipc, 'getOptions').resolves({ projectRoot: '/foo/bar' })
cy.stub(this.ipc, 'getCurrentUser').resolves(this.user)
cy.stub(this.ipc, 'getSpecs').yields(null, this.specs)
Expand Down Expand Up @@ -144,7 +146,7 @@ describe('Specs List', function () {
})

it('lists test specs', function () {
cy.get('.file a').last().should('contain', 'baz_list_spec.coffee')
cy.get('.file a').last().should('contain', 'last_list_spec.coffee')
cy.get('.file a').last().should('not.contain', 'admin_users')
})
})
Expand Down Expand Up @@ -198,7 +200,6 @@ describe('Specs List', function () {
context('displays list of specs', function () {
it('lists main folders of specs', function () {
cy.contains('.folder.level-0', 'integration')

cy.contains('.folder.level-0', 'unit')
})

Expand All @@ -211,8 +212,7 @@ describe('Specs List', function () {
})

it('lists folder with \'.\'', function () {
cy.get('.file').should('have.length', 7)

cy.get('.file').should('have.length', this.numSpecs)
cy.get('.folder').should('have.length', 10)
})
})
Expand All @@ -226,10 +226,10 @@ describe('Specs List', function () {
})

it('hides children when folder clicked', function () {
cy.get('.file').should('have.length', 7)
cy.get('.file').should('have.length', this.numSpecs)
cy.get('.folder .folder-name:first').click()

cy.get('.file').should('have.length', 2)
cy.get('.file').should('have.length', 8)
})

it('sets folder expanded when clicked twice', function () {
Expand All @@ -243,7 +243,7 @@ describe('Specs List', function () {
it('hides children for every folder collapsed', function () {
const lastExpandedFolderSelector = '.folder-expanded:last > div > .folder-name:last'

cy.get('.file').should('have.length', 7)
cy.get('.file').should('have.length', this.numSpecs)

cy.get(lastExpandedFolderSelector).click()
cy.get('.file').should('have.length', 6)
Expand Down Expand Up @@ -280,6 +280,14 @@ describe('Specs List', function () {
})

context('filtering specs', function () {
it('scrolls the specs and not the filter', function () {
this.ipc.getSpecs.yields(null, this.specs)
this.openProject.resolve(this.config)

cy.contains('last_list_spec').scrollIntoView()
cy.get('.filter').should('be.visible')
})

describe('typing the filter', function () {
beforeEach(function () {
this.ipc.getSpecs.yields(null, this.specs)
Expand All @@ -289,13 +297,13 @@ describe('Specs List', function () {
})

it('displays only matching spec', () => {
cy.get('.outer-files-container .file')
cy.get('.specs-list .file')
.should('have.length', 1)
.and('contain', 'account_new_spec.coffee')
})

it('only shows matching folders', () => {
cy.get('.outer-files-container .folder')
cy.get('.specs-list .folder')
.should('have.length', 2)
})

Expand All @@ -304,21 +312,21 @@ describe('Specs List', function () {
cy.get('.filter')
.should('have.value', '')

cy.get('.outer-files-container .file')
.should('have.length', 7)
cy.get('.specs-list .file')
.should('have.length', this.numSpecs)
})

it('clears the filter if the user press ESC key', function () {
cy.get('.filter').type('{esc}')
.should('have.value', '')

cy.get('.outer-files-container .file')
.should('have.length', 7)
cy.get('.specs-list .file')
.should('have.length', this.numSpecs)
})

it('shows empty message if no results', function () {
cy.get('.filter').clear().type('foobarbaz')
cy.get('.outer-files-container').should('not.exist')
cy.get('.specs-list').should('not.exist')

cy.get('.empty-well').should('contain', 'No specs match your search: "foobarbaz"')
})
Expand All @@ -328,8 +336,8 @@ describe('Specs List', function () {
cy.get('.btn').contains('Clear search').click()
cy.focused().should('have.id', 'filter')

cy.get('.outer-files-container .file')
.should('have.length', 7)
cy.get('.specs-list .file')
.should('have.length', this.numSpecs)
})

it('saves the filter to local storage for the project', function () {
Expand Down Expand Up @@ -427,7 +435,7 @@ describe('Specs List', function () {

context('choose deeper nested spec', function () {
beforeEach(() => {
cy.get('.file a').contains('a', 'baz_list_spec.coffee').as('deepSpec').click()
cy.get('.file a').contains('a', 'last_list_spec.coffee').as('deepSpec').click()
})

it('updates spec icon', () => {
Expand Down
11 changes: 8 additions & 3 deletions packages/desktop-gui/cypress/integration/update_banner_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('Update Banner', function () {
it('does not display update banner when no update available', function () {
this.updaterCheck.resolve(false)

cy.get('#updates-available').should('not.exist')
cy.get('.updates-available').should('not.exist')

cy.get('html').should('not.have.class', 'has-updates')
})
Expand All @@ -55,7 +55,7 @@ describe('Update Banner', function () {

it('displays banner if new version is available', function () {
this.updaterCheck.resolve(NEW_VERSION)
cy.get('#updates-available').should('be.visible')
cy.get('.updates-available').should('be.visible')
cy.contains('New updates are available')

cy.get('html').should('have.class', 'has-updates')
Expand Down Expand Up @@ -139,14 +139,19 @@ describe('Update Banner', function () {
this.start()
this.updaterCheck.resolve(NEW_VERSION)

cy.get('#updates-available')
cy.get('.updates-available')
})

it('displays all folders/specs within visible area', () => {
cy.get('.folder-name')
.last()
.scrollIntoView()
.should('be.visible')

cy.get('.file-name')
.last()
.scrollIntoView()
.should('be.visible')
})
})
})
8 changes: 7 additions & 1 deletion packages/desktop-gui/src/project/project.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ class Project extends Component {
}

render () {
if (this.props.project.isLoading) return <Loader color='#888' scale={0.5}/>
if (this.props.project.isLoading) {
return (
<div className='loader-wrap'>
<Loader color='#888' scale={0.5}/>
</div>
)
}

if (this.props.project.error) return <ErrorMessage error={this.props.project.error} onTryAgain={this._reopenProject}/>

Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-gui/src/project/project.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.project-content {
display: flex;
flex-grow: 2;
overflow: auto;
margin-bottom: 0;
width: 100%;
}
Loading

0 comments on commit 7247a60

Please sign in to comment.