Fixed purge test #139
This commit is contained in:
		| @@ -1 +0,0 @@ | ||||
| # imports | ||||
| @@ -10,4 +10,4 @@ class CommandSelectorsEnum(Enum): | ||||
|     info = '/html/body/div[1]/div[2]/div/div[1]/div/div[2]/div/div[1]/div/div/div[3]/div[2]/main/form/div/div[2]/div/div/div[5]/div' | ||||
|     help = '/html/body/div[1]/div[2]/div/div[1]/div/div[2]/div/div[1]/div/div/div[3]/div[2]/main/form/div/div[2]/div/div/div[5]/div' | ||||
|     afk = '/html/body/div[1]/div[2]/div/div[1]/div/div[2]/div/div[1]/div/div/div[3]/div[2]/main/form/div/div[2]/div/div/div[2]/div' | ||||
|     purge = '/html/body/div[1]/div[2]/div/div[1]/div/div[2]/div/div[1]/div/div/div[3]/div[2]/main/form/div/div[2]/div/div/div[5]/div' | ||||
|     purge = '/html/body/div[1]/div[2]/div/div[1]/div/div[2]/div/div[1]/div/div/div[3]/div[2]/main/form/div/div[2]/div/div/div[3]/div' | ||||
| @@ -10,7 +10,7 @@ from selenium.webdriver.remote.webelement import WebElement | ||||
| from selenium.webdriver.support import expected_conditions | ||||
| from selenium.webdriver.support.wait import WebDriverWait | ||||
|  | ||||
| from ui_tests.src.ui_tests_shared.command_selectors_enum import CommandSelectorsEnum | ||||
| from ui_tests_shared.command_selectors_enum import CommandSelectorsEnum | ||||
| from ui_tests_shared.test_case_with_app import TestCaseWithApp | ||||
| from ui_tests_shared.ui import UI | ||||
|  | ||||
|   | ||||
| @@ -1,10 +1,7 @@ | ||||
| import time | ||||
|  | ||||
| import discord | ||||
| from discord import VoiceState | ||||
| from selenium.webdriver.common.by import By | ||||
|  | ||||
| from ui_tests.src.ui_tests_shared.command_selectors_enum import CommandSelectorsEnum | ||||
| from ui_tests_shared.command_selectors_enum import CommandSelectorsEnum | ||||
| from ui_tests_shared.command_test_case_with_app import CommandTestCaseWithApp | ||||
| from ui_tests_shared.decorators import Async | ||||
| from ui_tests_shared.ui import UI | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| import discord | ||||
|  | ||||
| from ui_tests.src.ui_tests_shared.command_selectors_enum import CommandSelectorsEnum | ||||
| from ui_tests_shared.command_selectors_enum import CommandSelectorsEnum | ||||
| from ui_tests_shared.command_test_case_with_app import CommandTestCaseWithApp | ||||
| from ui_tests_shared.decorators import Async | ||||
|  | ||||
|   | ||||
| @@ -3,7 +3,7 @@ import discord | ||||
|  | ||||
| import bot | ||||
| from bot_core.abc.client_utils_service_abc import ClientUtilsServiceABC | ||||
| from ui_tests.src.ui_tests_shared.command_selectors_enum import CommandSelectorsEnum | ||||
| from ui_tests_shared.command_selectors_enum import CommandSelectorsEnum | ||||
| from ui_tests_shared.command_test_case_with_app import CommandTestCaseWithApp | ||||
| from ui_tests_shared.decorators import Async | ||||
|  | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| import discord | ||||
|  | ||||
| from ui_tests.src.ui_tests_shared.command_selectors_enum import CommandSelectorsEnum | ||||
| from ui_tests_shared.command_selectors_enum import CommandSelectorsEnum | ||||
| from ui_tests_shared.command_test_case_with_app import CommandTestCaseWithApp | ||||
| from ui_tests_shared.decorators import Async | ||||
|  | ||||
|   | ||||
| @@ -1,9 +1,8 @@ | ||||
| import asyncio | ||||
| import time | ||||
|  | ||||
| import discord | ||||
|  | ||||
| from ui_tests.src.ui_tests_shared.command_selectors_enum import CommandSelectorsEnum | ||||
| from ui_tests_shared.command_selectors_enum import CommandSelectorsEnum | ||||
| from ui_tests_shared.command_test_case_with_app import CommandTestCaseWithApp | ||||
| from ui_tests_shared.decorators import Async | ||||
|  | ||||
| @@ -16,7 +15,8 @@ class PurgeCommandTestCase(CommandTestCaseWithApp): | ||||
|         self.send_message('test nachricht 3') | ||||
|         self.send_message('test nachricht 4') | ||||
|  | ||||
|     def test_purge(self): | ||||
|     @Async.async_func | ||||
|     async def test_purge(self): | ||||
|         correct_response = self._t.transform('modules.moderator.purge_message') | ||||
|         self.assertIsNotNone(correct_response) | ||||
|         self.send_command('purge', CommandSelectorsEnum.purge) | ||||
| @@ -24,8 +24,11 @@ class PurgeCommandTestCase(CommandTestCaseWithApp): | ||||
|         def check(m: discord.Message): | ||||
|             return m.content == correct_response and m.author.id == self._test_settings.bot_id | ||||
|  | ||||
|         response = asyncio.run(self._bot.wait_for('message', check=check)) | ||||
|         response = await self._bot.wait_for('message', check=check) | ||||
|         self.assertEqual(response.content, correct_response) | ||||
|         time.sleep(20) | ||||
|         channel = self._bot.get_channel(911578680998895687) | ||||
|         self.assertEqual(channel.message_count, 0) | ||||
|         message_count = 0 | ||||
|         async for _ in channel.history(limit=None): | ||||
|             message_count += 1 | ||||
|         self.assertEqual(message_count, 0) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user