Skip to content

test: Run tests with appium3 beta #2292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ jobs:

- name: Install Appium
if: ${{ matrix.e2e-tests }}
run: npm install --location=global appium
run: npm install --location=global appium@beta

- name: Install UIA2 driver
if: matrix.e2e-tests == 'android' || matrix.e2e-tests == 'flutter-android'
run: appium driver install uiautomator2
run: appium driver install uiautomator2@beta

- name: Install Flutter Integration driver
if: matrix.e2e-tests == 'flutter-android' || matrix.e2e-tests == 'flutter-ios'
run: appium driver install appium-flutter-integration-driver --source npm
# - name: Install Flutter Integration driver
# if: matrix.e2e-tests == 'flutter-android' || matrix.e2e-tests == 'flutter-ios'
# run: appium driver install appium-flutter-integration-driver --source npm

- name: Run Android E2E tests
if: matrix.e2e-tests == 'android'
Expand All @@ -113,16 +113,16 @@ jobs:
disable-animations: true
target: ${{ env.ANDROID_EMU_TARGET }}

- name: Run Flutter Android E2E tests
if: matrix.e2e-tests == 'flutter-android'
uses: reactivecircus/android-emulator-runner@v2
with:
script: ./gradlew e2eFlutterTest -Pplatform="android" -Pselenium.version=$latest_snapshot -PisCI -PflutterApp=${{ env.FLUTTER_ANDROID_APP }}
api-level: ${{ env.ANDROID_SDK_VERSION }}
avd-name: ${{ env.ANDROID_EMU_NAME }}
disable-spellchecker: true
disable-animations: true
target: ${{ env.ANDROID_EMU_TARGET }}
# - name: Run Flutter Android E2E tests
# if: matrix.e2e-tests == 'flutter-android'
# uses: reactivecircus/android-emulator-runner@v2
# with:
# script: ./gradlew e2eFlutterTest -Pplatform="android" -Pselenium.version=$latest_snapshot -PisCI -PflutterApp=${{ env.FLUTTER_ANDROID_APP }}
# api-level: ${{ env.ANDROID_SDK_VERSION }}
# avd-name: ${{ env.ANDROID_EMU_NAME }}
# disable-spellchecker: true
# disable-animations: true
# target: ${{ env.ANDROID_EMU_TARGET }}

- name: Select Xcode
if: matrix.e2e-tests == 'ios' || matrix.e2e-tests == 'flutter-ios'
Expand All @@ -137,14 +137,14 @@ jobs:
os_version: "${{ env.IOS_PLATFORM_VERSION }}"
- name: Install XCUITest driver
if: matrix.e2e-tests == 'ios' || matrix.e2e-tests == 'flutter-ios'
run: appium driver install xcuitest
run: appium driver install xcuitest@beta
- name: Prebuild XCUITest driver
if: matrix.e2e-tests == 'ios' || matrix.e2e-tests == 'flutter-ios'
run: appium driver run xcuitest build-wda --sdk=${{ env.IOS_PLATFORM_VERSION }} --name='${{ env.IOS_DEVICE_NAME }}'
- name: Run iOS E2E tests
if: matrix.e2e-tests == 'ios'
run: ./gradlew e2eIosTest -PisCI -Pselenium.version=$latest_snapshot

- name: Run Flutter iOS E2E tests
if: matrix.e2e-tests == 'flutter-ios'
run: ./gradlew e2eFlutterTest -Pplatform="ios" -Pselenium.version=$latest_snapshot -PisCI -PflutterApp=${{ env.FLUTTER_IOS_APP }}
# - name: Run Flutter iOS E2E tests
# if: matrix.e2e-tests == 'flutter-ios'
# run: ./gradlew e2eFlutterTest -Pplatform="ios" -Pselenium.version=$latest_snapshot -PisCI -PflutterApp=${{ env.FLUTTER_IOS_APP }}
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ public void setupEach() {

@Test
public void addCustomCommandTest() {
driver.addCommand(HttpMethod.GET, "/sessions", "getSessions");
final Response getSessions = driver.execute("getSessions");
assertNotNull(getSessions.getSessionId());
driver.addCommand(HttpMethod.GET, "/status", "getStatus");
assertNotNull(driver.execute("getStatus"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.openqa.selenium.logging.Logs;
import org.openqa.selenium.remote.Response;

import java.time.Duration;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -154,22 +155,7 @@ public Cookie getCookieNamed(String name) {

@Override
public Timeouts timeouts() {
return new Timeouts() {
@Override
public Timeouts implicitlyWait(long time, TimeUnit unit) {
return this;
}

@Override
public Timeouts setScriptTimeout(long time, TimeUnit unit) {
return this;
}

@Override
public Timeouts pageLoadTimeout(long time, TimeUnit unit) {
return this;
}
};
return new TimeoutsImpl();
}

@Override
Expand All @@ -184,6 +170,33 @@ public Logs logs() {
};
}

private static class TimeoutsImpl implements Timeouts {

public Timeouts implicitlyWait(long time, TimeUnit unit) {
return this;
}

public Timeouts implicitlyWait(Duration duration) {
return this;
}

public Timeouts setScriptTimeout(long time, TimeUnit unit) {
return this;
}

public Timeouts setScriptTimeout(Duration duration) {
return this;
}

public Timeouts pageLoadTimeout(long time, TimeUnit unit) {
return this;
}

public Timeouts pageLoadTimeout(Duration duration) {
return this;
}
}

public static class StubAndroidDriver extends AbstractStubWebDriver {

@Override
Expand Down