<commit_before>#!/usr/bin/env python

from selenium.webdriver import Chrome
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support.expected_conditions import staleness_of, title_is, presence_of_element_located
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By

options = Options()
options.headless = True
options.add_argument('ignore-certificate-errors')
browser = Chrome(options=options)
wait = WebDriverWait(browser, timeout=2)

start = 'https://sbs.scz-vm.net/landing'
profile = 'https://sbs.scz-vm.net/profile'

try:
    # Start browser
    browser.get(start)

    # Wait for SBS to load
    wait.until(title_is('Research Access Management'), 'Timeout waiting for landing page')

    # Click login
    login = browser.find_element(By.XPATH, "//a[@href='/Login' and text()='Login']")
    login.click()

    # Wait for login button to disappear
    wait.until(staleness_of(login), 'Timeout waiting for login page')

    # Login as admin
    browser.find_element(By.ID, 'username').send_keys('admin')
    browser.find_element(By.ID, 'password').send_keys('<PASSWORD>')
    browser.find_element(By.TAG_NAME, 'form').submit()

    # Wait for user profile to appear
    wait.until(presence_of_element_located((By.XPATH, "//label[@for='aup']")), 'Timeout waiting for AUP')

    browser.find_element(By.XPATH, "//div[@class='checkbox']").click()
    browser.find_element(By.XPATH, "//a[text()='Looks good, onwards']").click()

    # Wait for landing page
    wait.until(presence_of_element_located((By.XPATH, "//div[@class='drop-down ugly']")), 'Timeout waiting for Welcome')

    # Visit Profile
    browser.get(profile)<commit_msg>Add healthcheck before login-test<commit_after>#!/usr/bin/env python

import json
from selenium.webdriver import Chrome
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support.expected_conditions import staleness_of, title_is, presence_of_element_located
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By

options = Options()
options.headless = True
options.add_argument('ignore-certificate-errors')
browser = Chrome(options=options)
wait = WebDriverWait(browser, timeout=2)

health = 'https://sbs.scz-vm.net/landing'
start = 'https://sbs.scz-vm.net/landing'
profile = 'https://sbs.scz-vm.net/profile'

try:
    # Wait for status UP
    status = ""
    while status != "UP":
        browser.get(health)
        state = json.loads(browser.page_source)
        status = state.get("status")

    # Wait for SBS health up
    wait.until(title_is('Research Access Management'), 'Timeout waiting for landing page')

    browser.get(start)
    # Wait for SBS to load
    wait.until(title_is('Research Access Management'), 'Timeout waiting for landing page')

    # Click login
    login = browser.find_element(By.XPATH, "//a[@href='/Login' and text()='Login']")
    login.click()

    # Wait for login button to disappear
    wait.until(staleness_of(login), 'Timeout waiting for login page')

    # Login as admin
    browser.find_element(By.ID, 'username').send_keys('admin')
    browser.find_element(By.ID, 'password').send_keys('<PASSWORD>')
    browser.find_element(By.TAG_NAME, 'form').submit()

    # Wait for user profile to appear
    wait.until(presence_of_element_located((By.XPATH, "//label[@for='aup']")), 'Timeout waiting for AUP')

    browser.find_element(By.XPATH, "//div[@class='checkbox']").click()
    browser.find_element(By.XPATH, "//a[text()='Looks good, onwards']").click()

    # Wait for landing page
    wait.until(presence_of_element_located((By.XPATH, "//div[@class='drop-down ugly']")), 'Timeout waiting for Welcome')

    # Visit Profile
    browser.get(profile)
{'fraction_non_alphanumeric': 0.13609618828344847, 'fraction_numerical': 0.0005116398055768739, 'mean_word_length': 4.6017191977077365, 'pattern_counts': {'":': 1, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5860334', 'n_tokens_mistral': 1246, 'n_tokens_neox': 1187, 'n_words': 270}