Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
23b548b
use tg table for indexes
mabaasit Aug 17, 2022
dc21419
restructure
mabaasit Aug 17, 2022
a3ad50b
show delete button on row hover
mabaasit Aug 17, 2022
56a1c94
clean up
mabaasit Aug 17, 2022
7dfa100
clean up
mabaasit Aug 17, 2022
b666473
indexes card test
mabaasit Aug 17, 2022
1880da1
tests
mabaasit Aug 17, 2022
53e2d8a
component tests
mabaasit Aug 17, 2022
020900a
e2e tests
mabaasit Aug 17, 2022
d70b1f5
lint
mabaasit Aug 17, 2022
41201e1
clean up
mabaasit Aug 17, 2022
54397c7
Merge branch 'main' into indexes-lg-table
mabaasit Aug 17, 2022
426790a
test fix
mabaasit Aug 18, 2022
aa7f9c6
Merge branch 'indexes-lg-table' of github.com:mongodb-js/compass into…
mabaasit Aug 18, 2022
af8326b
Merge branch 'main' into indexes-lg-table
mabaasit Aug 18, 2022
29be666
ux changes
mabaasit Aug 18, 2022
193d2aa
Merge branch 'indexes-lg-table' of github.com:mongodb-js/compass into…
mabaasit Aug 18, 2022
ba73251
align table data to top
mabaasit Aug 18, 2022
d67b6f1
more tests
mabaasit Aug 18, 2022
9345d12
checks
mabaasit Aug 18, 2022
85dd299
Merge branch 'main' into indexes-lg-table
mabaasit Aug 18, 2022
600c3e0
review changes
mabaasit Aug 22, 2022
0dea994
fix focus on icon
mabaasit Aug 22, 2022
478f811
dark mode
mabaasit Aug 22, 2022
772a245
Merge branch 'indexes-lg-table' of github.com:mongodb-js/compass into…
mabaasit Aug 22, 2022
a618884
focus delete button on tab
mabaasit Aug 22, 2022
5b2d063
Merge remote-tracking branch 'origin' into indexes-lg-table
mabaasit Aug 22, 2022
15f2d1b
fix tests
mabaasit Aug 22, 2022
6df0303
clean up
mabaasit Aug 22, 2022
a457d25
use less padding in toolbar
mabaasit Aug 22, 2022
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
4 changes: 0 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ describe('PipelineExplain', function () {
name: /ascending index/i, // host_id index direction 1
})
).to.exist;
expect(within(indexContent1).getByText(/location \(2dsphere\)/i)).to.exist;
expect(within(indexContent1).getByText(/location/i)).to.exist;
expect(within(indexContent1).getByText(/\(2dsphere\)/i)).to.exist;

// Toggle second accordian
userEvent.click(
Expand All @@ -164,6 +165,7 @@ describe('PipelineExplain', function () {
name: /descending index/i, // city_id index direction -1
})
).to.exist;
expect(within(indexContent2).getByText(/title \(text\)/i)).to.exist;
expect(within(indexContent2).getByText(/title/i)).to.exist;
expect(within(indexContent2).getByText(/\(text\)/i)).to.exist;
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const IndexIcon = ({ direction }: { direction: IndexDirection }) => {
) : direction === -1 ? (
<Icon glyph="ArrowDown" size="small" aria-label="Descending index" />
) : (
<>({String(direction)})</>
<span>({String(direction)})</span>
);
};

Expand Down
31 changes: 13 additions & 18 deletions packages/compass-e2e-tests/helpers/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -770,10 +770,18 @@ export const ExplainDocumentsReturnedSummary =
'[data-test-id="documents-returned-summary"]';

// Indexes tab
export const IndexList = '[data-test-id="index-list"]';
export const IndexComponent = '[data-test-id="index-list"] tr';
export const IndexFieldName = '[data-testid="index-field-name"]';
export const IndexFieldType = '[data-testid="index-field-type"]';
export const IndexList = '[data-testid="indexes-list"]';
export const IndexComponent = (name: string): string => {
return `[data-testid="index-row-${name}"]`;
};
export const IndexFieldName = '[data-testid="index-name-field"]';
export const IndexFieldType = '[data-testid="index-type-field"]';
export const IndexToggleOptions =
'[data-testid="create-index-modal-toggle-options"]';
export const IndexToggleIsWildcard =
'[data-testid="create-index-modal-use-wildcard-checkbox-fieldset"] #create-index-modal-use-wildcard-checkbox-label';
export const IndexWildcardProjectionEditor =
'[data-testid="create-index-modal-use-wildcard-checkbox-fieldset"] .ace_editor';

export const CreateIndexButton =
'[data-testid="open-create-index-modal-button"]';
Expand All @@ -791,13 +799,6 @@ export const CreateIndexModalFieldTypeSelectMenu = (idx: number): string => {
return `[data-testid="create-index-fields-type-${idx}"] #create-index-fields-type-select-${idx}-menu`;
};

