diff --git a/driver-ui/src/main/java/eu/tsystems/mms/tic/testframework/pageobjects/Page.java b/driver-ui/src/main/java/eu/tsystems/mms/tic/testframework/pageobjects/Page.java index 43b1d1ea9..1bc8ab6c4 100644 --- a/driver-ui/src/main/java/eu/tsystems/mms/tic/testframework/pageobjects/Page.java +++ b/driver-ui/src/main/java/eu/tsystems/mms/tic/testframework/pageobjects/Page.java @@ -22,7 +22,6 @@ package eu.tsystems.mms.tic.testframework.pageobjects; import eu.tsystems.mms.tic.testframework.common.Testerra; -import eu.tsystems.mms.tic.testframework.exceptions.ElementNotFoundException; import eu.tsystems.mms.tic.testframework.internal.Nameable; import eu.tsystems.mms.tic.testframework.internal.asserts.PropertyAssertionConfig; import eu.tsystems.mms.tic.testframework.pageobjects.internal.AbstractPage; @@ -30,7 +29,6 @@ import eu.tsystems.mms.tic.testframework.pageobjects.internal.PageUiElementFinder; import eu.tsystems.mms.tic.testframework.pageobjects.internal.asserts.PageAssertions; import eu.tsystems.mms.tic.testframework.report.Report; -import eu.tsystems.mms.tic.testframework.utils.TimerUtils; import org.openqa.selenium.WebDriver; /** @@ -125,17 +123,6 @@ public WebDriver getWebDriver() { // TimerUtils.sleep(timeToWait); // } - /** - * Waits for a text to be not present. - * - * @return boolean true if success == text is not present. false otherwise. - */ - @Deprecated - public boolean waitForIsNotTextPresentWithDelay(final String text, final int delayInSeconds) { - TimerUtils.sleep(delayInSeconds * 1000); - return waitForIsNotTextPresent(text); - } - protected UiElementFinder getFinder() { return this.finder; } @@ -150,17 +137,6 @@ protected UiElement findDeep(Locator locator) { return getFinder().findDeep(locator); } - /** - * Waits for a text to be not present. - * - * @return boolean true if success == text is not present. false otherwise. - */ - @Deprecated - public boolean waitForIsNotTextDisplayedWithDelay(final String text, final int delayInSeconds) { - TimerUtils.sleep(delayInSeconds * 1000); - return waitForIsNotTextDisplayed(text); - } - @Override protected void pageLoaded() { if (Testerra.Properties.SCREENSHOT_ON_PAGELOAD.asBool()) { @@ -168,68 +144,6 @@ protected void pageLoaded() { } } - /** - * Waits for a text to be not present. - * - * @return boolean true if success == text is not present. false otherwise. - */ - @Deprecated - public boolean waitForIsNotTextPresent(final String text) { - return anyElementContainsText(text).waitFor().present(false); - } - - /** - * Waits for a text to be not displayed. - * - * @return boolean true if success == text is not present. false otherwise. - */ - @Deprecated - public boolean waitForIsNotTextDisplayed(final String text) { - return anyElementContainsText(text).waitFor().displayed(false); - } - - @Deprecated - public void assertIsTextPresent(String text, String description) { - assertIsTextPresent(text); - } - - @Deprecated - public void assertIsTextDisplayed(String text, String description) { - assertIsTextDisplayed(text); - } - - @Deprecated - public void assertIsTextPresent(String text) { - anyElementContainsText(text).expect().present().is(true); - } - - @Deprecated - public void assertIsTextDisplayed(String text) { - anyElementContainsText(text).expect().displayed().is(true); - } - - @Deprecated - public void assertIsNotTextPresent(String text) { - anyElementContainsText(text).expect().present().is(false); - } - - @Deprecated - public void assertIsNotTextDisplayed(String text) { - try { - anyElementContainsText(text).expect().displayed().is(false); - } catch (AssertionError error) { - if (error.getCause() instanceof ElementNotFoundException) { - // ignore this - } else { - throw error; - } - } - } - - private TestableUiElement anyElementContainsText(String text) { - return this.getFinder().findDeep(XPath.from("*").text().contains(text)); - } - @Override public PageAssertions waitFor(int seconds) { PropertyAssertionConfig config = new PropertyAssertionConfig(); diff --git a/driver-ui/src/main/java/eu/tsystems/mms/tic/testframework/pageobjects/internal/DefaultPageAssertions.java b/driver-ui/src/main/java/eu/tsystems/mms/tic/testframework/pageobjects/internal/DefaultPageAssertions.java index bd57d2872..eec85edb7 100644 --- a/driver-ui/src/main/java/eu/tsystems/mms/tic/testframework/pageobjects/internal/DefaultPageAssertions.java +++ b/driver-ui/src/main/java/eu/tsystems/mms/tic/testframework/pageobjects/internal/DefaultPageAssertions.java @@ -35,7 +35,6 @@ import eu.tsystems.mms.tic.testframework.pageobjects.Page; import eu.tsystems.mms.tic.testframework.pageobjects.internal.asserts.DefaultImageAssertion; import eu.tsystems.mms.tic.testframework.pageobjects.internal.asserts.DefaultRectAssertion; -import eu.tsystems.mms.tic.testframework.pageobjects.internal.asserts.DefaultUiElementAssertion; import eu.tsystems.mms.tic.testframework.pageobjects.internal.asserts.PageAssertions; import eu.tsystems.mms.tic.testframework.pageobjects.internal.asserts.RectAssertion; import eu.tsystems.mms.tic.testframework.report.Report; @@ -43,11 +42,12 @@ import eu.tsystems.mms.tic.testframework.report.utils.ExecutionContextController; import eu.tsystems.mms.tic.testframework.utils.JSUtils; import eu.tsystems.mms.tic.testframework.utils.UITestUtils; -import java.io.File; -import java.util.concurrent.atomic.AtomicReference; import org.openqa.selenium.Rectangle; import org.openqa.selenium.WebDriver; +import java.io.File; +import java.util.concurrent.atomic.AtomicReference; + public class DefaultPageAssertions implements PageAssertions { private static final PropertyAssertionFactory propertyAssertionFactory = Testerra.getInjector().getInstance(PropertyAssertionFactory.class); private static final Report report = Testerra.getInjector().getInstance(Report.class); @@ -69,7 +69,7 @@ public String getActual() { @Override public String createSubject() { - return Format.separate(page.toString(), "title="+Format.shortString(getActual())); + return Format.separate(page.toString(), "title=" + Format.shortString(getActual())); } }); } @@ -84,7 +84,7 @@ public String getActual() { @Override public String createSubject() { - return Format.separate(page.toString(), "url="+Format.param(getActual())); + return Format.separate(page.toString(), "url=" + Format.param(getActual())); } }); } @@ -101,6 +101,7 @@ public Boolean getActual() { return false; } } + @Override public String createSubject() { return Format.separate(page.toString(), "displayed"); @@ -120,6 +121,7 @@ public Boolean getActual() { return false; } } + @Override public String createSubject() { return Format.separate(page.toString(), "present"); diff --git a/integration-tests/src/test/java/eu/tsystems/mms/tic/testframework/test/page/AssertTextPageTest.java b/integration-tests/src/test/java/eu/tsystems/mms/tic/testframework/test/page/AssertTextPageTest.java deleted file mode 100644 index fcce9bccf..000000000 --- a/integration-tests/src/test/java/eu/tsystems/mms/tic/testframework/test/page/AssertTextPageTest.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Testerra - * - * (C) 2020, Eric Kubenka, T-Systems Multimedia Solutions GmbH, Deutsche Telekom AG - * - * Deutsche Telekom AG and all other contributors / - * copyright owners license this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this - * file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package eu.tsystems.mms.tic.testframework.test.page; - -import eu.tsystems.mms.tic.testframework.AbstractTestSitesTest; -import eu.tsystems.mms.tic.testframework.core.pageobjects.testdata.WebTestFramedPage; -import eu.tsystems.mms.tic.testframework.core.testpage.TestPage; -import eu.tsystems.mms.tic.testframework.test.PageFactoryTest; -import org.testng.Assert; -import org.testng.annotations.Test; - -/** - * Created by rnhb on 19.06.2015. - *
- * Tests for correct execution of checkpage(). - * To test that checkpage() is executed, a not existing, check-annotated element is used. - */ -public class AssertTextPageTest extends AbstractTestSitesTest implements PageFactoryTest { - - @Override - protected TestPage getTestPage() { - return TestPage.FRAME_TEST_PAGE; - } - - @Override - public WebTestFramedPage getPage() { - WebTestFramedPage page = PAGE_FACTORY.createPage(WebTestFramedPage.class, getWebDriver()); - //page.expectThat().url().contains(getTestPage().getPath()); - return page; - } - - @Test - public void testT11_assertIsTextPresent() { - WebTestFramedPage page = getPage(); - page.assertIsTextPresent("Frame1234"); - } - - @Test(expectedExceptions = AssertionError.class) - public void test_assertIsTextPresent_fails() { - WebTestFramedPage page = getPage(); - page.assertIsTextPresent("Bifi"); - } - - @Test - public void testT13_assertIsNotTextPresent() { - WebTestFramedPage page = getPage(); - page.assertIsNotTextPresent("Bifi"); - } - - @Test(expectedExceptions = AssertionError.class) - public void test_assertIsNotTextPresent_fails() { - WebTestFramedPage page = getPage(); - page.assertIsNotTextPresent("Frame1234"); - } - - @Test(expectedExceptions = AssertionError.class) - public void testT15F_waitIsNotTextPresentWithDelay() { - WebTestFramedPage page = getPage(); - Assert.assertTrue(page.waitForIsNotTextPresentWithDelay("Frame1234", 1)); - } - - @Test(expectedExceptions = AssertionError.class) - public void testT16F_waitIsNotTextDisplayedWithDelay() { - WebTestFramedPage page = getPage(); - Assert.assertTrue(page.waitForIsNotTextDisplayedWithDelay("Frame1234", 1)); - } - - @Test - public void testT21_assertIsTextDisplayed() { - WebTestFramedPage page = getPage(); - page.assertIsTextDisplayed("Frame1234"); - } - - @Test(expectedExceptions = AssertionError.class) - public void test_assertIsTextDisplayed_fails() { - WebTestFramedPage page = getPage(); - page.assertIsTextDisplayed("Bifi"); - } - - @Test - public void testT23_assertIsNotTextDisplayed() { - WebTestFramedPage page = getPage(); - page.assertIsNotTextDisplayed("Bifi"); - } - - @Test(expectedExceptions = AssertionError.class) - public void test_assertIsNotTextDisplayed_fails() { - WebTestFramedPage page = getPage(); - page.assertIsNotTextDisplayed("Frame1234"); - } -} diff --git a/integration-tests/src/test/java/eu/tsystems/mms/tic/testframework/test/page/CheckPageTest.java b/integration-tests/src/test/java/eu/tsystems/mms/tic/testframework/test/page/CheckPageTest.java deleted file mode 100644 index e69de29bb..000000000