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

Fix functional test suite and run on travis #585

Merged
merged 1 commit into from
Nov 13, 2016
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class SidebarCollection extends React.Component {
<div className="compass-sidebar-item">
<div onClick={this.handleClick}
className="compass-sidebar-title compass-sidebar-title-is-actionable"
title={collectionName}>
title={this.props._id}>
{collectionName}&nbsp;
{this.renderReadonly()}
</div>
Expand Down
78 changes: 69 additions & 9 deletions test/compass-functional.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ describe('Compass #spectron', function() {

context('when working with the application', function() {
before(require('mongodb-runner/mocha/before')({ port: 27018 }));

before(function(done) {
CrudSupport.insertMany(CONNECTION, COLLECTION, DOCUMENTS, done);
});

after(require('mongodb-runner/mocha/after')());

context('when opening the application', function() {
Expand All @@ -56,20 +61,12 @@ describe('Compass #spectron', function() {
.fillOutForm({ hostname: 'localhost', port: 27018 })
.clickConnect()
.waitForSchemaWindow()
.getTitle().should.eventually.be.equal('MongoDB Compass');
.getTitle().should.eventually.be.equal('MongoDB Compass - localhost:27018');
});
});
});

context('when working with collections', function() {
before(function(done) {
CrudSupport.insertMany(CONNECTION, COLLECTION, DOCUMENTS, done);
});

after(function(done) {
CrudSupport.removeAll(CONNECTION, COLLECTION, done);
});

context('when selecting a collection', function() {
it('renders the sample collection in the title', function() {
return client
Expand All @@ -80,6 +77,17 @@ describe('Compass #spectron', function() {
);
});

it('renders the schema tab', function() {
return client
.waitForStatusBar()
.gotoSchemaTab()
.getText('li.bubble code.selectable')
.should
.eventually
.include
.members([ 'Arca', 'Bonobo', 'Aphex Twin', 'Beacon' ]);
});

context('when applying a filter', function() {
it('samples the matching documents', function() {
return client
Expand All @@ -88,6 +96,32 @@ describe('Compass #spectron', function() {
.waitForStatusBar()
.getText('div.sampling-message b').should.eventually.include('1');
});

it('updates the schema view', function() {
return client
.getText('li.bubble code.selectable')
.should
.eventually
.equal('Arca');
});

it('filters out non-matches from the document list', function() {
return client
.gotoDocumentsTab()
.getText('div.element-value-is-string')
.should
.not
.eventually
.include('Aphex Twin');
});

it('includes documents that match the filter', function() {
return client
.getText('div.element-value-is-string')
.should
.eventually
.include('Arca');
});
});

context('when resetting the filter', function() {
Expand All @@ -112,6 +146,32 @@ describe('Compass #spectron', function() {
});
});
});

context('when working in the explain tab', function() {
context('when viewing the explain tab', function() {
it('renders the stages', function() {
return client
.gotoExplainPlanTab()
.getText('h3.stage-header')
.should
.eventually
.include('COLLSCAN');
});
});
});

context('when working in the indexes tab', function() {
context('when viewing the indexes tab', function() {
it('renders the indexes', function() {
return client
.gotoIndexesTab()
.getText('div.index-definition div.name')
.should
.eventually
.include('_id_');
});
});
});
});
});
});
4 changes: 2 additions & 2 deletions test/support/spectron-support.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ function addCommands(client) {
*/
client.addCommand('selectCollection', function(name) {
return this.waitForStatusBar()
.waitForVisible('a span[title="' + name + '"]', 60000)
.click('a span[title="' + name + '"]')
.waitForVisible('.compass-sidebar-item div[title="' + name + '"]', 60000)
.click('.compass-sidebar-item div[title="' + name + '"]')
.waitForVisible('div.schema-field-list', 60000);
});

Expand Down