Skip to content

Commit

Permalink
Fixed small selenium tests instability (#3663)
Browse files Browse the repository at this point in the history
* Fixed small selenium tests instability

* black
  • Loading branch information
szymon-kellton authored Mar 4, 2024
1 parent 23a1884 commit bd81467
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ def test_create_programme(
pageProgrammeManagement.chooseOptionSelector(test_data["selector"])
pageProgrammeManagement.chooseOptionDataCollectingType(test_data["dataCollectingType"])
pageProgrammeManagement.getButtonNext().click()
programme_creation_url = pageProgrammeManagement.driver.current_url
pageProgrammeManagement.getButtonSave().click()
# Check Details page
assert "details" in pageProgrammeDetails.wait_for_new_url(programme_creation_url).split("/")
assert "New Programme" in pageProgrammeDetails.getHeaderTitle().text
assert "DRAFT" in pageProgrammeDetails.getProgramStatus().text
assert test_data["startDate"].date_in_text_format in pageProgrammeDetails.getLabelStartDate().text
Expand Down Expand Up @@ -115,8 +117,10 @@ def test_create_programme_optional_values(
pageProgrammeManagement.getInputPopulation().clear()
pageProgrammeManagement.getInputPopulation().send_keys(test_data["populationGoals"])
pageProgrammeManagement.getButtonNext().click()
programme_creation_url = pageProgrammeManagement.driver.current_url
pageProgrammeManagement.getButtonSave().click()
# Check Details page
assert "details" in pageProgrammeDetails.wait_for_new_url(programme_creation_url).split("/")
assert "New Programme" in pageProgrammeDetails.getHeaderTitle().text
assert "DRAFT" in pageProgrammeDetails.getProgramStatus().text
assert test_data["startDate"].date_in_text_format in pageProgrammeDetails.getLabelStartDate().text
Expand Down Expand Up @@ -245,8 +249,10 @@ def test_create_programme_check(
pageProgrammeManagement.chooseOptionDataCollectingType(test_data["dataCollectingType"])
pageProgrammeManagement.getInputCashPlus().click()
pageProgrammeManagement.getButtonNext().click()
programme_creation_url = pageProgrammeManagement.driver.current_url
pageProgrammeManagement.getButtonSave().click()
# Check Details page
assert "details" in pageProgrammeDetails.wait_for_new_url(programme_creation_url).split("/")
assert "DRAFT" in pageProgrammeDetails.getProgramStatus().text
assert test_data["startDate"].date_in_text_format in pageProgrammeDetails.getLabelStartDate().text
assert test_data["endDate"].date_in_text_format in pageProgrammeDetails.getLabelEndDate().text
Expand Down Expand Up @@ -363,8 +369,12 @@ def test_create_programme_add_partners_Business_Area(
pageProgrammeManagement.getButtonNext().click()
pageProgrammeManagement.getButtonAddPartner().click()
pageProgrammeManagement.choosePartnerOption("UNHCR")
programme_creation_url = pageProgrammeManagement.driver.current_url
pageProgrammeManagement.getButtonSave().click()
# Check Details page
assert "details" in pageProgrammeDetails.wait_for_new_url(programme_creation_url).split(
"/"
) # Check Details page
assert "UNHCR" in pageProgrammeDetails.getLabelPartnerName().text
assert "Business Area" in pageProgrammeDetails.getLabelAreaAccess().text

Expand Down Expand Up @@ -412,8 +422,10 @@ def test_create_programme_add_partners_Admin_Area(
from time import sleep

sleep(1)
programme_creation_url = pageProgrammeManagement.driver.current_url
pageProgrammeManagement.getButtonSave().click()
# Check Details page
assert "details" in pageProgrammeDetails.wait_for_new_url(programme_creation_url).split("/")
assert "UNHCR" in pageProgrammeDetails.getLabelPartnerName().text
assert "16" in pageProgrammeDetails.getLabelAreaAccess().text

Expand Down Expand Up @@ -462,8 +474,10 @@ def test_create_programme_back_scenarios(
assert "Programme name is required" in pageProgrammeManagement.getLabelProgrammeName().text
pageProgrammeManagement.getInputProgrammeName().send_keys(test_data["program_name"])
pageProgrammeManagement.getButtonNext().click()
programme_creation_url = pageProgrammeManagement.driver.current_url
pageProgrammeManagement.getButtonSave().click()
# Check Details page
assert "details" in pageProgrammeDetails.wait_for_new_url(programme_creation_url).split("/")
assert "New Programme" in pageProgrammeDetails.getHeaderTitle().text
assert "DRAFT" in pageProgrammeDetails.getProgramStatus().text
assert test_data["startDate"].date_in_text_format in pageProgrammeDetails.getLabelStartDate().text
Expand Down Expand Up @@ -505,8 +519,10 @@ def test_create_programme_chose_dates_via_calendar(
pageProgrammeManagement.chooseOptionSelector(test_data["selector"])
pageProgrammeManagement.chooseOptionDataCollectingType(test_data["dataCollectingType"])
pageProgrammeManagement.getButtonNext().click()
programme_creation_url = pageProgrammeManagement.driver.current_url
pageProgrammeManagement.getButtonSave().click()
# Check Details page
assert "details" in pageProgrammeDetails.wait_for_new_url(programme_creation_url).split("/")
assert str(datetime.now().strftime("15 %b %Y")) in pageProgrammeDetails.getLabelStartDate().text
end_date = datetime.now() + relativedelta(months=1)
assert str(end_date.strftime("25 %b %Y")) in pageProgrammeDetails.getLabelEndDate().text

0 comments on commit bd81467

Please sign in to comment.