Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Desktop GUI layout issues/improvements #4905

Merged
merged 4 commits into from
Aug 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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%;
}
6 changes: 3 additions & 3 deletions packages/desktop-gui/src/specs/specs-list.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class SpecsList extends Component {
if (!specsStore.filter && !specsStore.specs.length) return this._empty()

return (
<div id='tests-list-page'>
<div className='specs'>
<header>
<div className={cs('search', {
'show-clear-filter': !!specsStore.filter,
Expand Down Expand Up @@ -73,7 +73,7 @@ class SpecsList extends Component {
}

return (
<ul className='outer-files-container list-as-table'>
<ul className='specs-list list-as-table'>
{_.map(specsStore.specs, (spec) => this._specItem(spec, 0))}
</ul>
)
Expand Down Expand Up @@ -168,7 +168,7 @@ class SpecsList extends Component {

_empty () {
return (
<div id='tests-list-page'>
<div className='specs'>
<div className='empty-well'>
<h5>
No files found in
Expand Down
Loading