Skip to content

Commit

Permalink
fixed condition
Browse files Browse the repository at this point in the history
  • Loading branch information
MarinaProsche committed Mar 7, 2024
1 parent 2abbbc4 commit 6631156
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/selenium_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ jobs:
- name: Run docker-compose-tests
run: |
docker-compose -f docker-compose-tests.yml up
until docker-compose -f docker-compose-tests.yml logs selenium-tests | grep -q "Ran"; do
sleep 60
done
./tests/docker_check_tests.sh
- name: Tests results
run: |
echo docker-compose -f docker-compose-tests.yml logs selenium-tests
docker-compose -f docker-compose-tests.yml logs selenium-tests
if [ $(docker-compose -f docker-compose-tests.yml logs selenium-tests | grep -c "OK") -eq 1 ]; then
echo true
exit 0
Expand Down
13 changes: 13 additions & 0 deletions tests/docker_check_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# !/bin/bash

while true; do
test_end=$(docker-compose -f docker-compose-tests.yml logs selenium-tests | grep -q "Ran"; echo $?)

if [ "$test_end" -eq 0 ]; then
echo "test finished"
exit 0
else
sleep 60
fi
done

15 changes: 9 additions & 6 deletions tests/test_report_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def upload_report(self, report_ext):
report = report_ext
URL = self.getUrl('/upload')
self.getDriver().get(URL)
self.getDriver().implicitly_wait(240)
self.getDriver().implicitly_wait(480)
obj = self.getDriver().find_element(By.XPATH, "/html/body/div/div[2]/div/p/b")
if obj.text == 'BaseReportCriterionPack':
form_for_load = self.getDriver().find_element(By.CSS_SELECTOR, 'input[type=file]')
Expand All @@ -18,11 +18,14 @@ def upload_report(self, report_ext):
load_button.click()
obj = self.getDriver().find_element(By.XPATH, '/html/body/div/div[2]/h4/i')
if obj.text == 'Производится проверка файла. Примерное время: 229999.1 секунд (перезагрузите страницу)':
# while
time.sleep(120) #loading need much time because of language.tool
self.getDriver().refresh()
# self.getDriver().implicitly_wait(30)
obj = self.getDriver().find_element(By.ID, 'results_table')
start_time = time.time()
max_time = 240
while time.time() - start_time < max_time:
time.sleep(10)
self.getDriver().refresh()
obj = self.getDriver().find_element(By.ID, 'results_table')
if obj is not None:
break
self.assertNotEquals(obj, None)
else:
self.fail("file didn't upload")
Expand Down
4 changes: 2 additions & 2 deletions tests/test_single_card_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ class SingleCheckTestSelenium(BasicSeleniumTest):

def test_open_check_card(self):
self.authorization()
self.getDriver().implicitly_wait(240)
# time.sleep(10)
time.sleep(10)
URL = self.getUrl('/check_list')
self.getDriver().get(URL)
self.getDriver().implicitly_wait(240)
single_check = self.getDriver().find_element(By.XPATH, "//table[@id='check-list-table']//tr/td/a")
id_check_button = single_check.get_attribute("href").split("/")[-1]
URL = self.getUrl(f'/results/{id_check_button}')
Expand Down

0 comments on commit 6631156

Please sign in to comment.