def test_invalid_colid_error_preview(selenium, base_url):
    # GIVEN: Selenium driver and the base url

    # WHEN: The Home page is fully loaded
    home = Home(selenium, base_url).open()

    # AND: The create a new job button is clicked
    modal = home.click_create_new_job_button()

    # AND: Clicks the Web Preview button
    modal.click_web_preview_radio_button()

    # AND: Incorrect collection id is typed into the collection id field
    modal.fill_collection_id_field("1col11229")

    # AND: Create button is clicked
    modal.click_create_button()

    split_col_id_incorrect = modal.collection_id_incorrect_field_error.text.splitlines(
    )
    text_col_id_incorrect = split_col_id_incorrect[1]

    # THEN: Correct error message appears in collection id field
    assert "A valid collection ID is required, e.g. col12345" == text_col_id_incorrect

    split_style = modal.style_field_error.text.splitlines()
    text_style = split_style[1]
    assert "Style is required" == text_style

    split_server = modal.content_server_field_error.text.splitlines()
    text_server = split_server[1]
    assert "Please select a server" == text_server

    # THEN: The modal does not close and remains open
    assert home.create_job_modal_is_open

    # WHEN: modal is open and collection id has incorrect colid/slug
    # AND: Web preview (git) button is clicked
    modal.click_web_preview_git_radio_button()

    # AND: Create button is clicked when data fields are empty and collection ID field has incorrect colid
    modal.click_create_button()

    split_col_id_slug_incorrect = (
        modal.collection_id_slug_incorrect_field_error.text.splitlines())
    text_col_id_slug_incorrect = split_col_id_slug_incorrect[1]

    # THEN: Correct error message appears in collection id and style field
    assert ("A valid repo and slug name is required, e.g. repo-name/slug-name"
            == text_col_id_slug_incorrect)

    split_style = modal.style_field_error.text.splitlines()
    text_style = split_style[1]
    assert "Style is required" == text_style

    # THEN: No error message appears for Content Server as it is disabled for web preview git
    split_server = modal.content_server_field_error.text.splitlines()
    assert "Please select a server" not in split_server
示例#2
0
def test_create_new_job_modal_form_opens_and_closes(selenium, base_url):
    # GIVEN: Selenium driver and the base url

    # WHEN: The Home page is fully loaded
    # AND: The create a new job button is clicked
    home = Home(selenium, base_url).open()
    modal = home.click_create_new_job_button()

    # THEN: The create a new job modal opens
    # AND:  The modal closes when cancel is clicked
    assert home.create_job_modal_is_open

    modal.click_cancel_button()
    assert not home.create_job_modal_is_open
def test_empty_modal_field_errors_preview(selenium, base_url):
    # GIVEN: Selenium driver and the base url

    # WHEN: The Home page is fully loaded
    home = Home(selenium, base_url).open()

    # AND: The create a new job button is clicked
    modal = home.click_create_new_job_button()

    # AND: Web preview button is clicked
    modal.click_web_preview_radio_button()

    # AND: Create button is clicked when data fields are empty
    modal.click_create_button()

    # THEN: The correct error messages are shown for each applicable
    # input field (colid, style and server)
    split_col_id = modal.collection_id_field_error.text.splitlines()
    text_col_id = split_col_id[1]
    assert "Collection ID is required" == text_col_id

    split_style = modal.style_field_error.text.splitlines()
    text_style = split_style[1]
    assert "Style is required" == text_style

    split_server = modal.content_server_field_error.text.splitlines()
    text_server = split_server[1]
    assert "Please select a server" == text_server

    # AND: The modal does not close and remains open
    assert home.create_job_modal_is_open

    # AND: Web preview (git) button is clicked
    modal.click_web_preview_git_radio_button()

    # AND: Create button is clicked when data fields are empty
    modal.click_create_button()

    # THEN: The correct error messages are shown for each applicable
    # input field (colid and style)
    split_col_id_slug = modal.collection_id_slug_field_error.text.splitlines()
    text_col_id_slug = split_col_id_slug[1]
    assert "Repo and slug are required" == text_col_id_slug

    split_style = modal.style_field_error.text.splitlines()
    text_style = split_style[1]
    assert "Style is required" == text_style
def test_e2e_pdf_jobs(selenium, base_url):
    # GIVEN: Selenium driver and the base url

    # WHEN: The Home page is fully loaded
    home = Home(selenium, base_url).open()

    # AND: The 'create a new job' button is clicked
    modal = home.click_create_new_job_button()

    # AND: PDF radio button is automatically selected and correct data are typed into the input fields
    modal.fill_collection_id_field("col11992")
    modal.fill_version_field("1.9")
    modal.fill_style_field("astronomy")
    modal.fill_server_field("qa")

    # AND: Create button is clicked
    modal.click_create_button()

    # THEN: The modal closes and job is queued
    assert home.is_create_new_job_button_displayed
    assert modal.status_message.text == "queued"
示例#5
0
def test_e2e_web_preview_git(selenium, base_url):
    # GIVEN: Selenium driver and the base url

    # WHEN: The Home page is fully loaded
    home = Home(selenium, base_url).open()

    # AND: The 'create a new job' button is clicked
    modal = home.click_create_new_job_button()

    # AND: Clicks the PDF(git) preview button
    modal.click_web_preview_git_radio_button()

    # AND: Correct data are typed into the input fields
    modal.fill_collection_id_field("ce-git-storage-spike/precalculus")
    modal.fill_version_field("")
    modal.fill_style_field("precalculus")

    # AND: Create button is clicked
    modal.click_create_button()

    # THEN: The modal closes and job is queued
    assert home.is_create_new_job_button_displayed
    assert modal.status_message.text == "queued"