Skip to content

Commit

Permalink
JUnit 4 -> JUnit 5
Browse files Browse the repository at this point in the history
  • Loading branch information
asolntsev committed Sep 13, 2021
1 parent b6870ba commit ff412f8
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ repositories {
}

dependencies {
testImplementation 'junit:junit:4.13.2'
testImplementation 'com.codeborne:selenide-appium:1.6.9'
testImplementation('org.junit.jupiter:junit-jupiter:5.8.0')
testRuntimeOnly 'org.slf4j:slf4j-simple:1.7.32'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
import com.codeborne.selenide.Configuration;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
import org.junit.Before;
import org.junit.jupiter.api.BeforeEach;

import static com.codeborne.selenide.Selenide.closeWebDriver;
import static com.codeborne.selenide.Selenide.open;
import static com.codeborne.selenide.WebDriverRunner.getWebDriver;

public abstract class AbstractApiDemosTest {
@Before
public void setUp() {
@BeforeEach
void setUp() {
closeWebDriver();
Configuration.startMaximized = false;
Configuration.browserSize = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import io.appium.java_client.android.AndroidTouchAction;
import io.appium.java_client.touch.WaitOptions;
import io.appium.java_client.touch.offset.ElementOption;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.openqa.selenium.By;

import java.time.Duration;
Expand All @@ -20,7 +20,7 @@
*/
public class AndroidDragAndDropTest extends AbstractApiDemosTest {
@Test
public void dragAndDrop() {
void dragAndDrop() {
$(By.xpath(".//*[@text='Views']")).click();
$(By.xpath(".//*[@text='Drag and Drop']")).click();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;

import javax.annotation.CheckReturnValue;
import javax.annotation.Nonnull;
import java.net.MalformedURLException;
import java.net.URL;

Expand All @@ -14,6 +16,8 @@

public class AndroidDriverWithCalculator implements WebDriverProvider {
@Override
@CheckReturnValue
@Nonnull
public WebDriver createDriver(DesiredCapabilities capabilities) {
capabilities.setCapability(MobileCapabilityType.VERSION, "4.4.2");
capabilities.setCapability("automationName", "Appium");
Expand All @@ -25,7 +29,7 @@ public WebDriver createDriver(DesiredCapabilities capabilities) {
//It will launch the Calculator App in Android Device using the configurations specified in Desired Capabilities

try {
return new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
return new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
Expand Down
10 changes: 5 additions & 5 deletions src/test/java/org/selenide/examples/appium/CalculatorTest.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.selenide.examples.appium;

import com.codeborne.selenide.Configuration;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.openqa.selenium.By;

import static com.codeborne.selenide.Condition.text;
Expand All @@ -16,8 +16,8 @@
*/
public class CalculatorTest {

@Before
public void setUp() {
@BeforeEach
void setUp() {
closeWebDriver();
Configuration.startMaximized = false;
Configuration.browserSize = null;
Expand All @@ -26,7 +26,7 @@ public void setUp() {
}

@Test
public void calculator() {
void calculator() {
$(By.id("digit_2")).click();
$(By.id("op_add")).click();
$(By.id("digit_4")).click();
Expand Down

0 comments on commit ff412f8

Please sign in to comment.