def check_offline_delete()

in issues/288/user_tool.py [0:0]


def check_offline_delete(page: Page):

    workspace_chat = page.locator('button[aria-label="Navigates to a chat"]').nth(1)
    expect(workspace_chat).to_be_visible()
    workspace_chat.click()
    page.wait_for_timeout(1000)

    composer = page.locator('div[aria-placeholder="Write something..."]').nth(1)
    composer.fill("hello")
    page.wait_for_timeout(1000)

    send_button = page.locator('button[aria-label="Send"]').nth(1)
    expect(send_button).to_be_visible()
    send_button.click()
    page.wait_for_timeout(1000)

    span_element = page.locator('span:has-text("hello")')
    span_element.click(button="right")
    page.wait_for_timeout(1000)

    reply_in_thread = page.locator('div[aria-label="Reply in thread"]')
    expect(reply_in_thread).to_be_visible()
    reply_in_thread.click()
    page.wait_for_timeout(1000)

    composer = page.locator('div[aria-placeholder="Write something..."]').nth(2)
    composer.fill("reply")
    page.wait_for_timeout(1000)

    send_button = page.locator('button[aria-label="Send"]').nth(2)
    expect(send_button).to_be_visible()
    send_button.click()
    page.wait_for_timeout(1000)

    workspace_chat = page.locator('button[aria-label="Navigates to a chat"]').nth(1)
    expect(workspace_chat).to_be_visible()
    workspace_chat.click()
    page.wait_for_timeout(1000)

    composer = page.locator('div[aria-placeholder="Write something..."]').nth(2)
    composer.fill("reply2")
    page.wait_for_timeout(1000)

    send_button = page.locator('button[aria-label="Send"]').nth(2)
    expect(send_button).to_be_visible()
    send_button.click()
    page.wait_for_timeout(1000)

    my_settings = page.locator('button[aria-label="My settings"]')
    expect(my_settings).to_be_visible()
    my_settings.click()
    page.wait_for_timeout(1000)

    trouble = page.locator('div[aria-label="Troubleshoot"]')
    expect(trouble).to_be_visible()
    trouble.click()
    page.wait_for_timeout(1000)

    button_off = page.locator('button[aria-label="Force offline"]').click()
    page.wait_for_timeout(1000)

    inbox = page.locator('button[aria-label="Inbox"]').click()
    page.wait_for_timeout(1000)

    workspace_chat = page.locator('button[aria-label="Navigates to a chat"]').nth(1)
    expect(workspace_chat).to_be_visible()
    workspace_chat.click()
    page.wait_for_timeout(1000)

    span_element = page.locator('span:has-text("hello")')
    span_element.click(button="right")
    page.wait_for_timeout(1000)

    reply_in_thread = page.locator('div[aria-label="Delete comment"]')
    expect(reply_in_thread).to_be_visible()
    reply_in_thread.click()
    page.wait_for_timeout(1000)

    delete = page.locator('button:has-text("Delete")')
    expect(delete).to_be_visible()
    delete.click()
    page.wait_for_timeout(1000)

    span_element = page.locator('span:has-text("reply2")')
    span_element.click(button="right")
    page.wait_for_timeout(1000)

    reply_in_thread = page.locator('div[aria-label="Delete comment"]')
    expect(reply_in_thread).to_be_visible()
    reply_in_thread.click()
    page.wait_for_timeout(1000)

    delete = page.locator('button:has-text("Delete")').nth(1)
    expect(delete).to_be_visible()
    delete.click()
    page.wait_for_timeout(1000)

    locator = page.locator('div:nth-child(4) > div:nth-child(2) > div:nth-child(2) > div > div > div > div > div > div > div > div > div:nth-child(3) > div > div:nth-child(2) > div > div > div:nth-child(3) > div > div > div > div:nth-child(2) > div > div > div')
    locator.click(timeout=1000)
    deleted_message_button = page.locator('button[aria-label="[Deleted message]"]')

    assert deleted_message_button.is_visible(), "The deleted message button should be visible"