diff --git a/autotest/OldTests/src/test/java/com/tle/webtests/test/AbstractCleanupTest.java b/autotest/OldTests/src/test/java/com/tle/webtests/test/AbstractCleanupTest.java index 987110aa0e..0a1ab17ea4 100644 --- a/autotest/OldTests/src/test/java/com/tle/webtests/test/AbstractCleanupTest.java +++ b/autotest/OldTests/src/test/java/com/tle/webtests/test/AbstractCleanupTest.java @@ -2,21 +2,16 @@ import com.tle.webtests.framework.PageContext; import com.tle.webtests.pageobject.LoginPage; -import com.tle.webtests.pageobject.SettingsPage; import com.tle.webtests.pageobject.searching.ItemAdminPage; import com.tle.webtests.pageobject.searching.ItemListPage; import java.lang.reflect.Method; import org.testng.annotations.BeforeMethod; -// TODO: Remove isNewUIEnv and setNewUI in OEQ-1702 public class AbstractCleanupTest extends AbstractSessionTest { protected String namePrefix; private String usernameForDelete; private String passwordForDelete; - // TODO: Remove me in OEQ-1702 - protected boolean isNewUIEnv = Boolean.parseBoolean(System.getenv("OLD_TEST_NEWUI")); - public AbstractCleanupTest() { namePrefix = getClass().getSimpleName(); } @@ -76,12 +71,6 @@ protected boolean isCleanupItems() { return true; } - // TODO: Remove me in OEQ-1702 - protected void setNewUI(boolean enable) { - SettingsPage settingsPage = new SettingsPage(context).load(); - settingsPage.setNewUI(enable); - } - @BeforeMethod public void setupSubcontext(Method method) { context.setSubPrefix(method.getName()); diff --git a/autotest/OldTests/src/test/java/com/tle/webtests/test/admin/ApidocsTest.java b/autotest/OldTests/src/test/java/com/tle/webtests/test/admin/ApidocsTest.java index 2561efb98b..be28f54fc5 100644 --- a/autotest/OldTests/src/test/java/com/tle/webtests/test/admin/ApidocsTest.java +++ b/autotest/OldTests/src/test/java/com/tle/webtests/test/admin/ApidocsTest.java @@ -7,27 +7,11 @@ import com.tle.webtests.pageobject.ApidocsJsonPage; import com.tle.webtests.pageobject.ApidocsPage; import com.tle.webtests.pageobject.ErrorPage; -import com.tle.webtests.pageobject.SettingsPage; import com.tle.webtests.test.AbstractSessionTest; -import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @TestInstitution("fiveo") public class ApidocsTest extends AbstractSessionTest { - - // TODO: Remove this method in OEQ-1702. - // This test become flaky on Gitlab and from the screenshot, it seems that the new UI is not - // restored. - @BeforeClass - public void enableNewUI() { - // make sure new UI is enabled. - if (testConfig.isNewUI()) { - logon("AutoTest", "automated"); - SettingsPage settingsPage = new SettingsPage(context).load(); - settingsPage.setNewUI(true); - } - } - @Test public void testLoginNoAccess() { logout(context); diff --git a/autotest/OldTests/src/test/java/com/tle/webtests/test/dynamichierarchy/DynamicHierarchyTest.java b/autotest/OldTests/src/test/java/com/tle/webtests/test/dynamichierarchy/DynamicHierarchyTest.java index 21d903e130..604a694c9d 100644 --- a/autotest/OldTests/src/test/java/com/tle/webtests/test/dynamichierarchy/DynamicHierarchyTest.java +++ b/autotest/OldTests/src/test/java/com/tle/webtests/test/dynamichierarchy/DynamicHierarchyTest.java @@ -18,9 +18,9 @@ import com.tle.webtests.pageobject.wizard.WizardPageTab; import com.tle.webtests.test.AbstractCleanupTest; import org.testng.annotations.Test; +import testng.annotation.OldUIOnly; -// todo: lots of switching between UI modes were added to get the test passed. -// We will remove these once we work on OEQ-1701 and OEQ-1702 +/** Legacy tests for dynamic hierarchy. */ @TestInstitution("hierarchy") public class DynamicHierarchyTest extends AbstractCleanupTest { final String TOPIC_1 = "dynamic_topic 1"; @@ -29,6 +29,7 @@ public class DynamicHierarchyTest extends AbstractCleanupTest { final String TESTING_ITEM = "Testing item 3"; @Test + @OldUIOnly public void checkGeneratedHierarchyMenu() { logon("AutoTest", "automated"); HomePage homePage = new HomePage(context).load(); @@ -38,6 +39,7 @@ public void checkGeneratedHierarchyMenu() { } @Test + @OldUIOnly public void modifyKeyResourceLinkOnItemSummary() { logon("AutoTest", "automated"); @@ -52,10 +54,6 @@ public void modifyKeyResourceLinkOnItemSummary() { // add key resource to first dynamic hierarchy keyResourcePage.addToHierarchy(TOPIC_1); - if (getTestConfig().isNewUI()) { - logon("TLE_ADMINISTRATOR", testConfig.getAdminPassword()); - setNewUI(false); - } TopicPage browseAll = new TopicPage(context).load(); TopicPage topicPage = browseAll.clickSubTopic(TOPIC_1); TopicListPage results = topicPage.results(); @@ -64,12 +62,9 @@ public void modifyKeyResourceLinkOnItemSummary() { assertTrue( results.doesKeyResourceExist(TESTING_ITEM, 1), TESTING_ITEM + " doesn't exist in " + TOPIC_1); - if (getTestConfig().isNewUI()) { - logon("TLE_ADMINISTRATOR", testConfig.getAdminPassword()); - setNewUI(true); - } } + @OldUIOnly @Test(dependsOnMethods = "modifyKeyResourceLinkOnItemSummary") public void addToHierarchyLinkOnSearchPage() { logon("AutoTest", "automated"); @@ -84,10 +79,6 @@ public void addToHierarchyLinkOnSearchPage() { keyResourcePage.removeKeyResourceFromHierarchy(TOPIC_1); keyResourcePage.addToHierarchy(TOPIC_2); - if (getTestConfig().isNewUI()) { - logon("TLE_ADMINISTRATOR", testConfig.getAdminPassword()); - setNewUI(false); - } TopicPage browseAll1 = new TopicPage(context).load(); TopicPage topicPage1 = browseAll1.clickSubTopic(TOPIC_1); TopicListPage itemList1 = topicPage1.results(); @@ -99,21 +90,14 @@ public void addToHierarchyLinkOnSearchPage() { TopicPage topicPage2 = browseAll2.clickSubTopic(TOPIC_2); TopicListPage itemList2 = topicPage2.results(); assertTrue(itemList2.doesKeyResourceExist(TESTING_ITEM, 1)); - if (getTestConfig().isNewUI()) { - logon("TLE_ADMINISTRATOR", testConfig.getAdminPassword()); - setNewUI(true); - } } + @OldUIOnly @Test(dependsOnMethods = "addToHierarchyLinkOnSearchPage") public void topicPageLinksAndCountNumberCheck() { logon("AutoTest", "automated"); String itemName = "Testing item 1"; - if (getTestConfig().isNewUI()) { - logon("TLE_ADMINISTRATOR", testConfig.getAdminPassword()); - setNewUI(false); - } TopicPage browseAll = new TopicPage(context).load(); TopicPage topicPage = browseAll.clickSubTopic(TOPIC_1); TopicListPage results = topicPage.results(); @@ -134,14 +118,10 @@ public void topicPageLinksAndCountNumberCheck() { TopicPage browseAgain = topicPage.clickBrowseBreadcrumb(); int countAgain = browseAgain.topicCount(TOPIC_1); assertEquals(Integer.toString(resultRecord), Integer.toString(countAgain)); - if (getTestConfig().isNewUI()) { - logon("TLE_ADMINISTRATOR", testConfig.getAdminPassword()); - setNewUI(true); - } } - @Test - // key resource references to an item should be removed when item is deleted + @OldUIOnly + @Test(description = "key resource references to an item should be removed when item is deleted") public void testKeyResourceReferenceRemove() { logon("AutoTest", "automated"); @@ -159,17 +139,9 @@ public void testKeyResourceReferenceRemove() { item.delete(); item.purge(); - if (getTestConfig().isNewUI()) { - logon("TLE_ADMINISTRATOR", testConfig.getAdminPassword()); - setNewUI(false); - } TopicPage browseAll = new TopicPage(context).load(); TopicPage topicPage = browseAll.clickSubTopic(TOPIC_1); TopicListPage results = topicPage.results(); assertFalse(results.doesKeyResourceExist(itemName, 1)); - if (getTestConfig().isNewUI()) { - logon("TLE_ADMINISTRATOR", testConfig.getAdminPassword()); - setNewUI(true); - } } } diff --git a/autotest/OldTests/src/test/java/com/tle/webtests/test/searching/hierarchy/HierarchyTopicTest.java b/autotest/OldTests/src/test/java/com/tle/webtests/test/searching/hierarchy/HierarchyTopicTest.java index aeb604b82e..ef33f83ef1 100644 --- a/autotest/OldTests/src/test/java/com/tle/webtests/test/searching/hierarchy/HierarchyTopicTest.java +++ b/autotest/OldTests/src/test/java/com/tle/webtests/test/searching/hierarchy/HierarchyTopicTest.java @@ -17,37 +17,14 @@ import com.tle.webtests.pageobject.wizard.controls.universal.ResourceUniversalControlType; import com.tle.webtests.test.AbstractCleanupTest; import org.testng.Assert; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; +import testng.annotation.OldUIOnly; -// TODO: remove disableNewUI and restoreNewUISettings in OEQ-1702 +/** Legacy tests for hierarchy topic. Old UI only. */ @TestInstitution("fiveo") public class HierarchyTopicTest extends AbstractCleanupTest { - // TODO: Create hierarchy tests for NEW UI. And remove this method in OEQ-1702. - // Because hierarchy page is is not completed in new UI, turn off New UI for the old integration - // test cases. - @BeforeClass - public void disableNewUI() { - // disable new UI if test env is set to new UI. - if (isNewUIEnv) { - logon("AutoTest", "automated"); - setNewUI(false); - } - } - - // TODO: Remove this method in OEQ-1702. - // Restore the new UI settings to avoid interfering with other tests. - @AfterClass - public void restoreNewUISettings() { - // Restore new UI if test env is set to new UI. - if (isNewUIEnv) { - logon("AutoTest", "automated"); - setNewUI(true); - } - } - @Test(enabled = false, dependsOnMethods = "childInheritance") + @OldUIOnly public void addKeyResource() { logon("AutoTest", "automated"); String topic = "A Topic"; @@ -68,16 +45,10 @@ public void addKeyResource() { } @Test(dependsOnMethods = "childInheritance") + @OldUIOnly public void lotsOfKeyResources() { logon("AutoTest", "automated"); - // TODO: remove me in OEQ-1702 - // disable new UI if test env is set to new UI. This test is flaky so make sure it is run in old - // UI. - if (isNewUIEnv) { - setNewUI(false); - } - String topic = "A Topic"; String itemName = context.getFullName("Lots of Key Resources"); @@ -105,6 +76,7 @@ public void lotsOfKeyResources() { } @Test + @OldUIOnly public void childInheritance() { logon("AutoTest", "automated"); String topic = "A Topic"; @@ -112,7 +84,7 @@ public void childInheritance() { String itemOne = "SearchFilters - Basic Item"; String itemTwo = "SearchSettings - Random Item"; - TopicPage topicPage = new MenuSection(context, false).get().clickTopic(topic); + TopicPage topicPage = new MenuSection(context).get().clickTopic(topic); topicPage.setSort("name"); TopicListPage results = topicPage.results(); @@ -129,12 +101,13 @@ public void childInheritance() { } @Test + @OldUIOnly public void powerSearch() { logon("AutoTest", "automated"); String topic = "Power Search"; String powerSearch = "A Power Search"; - TopicPage topicPage = new MenuSection(context, false).get().clickTopic(topic); + TopicPage topicPage = new MenuSection(context).get().clickTopic(topic); Assert.assertTrue(topicPage.hasPowerSearch()); SearchPage search = topicPage.clickPowerSearch(); @@ -142,18 +115,19 @@ public void powerSearch() { } @Test + @OldUIOnly public void saveAsFavourite() { logon("AutoTest", "automated"); String topic = "A Topic"; - MenuSection menuSection = new MenuSection(context, false).get(); + MenuSection menuSection = new MenuSection(context).get(); TopicPage topicPage = menuSection.clickTopic(topic); String searchName = context.getFullName(topic) + " saved"; topicPage.saveSearch(searchName, topicPage); FavouritesPage favouritesPage = - menuSection.clickMenuForceOldUI("Favourites", new FavouritesPage(context)); + menuSection.clickMenu("Favourites", new FavouritesPage(context)); FavouriteSearchList searches = favouritesPage.searches().results(); searches.doesResultExist(searchName, 1); searches.getResultForTitle(searchName, 1).clickTitle(); @@ -164,6 +138,7 @@ public void saveAsFavourite() { } @Test + @OldUIOnly public void noResults() { logon("AutoTest", "automated"); String topic = "No Results"; @@ -176,6 +151,7 @@ public void noResults() { } @Test + @OldUIOnly public void sectionNames() { logon("AutoTest", "automated"); String topic = "Some Children Hidden"; @@ -186,6 +162,7 @@ public void sectionNames() { } @Test + @OldUIOnly public void hiddenResults() { logon("AutoTest", "automated"); String topic = "Results not shown"; @@ -197,6 +174,7 @@ public void hiddenResults() { } @Test + @OldUIOnly public void hideNoResultChildren() { logon("AutoTest", "automated"); String topic = "Some Children Hidden"; @@ -224,6 +202,7 @@ public void hideNoResultChildren() { } @Test + @OldUIOnly public void accessTest() { logon("NoSearchCreateUser", "``````"); TopicPage topicPage = new TopicPage(context).load(); @@ -236,6 +215,7 @@ public void accessTest() { } @Test + @OldUIOnly public void browseHierarchyBreadcrumbTest() { logon("AutoTest", "automated"); diff --git a/autotest/OldTests/src/test/java/com/tle/webtests/test/webservices/soap/Soap51Test.java b/autotest/OldTests/src/test/java/com/tle/webtests/test/webservices/soap/Soap51Test.java index ba57896b06..8f67c0ecf4 100644 --- a/autotest/OldTests/src/test/java/com/tle/webtests/test/webservices/soap/Soap51Test.java +++ b/autotest/OldTests/src/test/java/com/tle/webtests/test/webservices/soap/Soap51Test.java @@ -35,6 +35,7 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; +import testng.annotation.OldUIOnly; @TestInstitution("fiveo") public class Soap51Test extends AbstractCleanupTest { @@ -847,6 +848,7 @@ private byte[] getAttachmentData(String filename) { } @Test + @OldUIOnly public void hierarchyTest() throws Exception { String aTopicUUID = "e8c49738-7609-0079-e354-67b2e4e6b54c"; String aTopicName = "A Topic"; @@ -893,14 +895,8 @@ public void hierarchyTest() throws Exception { logon("AutoTest", "automated"); - // TODO: remove setNewUI in OEQ-1702. - // Because hierarchy page is not completed in new UI, turn off New UI. - if (isNewUIEnv) { - setNewUI(false); - } - - MenuSection menuSection = new MenuSection(context, false); - assertTrue(menuSection.hasMenuOption(newTopicName, true)); + MenuSection menuSection = new MenuSection(context); + assertTrue(menuSection.hasMenuOption(newTopicName)); newTopicXml = new PropBagEx(soapService.getTopic(newTopicUUID)); checkTopic(newTopicXml, newTopicName, newTopicUUID); @@ -930,7 +926,7 @@ public void hierarchyTest() throws Exception { newTopicXml.setNode("name", newTopicName); soapService.editTopic(newTopicUUID, newTopicXml.toString()); logon("AutoTest", "automated"); // Refresh topics - assertTrue(menuSection.hasMenuOption(newTopicName, true)); + assertTrue(menuSection.hasMenuOption(newTopicName)); // Edit child topic String firstChildEdited = "Child111"; @@ -947,11 +943,11 @@ public void hierarchyTest() throws Exception { // Move root topic soapService.moveTopic(newTopicUUID, "", 1); logon("AutoTest", "automated"); // Refresh topics - assertTrue(menuSection.hasHierarchyTopic(newTopicName, 2, true)); + assertTrue(menuSection.hasHierarchyTopic(newTopicName, 2)); soapService.moveTopic(newTopicUUID, "", 3); logon("AutoTest", "automated"); // Refresh topics - assertTrue(menuSection.hasHierarchyTopic(newTopicName, 4, true)); + assertTrue(menuSection.hasHierarchyTopic(newTopicName, 4)); // Move child topics using MIN/MAX soapService.moveTopic(newFirstChildUUID, newTopicUUID, Integer.MAX_VALUE); @@ -975,13 +971,7 @@ public void hierarchyTest() throws Exception { // Delete root topic with remaining child topic soapService.deleteTopic(newTopicUUID); logon("AutoTest", "automated"); - assertFalse(menuSection.get().hasMenuOption(newTopicName, true)); - - // TODO: remove setNewUI in OEQ-1702. - // restore NEW UI settings. - if (isNewUIEnv) { - setNewUI(true); - } + assertFalse(menuSection.get().hasMenuOption(newTopicName)); } private void checkTopic(PropBagEx xml, String name, String uuid) { diff --git a/autotest/OldTests/src/test/java/io/github/openequella/pages/search/AbstractSearchPage.java b/autotest/OldTests/src/test/java/io/github/openequella/pages/search/AbstractSearchPage.java index 4b738c4777..6de73ed4e4 100644 --- a/autotest/OldTests/src/test/java/io/github/openequella/pages/search/AbstractSearchPage.java +++ b/autotest/OldTests/src/test/java/io/github/openequella/pages/search/AbstractSearchPage.java @@ -55,6 +55,19 @@ public Boolean hasSearchResultList() { return !driver.findElements(searchResultListBy).isEmpty(); } + /** + * Wait until the initial search is completed. When the page is first rendered, there is no + * element in the result list, and once the search is completed there will be some elements placed + * in the list. Thus, it will wait for any element display in the list. If you know the exact + * number of items will be displayed in the search result, you are expected to use the {@link + * #waitForSearchCompleted(int)} instead. + */ + public void waitForInitialSearchResult() { + waiter.until( + ExpectedConditions.presenceOfAllElementsLocatedBy( + By.xpath("//ul[@data-testid='search-result-list']/*"))); + } + /** * Click one Item's title link and open the Item Summary page. * diff --git a/autotest/OldTests/src/test/java/testng/TestAnnotationTransformer.java b/autotest/OldTests/src/test/java/testng/TestAnnotationTransformer.java index 64ab3954b2..d479bb0f10 100644 --- a/autotest/OldTests/src/test/java/testng/TestAnnotationTransformer.java +++ b/autotest/OldTests/src/test/java/testng/TestAnnotationTransformer.java @@ -5,6 +5,7 @@ import org.testng.IAnnotationTransformer; import org.testng.annotations.ITestAnnotation; import testng.annotation.NewUIOnly; +import testng.annotation.OldUIOnly; public class TestAnnotationTransformer implements IAnnotationTransformer { private static final String OLD_TEST_NEWUI = "OLD_TEST_NEWUI"; @@ -28,10 +29,13 @@ private void checkRetryAnnotation(ITestAnnotation annotation, Method testMethod) // Check if a method is annotated with 'NewUIOnly' private void checkSkipTestAnnotation(ITestAnnotation annotation, Method testMethod) { NewUIOnly newUIOnly = testMethod.getAnnotation(NewUIOnly.class); + OldUIOnly oldUIOnly = testMethod.getAnnotation(OldUIOnly.class); // Read the configuration of using new UI or not from environment variable. boolean isNewUIEnabled = Boolean.parseBoolean(System.getenv(OLD_TEST_NEWUI)); - // Skip tests that should not run against Old UI when CI is running in Old UI. - if (newUIOnly != null && newUIOnly.value() && !isNewUIEnabled) { + // Skip tests that should not run against Old UI when CI is running in Old UI + // and also skip tests that should not run against New UI when CI is running in New UI. + if ((newUIOnly != null && newUIOnly.value() && !isNewUIEnabled) + || (oldUIOnly != null && oldUIOnly.value() && isNewUIEnabled)) { annotation.setEnabled(false); } } diff --git a/autotest/OldTests/src/test/java/testng/annotation/OldUIOnly.java b/autotest/OldTests/src/test/java/testng/annotation/OldUIOnly.java new file mode 100644 index 0000000000..cdaab1b0bc --- /dev/null +++ b/autotest/OldTests/src/test/java/testng/annotation/OldUIOnly.java @@ -0,0 +1,9 @@ +package testng.annotation; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Retention(RetentionPolicy.RUNTIME) +public @interface OldUIOnly { + boolean value() default true; +} diff --git a/autotest/OldTests/src/test/scala/io/github/openequella/hierarchy/HierarchyPageTest.scala b/autotest/OldTests/src/test/scala/io/github/openequella/hierarchy/HierarchyPageTest.scala index 41916e9158..c7aebc0f80 100644 --- a/autotest/OldTests/src/test/scala/io/github/openequella/hierarchy/HierarchyPageTest.scala +++ b/autotest/OldTests/src/test/scala/io/github/openequella/hierarchy/HierarchyPageTest.scala @@ -67,11 +67,13 @@ import testng.annotation.NewUIOnly @Test(description = "Child topic should inherit results from parent topic.") def childInheritance(): Unit = { val hierarchyPage = openHierarchyPage(A_TOPIC_NAME, A_TOPIC_UUID) + hierarchyPage.waitForInitialSearchResult() assertTrue(hierarchyPage.hasItem(BASIC_ITEM)) assertTrue(hierarchyPage.hasItem(RANDOM_ITEM)) val childHierarchyPage = openHierarchyPage(CHILD_TOPIC_NAME, CHILD_TOPIC_UUID) + childHierarchyPage.waitForInitialSearchResult() // This child topic inherits the two Items, but due to its own query configuration, it shows only one Item. assertTrue(childHierarchyPage.hasItem(RANDOM_ITEM)) assertFalse(childHierarchyPage.hasItem(BASIC_ITEM)) @@ -132,7 +134,7 @@ import testng.annotation.NewUIOnly val itemName = "DRM API test" val searchPage = new NewSearchPage(context).load - searchPage.waitForSearchCompleted(46) + searchPage.waitForInitialSearchResult() searchPage.addToKeyResource(itemName, hierarchyName) val hierarchyPage = openHierarchyPage(hierarchyName, hierarchyUuid) diff --git a/autotest/OldTests/src/test/scala/io/github/openequella/pages/hierarchy/HierarchyPage.scala b/autotest/OldTests/src/test/scala/io/github/openequella/pages/hierarchy/HierarchyPage.scala index 5f08eac73b..986b27e587 100644 --- a/autotest/OldTests/src/test/scala/io/github/openequella/pages/hierarchy/HierarchyPage.scala +++ b/autotest/OldTests/src/test/scala/io/github/openequella/pages/hierarchy/HierarchyPage.scala @@ -22,7 +22,7 @@ import com.tle.webtests.framework.PageContext import com.tle.webtests.pageobject.{ExpectedConditions2, PageObject, WaitingPageObject} import io.github.openequella.pages.search.AbstractSearchPage import org.openqa.selenium.support.ui.ExpectedConditions -import org.openqa.selenium.{By, WebElement} +import org.openqa.selenium.{By, JavascriptExecutor, WebElement} class HierarchyPage(context: PageContext, val hierarchyName: String, @@ -113,7 +113,7 @@ class HierarchyPage(context: PageContext, ".//a[text()='" + itemName + "']/ancestor::div[contains(@class, 'KeyResource-container')]//button[@aria-label='" + removeKeyResourceLabel + "']") val button = getKeyResourcePanel.findElement(pinIconXpath) - button.click() + driver.asInstanceOf[JavascriptExecutor].executeScript("arguments[0].click();", button) waitForKeyResourceUpdated(keyResourceCount = originalResourceCount - 1) } diff --git a/autotest/OldTests/testng-codebuild.yaml b/autotest/OldTests/testng-codebuild.yaml index 5343520292..6f59cdb879 100644 --- a/autotest/OldTests/testng-codebuild.yaml +++ b/autotest/OldTests/testng-codebuild.yaml @@ -8,6 +8,8 @@ tests: - io.github.openequella.rest - io.github.openequella.search - io.github.openequella.jwks + - io.github.openequella.hierarchy + - io.github.openequella.pages classes: - com.tle.webtests.test.searching.BrowsebyTest - com.tle.webtests.test.searching.GallerySearchTest diff --git a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/generic/component/SelectUserDialog.java b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/generic/component/SelectUserDialog.java index 4f575edd92..af70369df5 100644 --- a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/generic/component/SelectUserDialog.java +++ b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/generic/component/SelectUserDialog.java @@ -91,7 +91,7 @@ public SelectUserDialog select(String username) { private By getByForUsername(String username) { String xpath = MessageFormat.format( - "id({0})//div[@id={1}]//ul/li[div[contains(text(), {2})]]/input", + "id({0})//div[@id={1}]//ul/li[div[text() = {2}]]/input", quoteXPath(baseId), quoteXPath("results"), quoteXPath(username)); return By.xpath(xpath); } diff --git a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/generic/page/AbstractScreenOptions.java b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/generic/page/AbstractScreenOptions.java index e92bc846da..d1e0ba1d22 100644 --- a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/generic/page/AbstractScreenOptions.java +++ b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/generic/page/AbstractScreenOptions.java @@ -34,20 +34,10 @@ private By getOpenOptionsBy() { } } - // TODO: Remove me in OEQ-1702 - private By getOpenOptionsByWithOldUI() { - return By.id(OLD_SCREEN_OPTIONS_BUTTON); - } - private WebElement getOpenOptions() { return driver.findElement(getOpenOptionsBy()); } - // TODO: Remove me in OEQ-1702 - private WebElement getOpenOptionsWithOldUI() { - return driver.findElement(getOpenOptionsByWithOldUI()); - } - protected boolean isOptionsOpen() { return isVisible(loadedBy); } @@ -62,18 +52,6 @@ public T open() { return get(); } - // TODO: Remove me in OEQ-1702 - public T openWithOldUi() { - loadedBy = By.id(OLD_SCREEN_OPTIONS); - if (!isOptionsOpen()) { - ExpectedCondition visible = - ExpectedConditions.visibilityOfElementLocated(loadedBy); - getOpenOptionsWithOldUI().click(); - waiter.until(visible); - } - return get(); - } - public void setupForTest() { isConnectorTest = true; loadedBy = By.id(getOptionsId()); diff --git a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/portal/MenuSection.java b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/portal/MenuSection.java index 0dad667f91..3a47837807 100644 --- a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/portal/MenuSection.java +++ b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/portal/MenuSection.java @@ -14,8 +14,6 @@ import org.openqa.selenium.support.pagefactory.ByChained; import org.openqa.selenium.support.ui.ExpectedConditions; -// TODO: remove MenuSection, linkByText, linkByTextAndHref, hasMenuOption, hasHierarchyTopic in -// OEQ-1702. public class MenuSection extends AbstractPage { public MenuSection(PageContext context) { @@ -23,33 +21,17 @@ public MenuSection(PageContext context) { loadedBy = isNewUI() ? By.id("menulinks") : By.id("menu"); } - // TODO: Remove this method OEQ-1702. - // Specific for hierarchy menu related test because the new UI hasn't been completed yet. - public MenuSection(PageContext context, Boolean isNewUI) { - super(context); - loadedBy = isNewUI ? By.id("menulinks") : By.id("menu"); - } - private By linkByText(String text) { - return linkByTextAndHref(text, null, false); - } - - // TODO: Remove this method in OEQ-1702. - // Specific for hierarchy menu related test because the new UI hasn't been completed yet. - private By linkByText(String text, boolean forceOldUi) { - return linkByTextAndHref(text, null, forceOldUi); + return linkByTextAndHref(text, null); } - // TODO: Remove forceOldUi param in OEQ-1702. - // Add forceOldUi param for hierarchy menu related test because the new UI hasn't been completed - // yet. - private By linkByTextAndHref(String text, String href, boolean forceOldUi) { + private By linkByTextAndHref(String text, String href) { String quotedText = quoteXPath(text); String hrefXPath = ""; if (href != null) { hrefXPath = " and @href=" + quoteXPath(href); } - if (!forceOldUi && isNewUI()) { + if (isNewUI()) { return By.xpath("id('menulinks')//a[./div/div[text()=" + quotedText + "]" + hrefXPath + "]"); } return By.xpath("id('menu')//a[text()=" + quotedText + hrefXPath + "]"); @@ -65,14 +47,6 @@ private WebElement findLink(String title) { return driver.findElement(textLink); } - // TODO: Remove this method in OEQ-1702. - // Specific for hierarchy menu related test because the new UI hasn't been completed yet. - private WebElement findLink(String title, boolean forceOldUi) { - By textLink = linkByText(title, forceOldUi); - waiter.until(ExpectedConditions.visibilityOfElementLocated(textLink)); - return driver.findElement(textLink); - } - public > T clickMenu(String title, T page) { WebElement link = findLink(title); page.getWaiter().until(ExpectedConditions.elementToBeClickable(link)); @@ -80,15 +54,6 @@ public > T clickMenu(String title, T page) { return page.get(); } - // TODO: Remove this method in OEQ-1702 - // Specific for hierarchy menu related test because the new UI hasn't been completed yet. - public > T clickMenuForceOldUI(String title, T page) { - WebElement link = findLink(title, true); - page.getWaiter().until(ExpectedConditions.elementToBeClickable(link)); - link.click(); - return page.get(); - } - // Handles the case of a single wizard... public WizardPageTab clickContribute(String wizardName) { findLink("Contribute").click(); @@ -111,8 +76,8 @@ public > T clickMenuLink(String href, T page) { } public TopicPage clickTopic(String title) { - if (hasMenuOption(title, true)) { - findLink(title, true).click(); + if (hasMenuOption(title)) { + findLink(title).click(); return new TopicPage(context, title).get(); } else { return new TopicPage(context, "Browse").load().clickSubTopic(title); @@ -127,35 +92,22 @@ public boolean hasMenuOption(String title) { return isPresent(linkByText(title)); } - // TODO: Remove this method in OEQ-1702. - // Specific for hierarchy menu related test because the new UI hasn't been completed yet. - public boolean hasMenuOption(String title, Boolean forceOldUi) { - return isPresent(linkByText(title, forceOldUi)); - } - public boolean hasHierarchyTopic(String title, int position) { return isPresent(linkByText(title)); } - // TODO: Remove this method in OEQ-1702. - // Specific for hierarchy menu related test because the new UI hasn't been completed yet. - public boolean hasHierarchyTopic(String title, int position, Boolean forceOldUi) { - return isPresent(linkByText(title, forceOldUi)); - } - public boolean waitForCustomIconByNameAndHref(String name, String url) { return hasCustomIcon( - waiter.until( - ExpectedConditions.visibilityOfElementLocated(linkByTextAndHref(name, url, false)))); + waiter.until(ExpectedConditions.visibilityOfElementLocated(linkByTextAndHref(name, url)))); } public boolean linkExists(String name, String url) { - List elems = driver.findElements(linkByTextAndHref(name, url, false)); + List elems = driver.findElements(linkByTextAndHref(name, url)); return !elems.isEmpty(); } public boolean linkExistsWithIcon(String name, String url, boolean customIcon) { - List elems = driver.findElements(linkByTextAndHref(name, url, false)); + List elems = driver.findElements(linkByTextAndHref(name, url)); if (elems.isEmpty()) { return false; diff --git a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/searching/AbstractSearchPage.java b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/searching/AbstractSearchPage.java index b334e44915..099bd101fa 100644 --- a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/searching/AbstractSearchPage.java +++ b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/searching/AbstractSearchPage.java @@ -73,7 +73,7 @@ public String getStats() { @SuppressWarnings("unchecked") public T setPerPage(String perPage) { - AbstractSearchPageScreenOptions screenOptions = openScreenOptionsWithOldUI(); + AbstractSearchPageScreenOptions screenOptions = openScreenOptions(); WaitingPageObject waiter = resultsPageObject.getUpdateWaiter(); screenOptions.setPerPage(perPage); waiter.get(); @@ -88,11 +88,6 @@ public AbstractSearchPageScreenOptions openScreenOptions() { return new DefaultSearchPageScreenOptions(context).open(); } - // TODO: Remove me in OEQ-1702 - public AbstractSearchPageScreenOptions openScreenOptionsWithOldUI() { - return new DefaultSearchPageScreenOptions(context, true).openWithOldUi(); - } - public T setSort(String sort) { WaitingPageObject waiter = resultsPageObject.getUpdateWaiter(); new EquellaSelect(context, getSortList()).selectByValue(sort); diff --git a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/searching/AbstractSearchPageScreenOptions.java b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/searching/AbstractSearchPageScreenOptions.java index fcaeb4f4ca..0ea4689e38 100644 --- a/autotest/Tests/src/main/java/com/tle/webtests/pageobject/searching/AbstractSearchPageScreenOptions.java +++ b/autotest/Tests/src/main/java/com/tle/webtests/pageobject/searching/AbstractSearchPageScreenOptions.java @@ -13,25 +13,15 @@ public abstract class AbstractSearchPageScreenOptions