I can't get any appium tests to run
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Bắt đầu bằng cách xem xét các exception stacktrace trong gist được liên kết và tái hiện bài kiểm thử từ appiumTest với các phiên bản Android, trình giả lập, Appium và Java client đã nêu. So sánh lỗi với MainActivity.kt, activity_main.xml và các dependency Gradle được cung cấp; để hoàn tất, cần xác định một lỗi cụ thể có thể tái hiện và đưa ra cách sửa rõ ràng hoặc xác nhận lỗi của client.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
I wrote the code for an Android app that has one button. I wrote an appium test case but I'm just getting error after error.
Environment
- Appium - Java client: 2.5.1
- Desktop OS/version used to run Appium if necessary: Mac Ventura 13.0.1
- Node version: v18.19.1
- Mobile platform/version under test: Android 33
- Real device or emulator/simulator: Pixel 7 API 34
Details
I keep getting so many random errors I don't understand what's happening. (I am a university student and complete newbie to Appium )
Code To Reproduce Issue
here's the code for the single-button app:
MainActivity.kt
package com.example.singleactionapp
import android.os.Bundle
import android.view.View
import android.widget.Button
import android.widget.EditText
import android.widget.TextView
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import com.example.singleactionapp.ui.theme.SingleActionAppTheme
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val button = findViewById<Button>(R.id.button)
val message = findViewById<TextView>(R.id.message)
var messageCounter = 0
button.setOnClickListener {
messageCounter += 1
message.visibility = View.VISIBLE
message.text = "Button clicked $messageCounter times"
}
}
}
and activity_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="161dp"
android:layout_marginTop="341dp"
android:layout_marginEnd="162dp"
android:layout_marginBottom="342dp"
android:text="click here"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="146dp"
android:layout_marginTop="25dp"
android:layout_marginEnd="147dp"
android:layout_marginBottom="298dp"
android:text="Button was clicked"
android:textAlignment="center"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
this is the code to by appium test:
package com.example.singleactionapp;
// This sample code supports Appium Java client >=9
// https://github.com/appium/java-client
import java.net.MalformedURLException;
import java.net.URL;
import java.time.Duration;
import java.util.Arrays;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.openqa.selenium.*;
import io.appium.java_client.AppiumBy;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.options.BaseOptions;
public class appiumTest{
private AndroidDriver driver;
@BeforeEach
public void setUp() {
BaseOptions options = new BaseOptions()
.amend("platformName", "Android")
.amend("appium:automationName", "UiAutomator2")
.amend("appium:platformVersion", "14.0")
.amend("appium:deviceName", "Pixel 7 API 34")
.amend("appium:udid", "emulator-5554")
.amend("appium:appPackage", "com.example.singleactionapp")
.amend("appium:appActivity", ".MainActivity ")
.amend("appium:noReset", "true")
.amend("appium:ensureWebviewsHavePages", true)
.amend("appium:nativeWebScreenshot", true)
.amend("appium:newCommandTimeout", 3600)
.amend("appium:connectHardwareKeyboard", true);
driver = new AndroidDriver(this.getUrl(), options);
}
private URL getUrl() {
try {
return new URL("http://127.0.0.1:4723");
} catch (MalformedURLException e) {
e.printStackTrace();
}
return null;
}
@Test
public void sampleTest() {
WebElement el1 = driver.findElement(AppiumBy.id("com.example.singleactionapp:id/button"));
el1.click();
WebElement el2 = driver.findElement(AppiumBy.id("com.example.singleactionapp:id/message"));
el2.click();
}
@AfterEach
public void tearDown() {
driver.quit();
}
}
and this is my gradle dependencies:
dependencies {
implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.2")
implementation("androidx.activity:activity-compose:1.8.2")
implementation(platform("androidx.compose:compose-bom:2023.08.00"))
implementation("androidx.compose.ui:ui")
implementation("androidx.compose.ui:ui-graphics")
implementation("androidx.compose.ui:ui-tooling-preview")
implementation("androidx.compose.material3:material3")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
testImplementation("junit:junit:4.13.2")
testImplementation ("io.appium:java-client:9.2.0")
testImplementation("org.seleniumhq.selenium:selenium-api:4.18.0")
testImplementation("org.seleniumhq.selenium:selenium-remote-driver:4.18.0")
testImplementation("org.seleniumhq.selenium:selenium-support:4.18.0")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
androidTestImplementation(platform("androidx.compose:compose-bom:2023.08.00"))
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
androidTestImplementation("org.junit.jupiter:junit-jupiter:5.8.1")
debugImplementation("androidx.compose.ui:ui-tooling")
debugImplementation("androidx.compose.ui:ui-test-manifest")
}
Exception Stacktraces
[] https://gist.github.com/Dameonn24/13ccbfc77d577c8acd73c9c35e0a14b6
- Ngôn ngữ chính
- Java
- Star
- 1.3k
- Fork
- 755
- Merge trung bình
- 5 ngày 14 giờ
- Pull request đã merge (30 ngày)
- 8
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của appium/java-client
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
appium/java-client#2426 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 50/100
appium/java-client#2372 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
appium/java-client#2368 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 30/100
appium/java-client#2341 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
appium/java-client#2323 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của appium/java-client
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
OpenAPITools/openapi-generator#25014 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
openhab/openhab-core#5847 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
apache/parquet-java#3820 ·
Maintainer thường phản hồi trong vòng 1 ngày