// Method for PlaylistFunc public void AddAndDelTrack(WebElement link) { (link).click(); String TrackTitle = contentPage.FirstTrack.getAttribute( "audio_name"); // gets title of first track on a selected page, and return it to string contentPage.AddTrack.click(); // add "FirstTrack" to play list contentPage.PlayList.click(); // go to play list page String PlaylistTrackTitle = contentPage.FirstPlaylistTrack.getAttribute( "audio_name"); // gets title of first track in a play list assertEquals( TrackTitle, PlaylistTrackTitle); // compares first track from play list with first track from selected // page contentPage.DelTrack.click(); // delete added track }
@Test( priority = 54, groups = {"Playlist"}, description = "Проверяет играет ли музыка на <<Мой плейлист>>") public void PlayTrack() throws Exception { driver.get(baseUrl); contentPage.AddTrack.click(); driver.get(pageUrl); driver.findElement(By.xpath("//*[@class='advanced_playlist']/li/a[2]")).click(); for (int i = 0; i <= 35; i++) { String styl = driver.findElement(By.xpath(".//*[@id='progress_slider']/a")).getAttribute("style"); if (styl.equals("left: 0%;")) { Thread.sleep(1000); } else break; if (i >= 60) { // set how long wait String errorUrl = driver.getCurrentUrl(); log("FAILED: by track doesnt play on this page " + errorUrl); Reporter.log("FAILED: by track doesnt play on this page " + errorUrl); throw new NullPointerException(); } } }