def before_scenario(context, scenario): database_setup(context) if "uses_video_with_subtitles" in context.tags: _make_video(context) if "registered_device" in context.tags: do_fake_registration() if os.environ.get("TRAVIS", False): # Indicates we're running on remote build server setup_sauce_browser(context) else: setup_local_browser(context) context.logged_in = False # A superuser now needs to exist or UI is blocked by a modal. # https://github.com/learningequality/ka-lite/pull/3668 if not User.objects.filter(is_superuser=True).exists(): assert User.objects.create_superuser( username='******', password='******', email='*****@*****.**' ), "Didn't create an admin user" if "as_admin" in context.tags: context.logged_in = True login_as_admin(context) elif "as_coach" in context.tags: context.logged_in = True login_as_coach(context) elif "as_learner" in context.tags: context.logged_in = True login_as_learner(context)
def before_scenario(context, scenario): database_setup(context) if "registered_device" in context.tags: do_fake_registration() if os.environ.get("TRAVIS", False): # Indicates we're running on remote build server setup_sauce_browser(context) else: setup_local_browser(context) context.logged_in = False # A superuser now needs to exist or UI is blocked by a modal. # https://github.com/learningequality/ka-lite/pull/3668 if not User.objects.filter(is_superuser=True).exists(): assert User.objects.create_superuser( username='******', password='******', email='*****@*****.**'), "Didn't create an admin user" if "as_admin" in context.tags: context.logged_in = True login_as_admin(context) elif "as_coach" in context.tags: context.logged_in = True login_as_coach(context) elif "as_learner" in context.tags: context.logged_in = True login_as_learner(context)
def before_feature(context, feature): browser = context.browser = webdriver.Firefox() # ensure the window is reasonably sized. browser.set_window_size(2560, 1920) context.logged_in = False # A superuser now needs to exist or UI is blocked by a modal. # https://github.com/learningequality/ka-lite/pull/3668 if not User.objects.exists(): User.objects.create_superuser(username='******', password='******', email='*****@*****.**') if "as_admin" in feature.tags: context.logged_in = True login_as_admin(context) elif "as_coach" in feature.tags: context.logged_in = True login_as_coach(context) elif "as_learner" in feature.tags: context.logged_in = True login_as_learner(context)
def step_impl(context): login_as_coach(context)