Skip to content

Commit c6432f2

Browse files
committed
closing the drawer in between
1 parent 508cb14 commit c6432f2

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

packages/compass-e2e-tests/helpers/selectors.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,3 +1495,6 @@ export const DataModelCollectionRelationshipItemDelete = `[aria-label="Delete re
14951495

14961496
// Side drawer
14971497
export const SideDrawer = `[data-testid="${getDrawerIds().root}"]`;
1498+
export const SideDrawerCloseButton = `[data-testid="${
1499+
getDrawerIds().closeButton
1500+
}"]`;

packages/compass-e2e-tests/tests/data-modeling-tab.test.ts

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@ async function selectCollectionOnTheDiagram(
9191
browser: CompassBrowser,
9292
ns: string
9393
) {
94+
// If the drawer is open, close it
95+
// Otherwise the drawer or the minimap can cover the collection node
96+
const drawer = browser.$(Selectors.SideDrawer);
97+
if (await drawer.isDisplayed()) {
98+
await browser.clickVisible(Selectors.SideDrawerCloseButton);
99+
await drawer.waitForDisplayed({ reverse: true });
100+
}
101+
94102
// Click on the collection node to open the drawer
95103
const collectionNode = browser.$(Selectors.DataModelPreviewCollection(ns));
96104
const size = await collectionNode.getSize();
@@ -99,6 +107,13 @@ async function selectCollectionOnTheDiagram(
99107
x: Math.round(size.width / 2),
100108
y: Math.round(size.height / 2),
101109
});
110+
111+
await drawer.waitForDisplayed();
112+
113+
const collectionName = await browser.getInputByLabel(
114+
drawer.$(Selectors.DataModelNameInput)
115+
);
116+
expect(await collectionName.getValue()).to.equal(ns);
102117
}
103118

104119
async function getDiagramNodes(
@@ -530,15 +545,9 @@ describe('Data Modeling tab', function () {
530545
// Click on the collection to open the drawer
531546
await selectCollectionOnTheDiagram(browser, 'test.testCollection-one');
532547

533-
// Wait for the drawer to open, then click the add relationship button
548+
// Click the add relationship button
534549
const drawer = browser.$(Selectors.SideDrawer);
535-
await drawer.waitForDisplayed();
536-
const collection1Name = await browser.getInputByLabel(
537-
drawer.$(Selectors.DataModelNameInput)
538-
);
539-
expect(await collection1Name.getValue()).to.equal(
540-
'test.testCollection-one'
541-
);
550+
542551
const addRelationshipBtn = browser.$(
543552
Selectors.DataModelAddRelationshipBtn
544553
);
@@ -572,20 +581,8 @@ describe('Data Modeling tab', function () {
572581
});
573582
const relationshipId = edges[0].id;
574583

575-
// Zooming out so that the collections are more accessible
576-
// (they can be covered by the drawer or the minimap)
577-
await browser.clickVisible(Selectors.DataModelZoomOutButton);
578-
await browser.clickVisible(Selectors.DataModelZoomOutButton);
579-
await browser.clickVisible(Selectors.DataModelZoomOutButton);
580-
581584
// Select the other collection and see that the new relationship is listed
582585
await selectCollectionOnTheDiagram(browser, 'test.testCollection-two');
583-
const collection2Name = await browser.getInputByLabel(
584-
drawer.$(Selectors.DataModelNameInput)
585-
);
586-
expect(await collection2Name.getValue()).to.equal(
587-
'test.testCollection-two'
588-
);
589586
const relationshipItem = drawer.$(
590587
Selectors.DataModelCollectionRelationshipItem(relationshipId)
591588
);

0 commit comments

Comments
 (0)