|
@@ -6,15 +6,18 @@ import time
|
|
|
class BaseFunctions(BaseCase):
|
|
|
__test__ = False
|
|
|
|
|
|
- def start(self, browser):
|
|
|
+ def start(self, browser, mobile=False):
|
|
|
sb_config.browser = browser
|
|
|
sb_config._browser_shortcut = browser
|
|
|
sb_config.servername = "127.0.0.1"
|
|
|
sb_config.port = 4444
|
|
|
sb_config.settings_file = "settings.py"
|
|
|
+ if mobile:
|
|
|
+ sb_config.mobile = mobile
|
|
|
super().setUp()
|
|
|
self.set_default_timeout(10)
|
|
|
- self.set_window_size(1920, 1080)
|
|
|
+ if not mobile:
|
|
|
+ self.set_window_size(1920, 1080)
|
|
|
self.open("https://musare.dev")
|
|
|
pass
|
|
|
|
|
@@ -44,6 +47,30 @@ class BaseFunctions(BaseCase):
|
|
|
self.save_screenshot_to_logs("Go to station")
|
|
|
pass
|
|
|
|
|
|
+ def test_go_to_all_stations(self):
|
|
|
+ self.login()
|
|
|
+ self.assert_element(".group.bottom .station-card:not(.createStation)")
|
|
|
+ applications = self.execute_script("""
|
|
|
+ var stations = [];
|
|
|
+ document.querySelectorAll(".group.bottom .station-card:not(.createStation)").forEach(function(station) {
|
|
|
+ var text = station.querySelector(".card-content .media .displayName h5");
|
|
|
+ if(text && text.innerText && station.hasAttribute("href")) {
|
|
|
+ stations.push({
|
|
|
+ "text": text.innerText,
|
|
|
+ "href": station.getAttribute("href")
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return stations;
|
|
|
+ """)
|
|
|
+ for el in applications:
|
|
|
+ self.click(f".group.bottom .station-card[href='{el['href']}']")
|
|
|
+ self.sleep(3)
|
|
|
+ self.save_screenshot_to_logs(f"Station {el['text']}")
|
|
|
+ self.click(".nav-item.is-brand", scroll=False)
|
|
|
+ self.assert_element(".header .content-container")
|
|
|
+ pass
|
|
|
+
|
|
|
def test_go_to_station_logged_out(self):
|
|
|
self.click(".station-card[href='/music']", scroll=False)
|
|
|
self.assert_element("#station-inner-container #video-container #stationPlayer")
|
|
@@ -91,6 +118,7 @@ class BaseFunctions(BaseCase):
|
|
|
self.assert_text("Successfully created playlist", "#toasts-container #toasts-content")
|
|
|
pass
|
|
|
|
|
|
+
|
|
|
@pytest.mark.flaky(reruns=3)
|
|
|
class Firefox(BaseFunctions):
|
|
|
__test__ = True
|
|
@@ -105,3 +133,17 @@ class Chrome(BaseFunctions):
|
|
|
self.start("chrome")
|
|
|
pass
|
|
|
|
|
|
+@pytest.mark.flaky(reruns=3)
|
|
|
+class FirefoxMobile(BaseFunctions):
|
|
|
+ __test__ = True
|
|
|
+ def setUp(self):
|
|
|
+ self.start("firefox", True)
|
|
|
+ pass
|
|
|
+
|
|
|
+@pytest.mark.flaky(reruns=3)
|
|
|
+class ChromeMobile(BaseFunctions):
|
|
|
+ __test__ = True
|
|
|
+ def setUp(self):
|
|
|
+ self.start("chrome", True)
|
|
|
+ pass
|
|
|
+
|