export const IndexToggleOptions =
'[data-testid="create-index-modal-toggle-options"]';
export const IndexToggleIsWildcard =
'[data-testid="create-index-modal-use-wildcard-checkbox-fieldset"] #create-index-modal-use-wildcard-checkbox-label';
export const IndexWildcardProjectionEditor =
'[data-testid="create-index-modal-use-wildcard-checkbox-fieldset"] .ace_editor';

export const CreateIndexErrorMessage = `${CreateIndexModal} [role="alert"]`;
export const CreateIndexConfirmButton = `${CreateIndexModal} [role=dialog] > div:nth-child(2) button:first-child`;
export const CreateIndexCancelButton = `${CreateIndexModal} [role=dialog] > div:nth-child(2) button:last-child`;
Expand All @@ -808,13 +809,7 @@ export const DropIndexModalConfirmName =
export const DropIndexModalConfirmButton =
'[data-testid="drop_index_modal"] [role=dialog] > div:nth-child(2) button:first-child';

export const indexComponent = (indexName: string): string => {
return `[data-test-id="index-component-${indexName}"]`;
};

export const dropIndexButton = (indexName: string): string => {
return `[data-testid="drop-index-button-${indexName}"]`;
};
export const DropIndexButton = '[data-testid="drop-index-button"]';

// Validation tab
export const AddRuleButton = '[data-test-id="add-rule-button"]';
Expand Down
27 changes: 19 additions & 8 deletions packages/compass-e2e-tests/tests/collection-indexes-tab.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ describe('Collection indexes tab', function () {
const element = await browser.$(Selectors.IndexList);
await element.waitForDisplayed();

const indexes = await browser.$$(Selectors.IndexComponent);
const indexes = await browser.$$(Selectors.IndexComponent('_id_'));
expect(indexes).to.have.lengthOf(1);

const indexFieldNameElement = await browser.$(Selectors.IndexFieldName);
const indexFieldNameElement = await browser.$(
`${Selectors.IndexComponent('_id_')} ${Selectors.IndexFieldName}`
);
expect(await indexFieldNameElement.getText()).to.equal('_id_');
});

Expand Down Expand Up @@ -81,10 +83,15 @@ describe('Collection indexes tab', function () {

await createModal.waitForDisplayed({ reverse: true });

const indexComponent = await browser.$(Selectors.indexComponent('i_text'));
const indexComponentSelector = Selectors.IndexComponent('i_text');

const indexComponent = await browser.$(indexComponentSelector);
await indexComponent.waitForDisplayed();

await browser.clickVisible(Selectors.dropIndexButton('i_text'));
await browser.hover(indexComponentSelector);
await browser.clickVisible(
`${indexComponentSelector} ${Selectors.DropIndexButton}`
);

const dropModal = await browser.$(Selectors.DropIndexModal);
await dropModal.waitForDisplayed();
Expand Down Expand Up @@ -157,10 +164,10 @@ describe('Collection indexes tab', function () {

await createModal.waitForDisplayed({ reverse: true });

const indexComponent = await browser.$(Selectors.indexComponent('$**_1'));
const indexComponent = await browser.$(Selectors.IndexComponent('$**_1'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀

Copy link
Collaborator Author

@mabaasit mabaasit Aug 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the selectors exported IndexComponent and indexComponent. I removed the latter one as its not required anymore and used IndexComponent :)

await indexComponent.waitForDisplayed();

const indexFieldTypeSelector = `${Selectors.indexComponent('$**_1')} ${
const indexFieldTypeSelector = `${Selectors.IndexComponent('$**_1')} ${
Selectors.IndexFieldType
}`;
const indexFieldTypeElement = await browser.$(indexFieldTypeSelector);
Expand Down Expand Up @@ -212,11 +219,15 @@ describe('Collection indexes tab', function () {
await createModal.waitForDisplayed({ reverse: true });

const indexComponent = await browser.$(
Selectors.indexComponent('columnstore')
Selectors.IndexComponent('columnstore')
);
await indexComponent.waitForDisplayed();

await browser.clickVisible(Selectors.dropIndexButton('columnstore'));
await browser.clickVisible(
`${Selectors.IndexComponent('columnstore')} ${
Selectors.DropIndexButton
}`
);

const dropModal = await browser.$(Selectors.DropIndexModal);
await dropModal.waitForDisplayed();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ describe('Database collections tab', function () {

await browser.navigateToCollectionTab('test', collectionName, 'Indexes');

const typeElementSelector = `${Selectors.indexComponent(indexName)} ${
const typeElementSelector = `${Selectors.IndexComponent(indexName)} ${
Selectors.IndexFieldType
}`;
const typeElement = await browser.$(typeElementSelector);
Expand Down
2 changes: 0 additions & 2 deletions packages/compass-indexes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,8 @@
"hadron-app": "^5.0.0",
"hadron-app-registry": "^9.0.0",
"lodash.contains": "^2.4.3",
"lodash.isundefined": "^3.0.1",
"lodash.map": "^4.6.0",
"lodash.max": "^4.0.1",
"lodash.pick": "^4.4.0",
"mocha": "^8.4.0",
"mongodb": "^4.6.0",
"mongodb-data-service": "^22.0.0",
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading