def initialize_admin_browser_test(browser, live_server, settings, username="******", password="******", onboarding=False, language="en", shop=None, tour_complete=True): if not onboarding: settings.SHUUP_SETUP_WIZARD_PANE_SPEC = [] activate("en") cache.clear() shop = shop or get_default_shop() if tour_complete: from django.contrib.auth import get_user_model user = get_user_model().objects.get(username=username) set_tour_complete(shop, "dashboard", True, user) set_tour_complete(shop, "home", True, user) set_tour_complete(shop, "product", True, user) set_tour_complete(shop, "category", True, user) url = live_server + "/sa" browser.visit(url) browser.fill('username', username) browser.fill('password', password) browser.find_by_css(".btn.btn-primary.btn-lg.btn-block").first.click() if not onboarding: # set shop language to eng browser.find_by_id("dropdownMenu").click() browser.find_by_xpath('//a[@data-value="%s"]' % language).first.click() return browser
def initialize_admin_browser_test( browser, live_server, settings, username="******", password="******", onboarding=False, language="en", shop=None, tour_complete=True, ): if not onboarding: settings.SHUUP_SETUP_WIZARD_PANE_SPEC = [] activate(language) cache.clear() shop = shop or get_default_shop() if tour_complete: from django.contrib.auth import get_user_model user = get_user_model().objects.get(username=username) set_tour_complete(shop, "dashboard", True, user) set_tour_complete(shop, "home", True, user) set_tour_complete(shop, "product", True, user) set_tour_complete(shop, "category", True, user) url = live_server + "/sa" browser.visit(url) browser.fill("username", username) browser.fill("password", password) browser.find_by_css(".btn.btn-primary.btn-lg.btn-block").first.click() if not onboarding: wait_until_condition(browser, lambda x: x.find_by_id("dropdownMenu")) # set shop language to eng browser.find_by_id("dropdownMenu").click() browser.find_by_xpath('//a[@data-value="%s"]' % language).first.click() return browser
def post(self, request, *args, **kwargs): tour_key = request.POST.get("tourKey", "") set_tour_complete(get_shop(request), tour_key, True, request.user) return JsonResponse({"success": True})
def post(self, request, *args, **kwargs): tour_key = request.POST.get("tourKey", "") set_tour_complete(get_shop(request), tour_key, True, request.user) return JsonResponse({"success": True})