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

test migration: session tests #5391

Merged
merged 21 commits into from
Feb 17, 2023

Conversation

JacobOscarGunnarsson
Copy link
Contributor

This file is also quite big meaning that there's probably a lot of tests that could be moved to separate files, I've decided to postpone it for now and focus more on just moving the tests

CHANGELOG.md Outdated Show resolved Hide resolved
@takameyer takameyer force-pushed the test-migration-master branch 2 times, most recently from fa6d1fc to cea05ef Compare February 10, 2023 09:49
@gagik gagik force-pushed the jg/session-master branch 2 times, most recently from a5f536f to 92dae35 Compare February 10, 2023 11:00
@JacobOscarGunnarsson
Copy link
Contributor Author

PR should now contain the correct modifications 🤞

integration-tests/tests/src/utils/sleep.ts Outdated Show resolved Hide resolved
Comment on lines 314 to 316
new Promise(() => {
sleep(5000, false);
}),
Copy link
Member

Choose a reason for hiding this comment

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

No need to wrap this in a promise constructor.
Also, since the callback body is neither awaiting nor returning the promise, this is effectively a promise that never resolves but calls sleep which might become an unhandled promise rejection.

Suggested change
new Promise(() => {
sleep(5000, false);
}),
sleep(5000, false),

integration-tests/tests/src/tests/sync/sync-session.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@takameyer takameyer left a comment

Choose a reason for hiding this comment

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

A few considerations. Once resolved, LGTM

integration-tests/tests/src/tests/sync/sync-session.ts Outdated Show resolved Hide resolved
integration-tests/tests/src/tests/sync/sync-session.ts Outdated Show resolved Hide resolved
integration-tests/tests/src/tests/sync/sync-session.ts Outdated Show resolved Hide resolved
integration-tests/tests/src/utils/sleep.ts Outdated Show resolved Hide resolved
Jacob Gunnarsson and others added 5 commits February 15, 2023 13:26
}

afterEach(async function (this: AppContext & ConversionTestContext) {
const configSrc = this.currentTest?.ctx?.configSrc;
Copy link
Contributor

@gagik gagik Feb 16, 2023

Choose a reason for hiding this comment

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

Not sure if there is a better way to retrieve this information / accomplish this cleanup... this seems like a rather ugly way to do so... but it does work.

@gagik gagik requested a review from takameyer February 16, 2023 11:33
@JacobOscarGunnarsson JacobOscarGunnarsson merged commit 9dd0f28 into test-migration-master Feb 17, 2023
@JacobOscarGunnarsson JacobOscarGunnarsson deleted the jg/session-master branch February 17, 2023 08:35
kraenhansen pushed a commit that referenced this pull request Feb 17, 2023
Co-authored-by: Gagik Amaryan <gagik@users.noreply.github.com>
Co-authored-by: gagik <me@gagik.co>
takameyer added a commit that referenced this pull request Feb 23, 2023
* Initial commit

* Documenting guidelines for testing & refactoring accordingly (#4584)

* Fixed types of openRealm

* Adding documentation on the hooks

* Apply suggestions from code review

* Test Migration: Alias tests (#4581)

* Migrate alias tests
* Refactor to follow new test guidelines
* Remove alias-tests from legacy test spec

* Add migration tests (#5285)

* Migrate set tests to integration tests  (#5290)

* Move list tests to ts (#5287)

* move app tests to typescript (#5297)

* remove mistakenly added duplicates of apps

* Test Migration: Results Tests (#5325)

* move mixed tests to integration tests (#5256)

* Move array-buffer tests to integration tests (#5255)

* use correct baseurl for tests (#5337)

* migrate dictionary tests to ts (#5254)

* move linking-objects tests to ts (#5268)

* Test Migration: User Tests (#5324)

* Test Migration: Queries test (#5299)

* Test Migration: Notification Tests (#5347)

* Add a debug launcher for integration tests

* Fix the mongo client tests for local baas

* fix queries test, make test errors more verbose

* Remove Chrome Debugger and fix package-lock problems (#5403)

* Pushed Chrome Debugger Removal with Lint errors (#5414)

* fix the errors

* Andrew/tests/fix-watch (#5412)

* Initial commit

* Fix watch for React Native

* Remove lock files

* Migrate object-tests to TS (#5348)

* test migration:  open-behaviour (#5365)

* test migration: mixed-sync-test (#5398)

* migrate encryption tests to TS (#5362)

* migrate sync-based UUID, Dictionary and Set tests (#5356)

* migrate realm tests to TS (#5352)

there are additions to other files as well such as bson.ts, that is because the old realm.js file had som tests that made more sense elsewhere, so I've moved such tests into other fields where I thought it made more sense

* migrate partition-values tests to TS (#5359)

* test migration: session tests (#5391)

* Fix issues with migrated integration tests, add select helper method. (#5429)

* Refactored the importApp hook

* Remove BSON as a dependency from tests

* Fixed import app hook 🤞

* Renamed "BackingDB" to "mongodb"

* Throw on app import errors

* Delete the app on failure to import

* Added bundled Realm to iOS app

* Updating Gemfile.lock after RN update

* Increase test timeouts

* fix remainder of failing integration tests (#5451)

* Cleanup tests and move test-runners into install-tests

* Small Fixes for Stability and Cleanup

* path tests now put realms in a testFiles folder which has been added to .gitignore
* path tests now delete the realms when finished
* increased the longTimeout to 30 seconds as some of the migrated tests can take this long
* added more `this.longTimeout` calls where appropriate
* added `mongodb-realm` directory to .gitignore, which contains app configuration when importing apps

* Delete dependants of `tests` and any unused files

* Andrew/app-importer/rules (#5478)

* Fix for applying the default rules to BaaS

* Remove any other rules and apply a general rule that allows everything
* Change the app importer to update the default rule

* Also fix it for realm-web

* Fix web tests and apply PR feedback

* Update docker image for BaaS in web tests

* `realm-web` importing http service fixed (#5483)

* Use the "default_rule" only for mongodb services

* Ensure download assisted_agg in baas test server

* Fix a broken test from upgrading baas
Comment on lines -560 to -583
testAddConnectionNotification() {
const partition = Utils.genPartition();
let app = new Realm.App(appConfig);
const credentials = Realm.Credentials.anonymous();
return app
.logIn(credentials)
.then((u) => {
let config = getSyncConfiguration(u, partition);
return Realm.open(config);
})
.then((realm) => {
return new Promise((resolve, reject) => {
realm.syncSession.addConnectionNotification((newState, oldState) => {
if (
oldState === Realm.App.Sync.ConnectionState.Connected &&
newState === Realm.App.Sync.ConnectionState.Disconnected
) {
resolve();
}
});
realm.close();
});
});
},
Copy link
Member

Choose a reason for hiding this comment

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

@JacobOscarGunnarsson this seems to be missing from the migrated tests.

Copy link
Member

Choose a reason for hiding this comment

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

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants