-
Notifications
You must be signed in to change notification settings - Fork 234
chore(e2e): Rewrite Instance Databases tab -> can refresh the list of databases using refresh controls COMPASS-7663 #5544
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
1bc9202
lots more waiting and checks between actions in the flaky test
lerouxb 94f3013
WIP
lerouxb eb1dc6d
Merge branch 'main' into disable-refresh-test
lerouxb b1c0f24
remove the console.log lines again
lerouxb f8f7efd
rewrite the test
lerouxb f003165
don't add something while the initial load is ongoing
lerouxb 69fd202
scroll and take a screenshot before click
lerouxb 1353692
slight tweak
lerouxb 362e995
without the only
lerouxb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,8 @@ import { | |
createNumbersCollection, | ||
} from '../helpers/insert-data'; | ||
|
||
const INITIAL_DATABASE_NAMES = ['admin', 'config', 'local', 'test']; | ||
|
||
describe('Instance databases tab', function () { | ||
let compass: Compass; | ||
let browser: CompassBrowser; | ||
|
@@ -42,9 +44,7 @@ describe('Instance databases tab', function () { | |
const dbTable = await browser.$(Selectors.DatabasesTable); | ||
await dbTable.waitForDisplayed(); | ||
|
||
const dbSelectors = ['admin', 'config', 'local', 'test'].map( | ||
Selectors.databaseCard | ||
); | ||
const dbSelectors = INITIAL_DATABASE_NAMES.map(Selectors.databaseCard); | ||
|
||
for (const dbSelector of dbSelectors) { | ||
const found = await browser.scrollToVirtualItem( | ||
|
@@ -138,31 +138,37 @@ describe('Instance databases tab', function () { | |
}); | ||
|
||
it('can refresh the list of databases using refresh controls', async function () { | ||
const db = 'my-instance-database'; | ||
const coll = 'my-collection'; | ||
const db = 'test'; // added by beforeEach | ||
const dbSelector = Selectors.databaseCard(db); | ||
|
||
// Create the database and refresh | ||
// Browse to the databases tab | ||
await browser.navigateToInstanceTab('Databases'); | ||
|
||
// Make sure the db card we're going to drop is in there. | ||
await browser.scrollToVirtualItem( | ||
Selectors.DatabasesTable, | ||
dbSelector, | ||
'grid' | ||
); | ||
await browser.$(dbSelector).waitForDisplayed(); | ||
|
||
// Wait for the page to finish loading as best as we can | ||
await browser.waitUntil(async () => { | ||
const placeholders = await browser.$$(Selectors.DatabaseStatLoader); | ||
return placeholders.length === 0; | ||
}); | ||
|
||
// Drop the database using the driver | ||
const mongoClient = new MongoClient(DEFAULT_CONNECTION_STRING); | ||
await mongoClient.connect(); | ||
try { | ||
const database = mongoClient.db(db); | ||
await database.createCollection(coll); | ||
|
||
await browser.navigateToInstanceTab('Databases'); | ||
await browser.clickVisible(Selectors.InstanceRefreshDatabaseButton); | ||
|
||
await browser.scrollToVirtualItem( | ||
Selectors.DatabasesTable, | ||
dbSelector, | ||
'grid' | ||
); | ||
await browser.$(dbSelector).waitForDisplayed(); | ||
|
||
// Drop it and refresh again | ||
// Drop the database | ||
console.log({ | ||
'database.dropDatabase()': await database.dropDatabase(), | ||
}); | ||
// Prove that it is really gone | ||
console.log({ | ||
'database.admin().listDatabases()': ( | ||
await database.admin().listDatabases() | ||
|
@@ -172,10 +178,11 @@ describe('Instance databases tab', function () { | |
await mongoClient.close(); | ||
} | ||
|
||
// looks like if you refresh too fast the database appears in the list but | ||
// the stats never load, so just pause for bit first | ||
await browser.pause(1000); | ||
await browser.clickVisible(Selectors.InstanceRefreshDatabaseButton); | ||
// Refresh again and the database card should disappear. | ||
await browser.clickVisible(Selectors.InstanceRefreshDatabaseButton, { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sometimes the card doesn't go away. This is now the only time we hit the refresh button so the only thing I can think of is that the initial load is still somehow in progress by the time we hit the refresh button. |
||
scroll: true, | ||
screenshot: 'instance-refresh-database-button.png', | ||
}); | ||
await browser.$(dbSelector).waitForExist({ reverse: true }); | ||
}); | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If only we (or a user) could reliably tell in the UI once everything is done loading. 🤔