Skip to content

Commit 4967191

Browse files
committed
Fix functional test suite and run on travis (#585)
1 parent 996ceb5 commit 4967191

File tree

3 files changed

+72
-12
lines changed

3 files changed

+72
-12
lines changed

src/internal-packages/sidebar/lib/components/sidebar-collection.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class SidebarCollection extends React.Component {
3737
<div className="compass-sidebar-item">
3838
<div onClick={this.handleClick}
3939
className="compass-sidebar-title compass-sidebar-title-is-actionable"
40-
title={collectionName}>
40+
title={this.props._id}>
4141
{collectionName}&nbsp;
4242
{this.renderReadonly()}
4343
</div>

test/compass-functional.test.js

Lines changed: 69 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ describe('Compass #spectron', function() {
3939

4040
context('when working with the application', function() {
4141
before(require('mongodb-runner/mocha/before')({ port: 27018 }));
42+
43+
before(function(done) {
44+
CrudSupport.insertMany(CONNECTION, COLLECTION, DOCUMENTS, done);
45+
});
46+
4247
after(require('mongodb-runner/mocha/after')());
4348

4449
context('when opening the application', function() {
@@ -56,20 +61,12 @@ describe('Compass #spectron', function() {
5661
.fillOutForm({ hostname: 'localhost', port: 27018 })
5762
.clickConnect()
5863
.waitForSchemaWindow()
59-
.getTitle().should.eventually.be.equal('MongoDB Compass');
64+
.getTitle().should.eventually.be.equal('MongoDB Compass - localhost:27018');
6065
});
6166
});
6267
});
6368

6469
context('when working with collections', function() {
65-
before(function(done) {
66-
CrudSupport.insertMany(CONNECTION, COLLECTION, DOCUMENTS, done);
67-
});
68-
69-
after(function(done) {
70-
CrudSupport.removeAll(CONNECTION, COLLECTION, done);
71-
});
72-
7370
context('when selecting a collection', function() {
7471
it('renders the sample collection in the title', function() {
7572
return client
@@ -80,6 +77,17 @@ describe('Compass #spectron', function() {
8077
);
8178
});
8279

80+
it('renders the schema tab', function() {
81+
return client
82+
.waitForStatusBar()
83+
.gotoSchemaTab()
84+
.getText('li.bubble code.selectable')
85+
.should
86+
.eventually
87+
.include
88+
.members([ 'Arca', 'Bonobo', 'Aphex Twin', 'Beacon' ]);
89+
});
90+
8391
context('when applying a filter', function() {
8492
it('samples the matching documents', function() {
8593
return client
@@ -88,6 +96,32 @@ describe('Compass #spectron', function() {
8896
.waitForStatusBar()
8997
.getText('div.sampling-message b').should.eventually.include('1');
9098
});
99+
100+
it('updates the schema view', function() {
101+
return client
102+
.getText('li.bubble code.selectable')
103+
.should
104+
.eventually
105+
.equal('Arca');
106+
});
107+
108+
it('filters out non-matches from the document list', function() {
109+
return client
110+
.gotoDocumentsTab()
111+
.getText('div.element-value-is-string')
112+
.should
113+
.not
114+
.eventually
115+
.include('Aphex Twin');
116+
});
117+
118+
it('includes documents that match the filter', function() {
119+
return client
120+
.getText('div.element-value-is-string')
121+
.should
122+
.eventually
123+
.include('Arca');
124+
});
91125
});
92126

93127
context('when resetting the filter', function() {
@@ -112,6 +146,32 @@ describe('Compass #spectron', function() {
112146
});
113147
});
114148
});
149+
150+
context('when working in the explain tab', function() {
151+
context('when viewing the explain tab', function() {
152+
it('renders the stages', function() {
153+
return client
154+
.gotoExplainPlanTab()
155+
.getText('h3.stage-header')
156+
.should
157+
.eventually
158+
.include('COLLSCAN');
159+
});
160+
});
161+
});
162+
163+
context('when working in the indexes tab', function() {
164+
context('when viewing the indexes tab', function() {
165+
it('renders the indexes', function() {
166+
return client
167+
.gotoIndexesTab()
168+
.getText('div.index-definition div.name')
169+
.should
170+
.eventually
171+
.include('_id_');
172+
});
173+
});
174+
});
115175
});
116176
});
117177
});

test/support/spectron-support.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ function addCommands(client) {
203203
*/
204204
client.addCommand('selectCollection', function(name) {
205205
return this.waitForStatusBar()
206-
.waitForVisible('a span[title="' + name + '"]', 60000)
207-
.click('a span[title="' + name + '"]')
206+
.waitForVisible('.compass-sidebar-item div[title="' + name + '"]', 60000)
207+
.click('.compass-sidebar-item div[title="' + name + '"]')
208208
.waitForVisible('div.schema-field-list', 60000);
209209
});
210210

0 commit comments

Comments
 (0)