diff --git a/test/behave/features/nextcloud.feature b/test/behave/features/nextcloud.feature index e1d77c0f259a18a87d7552143c8475caf582a03d..0c63fdfba4e69b455c20ca543e545ae778d3993d 100644 --- a/test/behave/features/nextcloud.feature +++ b/test/behave/features/nextcloud.feature @@ -32,7 +32,7 @@ Scenario: Create a new document in OnlyOffice When I click on the element "[aria-label='Files']" # Unfortunaty there's no check if the element that's already visible # is also clickable. - And I pause for 5000ms + And I wait on element "[class='button new']" to be clickable And I click on the button "[class='button new']" And I click on the element "[data-action='onlyofficeDocx']" And I add a random string to the inputfield ".filenameform input[type=text]" @@ -40,4 +40,14 @@ Scenario: Create a new document in OnlyOffice And I focus the last opened tab Then I expect a new tab has been opened And I expect that element "div.toast-error" does not exist - And I wait on element "iframe[name='frameEditor']" for 20000ms to be visible + +Scenario: Assert the bold button is not activated + When I wait for the iframe named "frameEditor" and switch to it + Then I wait on element "div.asc-loadmask" for 20000ms to be visible + And I wait on element "div.asc-loadmask" for 20000ms to not exist + And I wait on element "[id='id-toolbar-btn-bold']" for 20000ms to be visible + And I expect that element "[id='id-toolbar-btn-bold']" does not have the class "active" + +Scenario: Active the bold button + When I click on the element "[id='id-toolbar-btn-bold']" + Then I expect that element "[id='id-toolbar-btn-bold']" has the class "active" diff --git a/test/behave/features/steps/steps.py b/test/behave/features/steps/steps.py index f65e96ff80ac3874df92cd7bca59cbafafa1e1b6..6d82a58205b38ac1870dffd8047c2c9df4abac1b 100644 --- a/test/behave/features/steps/steps.py +++ b/test/behave/features/steps/steps.py @@ -1,5 +1,7 @@ from oas_behave.common_steps import * - +from selenium.webdriver.common.by import By +from selenium.webdriver.support import expected_conditions as EC +from selenium.webdriver.support.ui import WebDriverWait @when(u'I open the rocketchat URL') @given(u'I open the rocketchat URL') @@ -21,3 +23,16 @@ def step_impl(context): print(eventrouter_url) context.behave_driver.get(eventrouter_url) +@when(u'I wait on element "{element}" to be clickable') +@given(u'I wait on element "{element}" to be clickable') +def step_impl(context, element): + """Wait for element ro be clickable.""" + wait = WebDriverWait(context.behave_driver, 30) + wait.until(EC.element_to_be_clickable((By.CLASS_NAME, "button.new"))) + +@when(u'I wait for the iframe named "{name}" and switch to it') +@given(u'I wait for the iframe named "{name}" and switch to it') +def step_impl(context, name): + """Wait for the iframe with given name and switch to it.""" + wait = WebDriverWait(context.behave_driver, 30) + wait.until(EC.frame_to_be_available_and_switch_to_it((By.NAME, name)))