From 8610b6ded6a2f7b64a303f5ff8b8f608df9e4282 Mon Sep 17 00:00:00 2001 From: Ben Patterson Date: Sat, 21 Nov 2015 10:41:58 -0500 Subject: [PATCH 1/2] Events bok-choy multiprocessing support. Stop clearing the entire mongo collection with every mixin instantiation. Instead, reset the clock for the particular test. With this approach, filters must be stricter, for example, according to username or user id. --- common/test/acceptance/tests/helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/test/acceptance/tests/helpers.py b/common/test/acceptance/tests/helpers.py index 12c4baa736..ce60f6dbd9 100644 --- a/common/test/acceptance/tests/helpers.py +++ b/common/test/acceptance/tests/helpers.py @@ -351,7 +351,7 @@ class EventsTestMixin(TestCase): def setUp(self): super(EventsTestMixin, self).setUp() self.event_collection = MongoClient()["test"]["events"] - self.reset_event_tracking() + self.start_time = datetime.now() def reset_event_tracking(self): """Drop any events that have been collected thus far and start collecting again from scratch.""" From 0071c9d322bff3fecf503c50bfc03fe9961905d7 Mon Sep 17 00:00:00 2001 From: Ben Patterson Date: Sat, 21 Nov 2015 10:43:07 -0500 Subject: [PATCH 2/2] OwnLearnerProfile tests multiprocessing support. Fix a flaky test condition that only occurs in multiprocessing mode. Make the page definition more specific; the previous implementation would not fully render all objects in time. Avoid race condition related to events order (in faster, multiprocess testing, the order is not exactly the same since some events arrive at once). --- common/test/acceptance/pages/lms/learner_profile.py | 2 +- common/test/acceptance/tests/lms/test_teams.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/common/test/acceptance/pages/lms/learner_profile.py b/common/test/acceptance/pages/lms/learner_profile.py index 8fcfa43c76..f71562de3a 100644 --- a/common/test/acceptance/pages/lms/learner_profile.py +++ b/common/test/acceptance/pages/lms/learner_profile.py @@ -43,7 +43,7 @@ class LearnerProfilePage(FieldsMixin, PageObject): """ Check if browser is showing correct page. """ - return self.q(css='body.view-profile').present + return self.q(css='body.view-profile .account-settings-container').present @property def privacy(self): diff --git a/common/test/acceptance/tests/lms/test_teams.py b/common/test/acceptance/tests/lms/test_teams.py index 08b96e9c0b..d6edfffa00 100644 --- a/common/test/acceptance/tests/lms/test_teams.py +++ b/common/test/acceptance/tests/lms/test_teams.py @@ -1381,7 +1381,11 @@ class EditTeamTest(TeamFormActions): } }, ] - with self.assert_events_match_during(event_filter=self.only_team_events, expected_events=expected_events): + with self.assert_events_match_during( + event_filter=self.only_team_events, + expected_events=expected_events, + in_order=False, + ): self.team_management_page.submit_form() self.team_page.wait_for_page()