Add comments for scroll offsets

[MAILPOET-2544]
This commit is contained in:
Rostislav Wolny
2019-11-26 10:47:52 +01:00
committed by Pavel Dohnal
parent 158a914ff0
commit 56c0eb8cba
2 changed files with 6 additions and 3 deletions

View File

@@ -342,7 +342,9 @@ class AcceptanceTester extends \Codeception\Actor { // phpcs:ignore PSR1.Classes
*/
public function selectPaymentMethod($method = 'cod') {
$I = $this;
$I->scrollTo('#payment_method_' . $method, 0, -40);
// We need to scroll with some negative offset so that the input is not hidden above the top page fold
$approximate_payment_method_input_height = 40;
$I->scrollTo('#payment_method_' . $method, 0, -$approximate_payment_method_input_height);
$I->waitForElementNotVisible('.blockOverlay', 30); // wait for payment method loading overlay to disappear
$I->click('#payment_method_' . $method);
}

View File

@@ -45,15 +45,16 @@ class ManageSubscriptionLinkCest {
$form_status_element = '[data-automation-id="form_status"]';
// set status to unsubscribed
$approximate_save_button_height = 50; // Used for scroll offset to ensure that button is not hidden above the top fold
$I->selectOption($form_status_element, 'Unsubscribed');
$I->scrollTo('[data-automation-id="subscribe-submit-button"]', 0, -50);
$I->scrollTo('[data-automation-id="subscribe-submit-button"]', 0, -$approximate_save_button_height);
$I->click('Save');
$I->waitForElement($form_status_element);
$I->seeOptionIsSelected($form_status_element, 'Unsubscribed');
// change status back to subscribed
$I->selectOption($form_status_element, 'Subscribed');
$I->scrollTo('[data-automation-id="subscribe-submit-button"]', 0, -50);
$I->scrollTo('[data-automation-id="subscribe-submit-button"]', 0, -$approximate_save_button_height);
$I->click('Save');
$I->waitForElement($form_status_element);
$I->seeOptionIsSelected($form_status_element, 'Subscribed');