Skip to content

Commit

Permalink
fix(workflow): 🐛 fixed failing test workflow (#827)
Browse files Browse the repository at this point in the history
  • Loading branch information
WasiqB authored May 18, 2024
1 parent 4909e88 commit c4b4d8a
Show file tree
Hide file tree
Showing 15 changed files with 10,767 additions and 7,689 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ body:
attributes:
label: Issue Version
description: 🔢 What version of the framework is this bug related to?
placeholder: v1.0.0
placeholder: Effected version
validations:
required: true

Expand Down
45 changes: 16 additions & 29 deletions .github/workflows/_test-core-java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ on:
type: boolean
description: Start Appium server
default: false
emulator-name:
type: string
description: Emulator / Simulator name
default: Pixel_7_Pro
emulator-target:
type: string
description: Emulator target image
Expand All @@ -39,6 +43,14 @@ on:
type: string
description: Emulator SDK channel
default: stable
simulator-name:
type: string
description: iOS Simulator Name
default: iPhone 15
simulator-version:
type: number
description: iOS Simulator Name
default: 17.4
run-grid:
type: boolean
description: Start Selenium Grid
Expand Down Expand Up @@ -95,42 +107,16 @@ jobs:
if: ${{ inputs.run-ios }}
uses: futureware-tech/simulator-action@v3
with:
model: 'iPhone 14'
model: ${{ inputs.simulator-name }}
os: 'iOS'
os_version: 16.2
os_version: ${{ inputs.simulator-version }}
shutdown_after_job: true

- name: Cache AVD snapshot
uses: actions/cache@v4
if: ${{ inputs.run-android }}
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ inputs.emulator-version }}-${{ inputs.emulator-target }}-${{ inputs.emulator-arch }}

- name: Create AVD and generate snapshot for caching
if: ${{ inputs.run-android }}
uses: reactivecircus/android-emulator-runner@v2
with:
avd-name: Pixel_7_Pro
api-level: ${{ inputs.emulator-version }}
target: ${{ inputs.emulator-target }}
arch: ${{ inputs.emulator-arch }}
profile: pixel_6_pro
channel: ${{ inputs.emulator-channel }}
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching..."
pre-emulator-launch-script: avdmanager list device

- name: All Test execution
if: ${{ inputs.run-android }}
uses: reactivecircus/android-emulator-runner@v2
with:
avd-name: Pixel_7_Pro
avd-name: ${{ inputs.emulator-name }}
api-level: ${{ inputs.emulator-version }}
target: ${{ inputs.emulator-target }}
arch: ${{ inputs.emulator-arch }}
Expand All @@ -139,6 +125,7 @@ jobs:
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
pre-emulator-launch-script: avdmanager list device
script: mvn verify org.jacoco:jacoco-maven-plugin:prepare-agent -f core-java/pom.xml -Dsuite-name=${{ inputs.suite-name }} -Pcoverage-test

- name: All ${{ inputs.suite-name }} Test execution
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/test-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
uses: ./.github/workflows/_test-core-java.yml
with:
suite-name: testng-web-local
runs-on: macos-latest
runs-on: macos-13

test-web-bs:
needs:
Expand Down Expand Up @@ -129,14 +129,18 @@ jobs:
- check-cloud
uses: ./.github/workflows/_test-core-java.yml
with:
runs-on: macos-latest
runs-on: macos-12
suite-name: testng-mobile-local
run-appium: true
run-ios: true
run-android: true
emulator-name: Pixel_8_Pro
emulator-version: 30
emulator-channel: canary
emulator-arch: x86
emulator-target: aosp_atd
simulator-name: iPhone 14
simulator-version: 16.2

# test-mobile-web:
# needs:
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
<a href="https://central.sonatype.com/artifact/io.github.boykaframework/boyka-framework">
<img src="https://img.shields.io/maven-central/v/io.github.boykaframework/boyka-framework.svg?style=for-the-badge" alt="Maven Central" />
</a>
<a href="https://github.com/BoykaFramework/boyka-framework/releases/tag/v1.0.0">
<img src="https://img.shields.io/github/downloads/BoykaFramework/boyka-framework/v1.0.0/total?color=brightgreen&label=Downloads%20for%20v1.0.0&logo=GitHub&style=for-the-badge" alt="GitHub releases" />
<a href="https://github.com/BoykaFramework/boyka-framework/releases/tag/v1.1.0">
<img src="https://img.shields.io/github/downloads/BoykaFramework/boyka-framework/v1.1.0/total?color=brightgreen&label=Downloads%20for%20v1.1.0&logo=GitHub&style=for-the-badge" alt="GitHub releases" />
</a>
<a href="https://github.com/BoykaFramework/boyka-framework/blob/master/LICENSE">
<img src="https://img.shields.io/github/license/BoykaFramework/boyka-framework.svg?style=for-the-badge" alt="license" />
Expand Down Expand Up @@ -88,7 +88,7 @@ Use this space to tell a little more about your project and how it can be used.
<dependency>
<groupId>io.github.boykaframework</groupId>
<artifactId>boyka-framework</artifactId>
<version>1.0.0</version>
<version>1.1.0</version>
</dependency>
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package io.github.boykaframework.config.ui.mobile.device;

import static io.github.boykaframework.enums.Speed.FAST;
import static io.github.boykaframework.enums.Speed.NORMAL;

import io.github.boykaframework.enums.Speed;
import lombok.Data;
Expand All @@ -31,5 +31,5 @@
public class SwipeSetting {
private int distance = 75;
private int maxSwipeUntilFound = 5;
private Speed speed = FAST;
private Speed speed = NORMAL;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@

package io.github.boykaframework.testng.ui.saucedemo;

import static io.github.boykaframework.actions.device.DeviceActions.onDevice;
import static io.github.boykaframework.actions.drivers.DriverActions.withDriver;
import static io.github.boykaframework.actions.drivers.WindowActions.onWindow;
import static io.github.boykaframework.manager.ParallelSession.clearSession;
import static io.github.boykaframework.manager.ParallelSession.createSession;
import static java.text.MessageFormat.format;

import io.github.boykaframework.actions.device.DeviceActions;
import io.github.boykaframework.actions.drivers.ContextActions;
import io.github.boykaframework.actions.drivers.DriverActions;
import io.github.boykaframework.actions.drivers.WindowActions;
import io.github.boykaframework.enums.PlatformType;
import io.github.boykaframework.exception.FrameworkError;
import io.github.boykaframework.manager.ParallelSession;
import io.github.boykaframework.testng.ui.saucedemo.actions.SauceDemoActions;
import org.testng.ITestResult;
import org.testng.annotations.AfterClass;
Expand All @@ -48,8 +49,7 @@ public class SauceDemoTest {
@AfterMethod
public void afterMethod (final ITestResult result) {
if (!result.isSuccess ()) {
WindowActions.onWindow ()
.takeScreenshot ();
onWindow ().takeScreenshot ();
}
}

Expand All @@ -62,9 +62,8 @@ public void afterMethod (final ITestResult result) {
@BeforeClass (description = "Setup test class")
@Parameters ({ "platformType", "driverKey" })
public void setupTestClass (final PlatformType platformType, final String driverKey) {
ParallelSession.createSession (format ("SauceDemoTest-{0}", platformType), platformType, driverKey);
DeviceActions.onDevice ()
.startRecording ();
createSession (format ("SauceDemoTest-{0}", platformType), platformType, driverKey);
onDevice ().startRecording ();
this.sauceDemo = new SauceDemoActions ();
}

Expand All @@ -73,11 +72,9 @@ public void setupTestClass (final PlatformType platformType, final String driver
*/
@AfterClass (description = "Tear down test class")
public void tearDownTestClass () {
DeviceActions.onDevice ()
.stopRecording ();
DriverActions.withDriver ()
.saveLogs ();
ParallelSession.clearSession ();
onDevice ().stopRecording ();
withDriver ().saveLogs ();
clearSession ();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@

package io.github.boykaframework.testng.ui.wdio;

import static io.github.boykaframework.actions.device.DeviceActions.onDevice;
import static io.github.boykaframework.actions.drivers.ContextActions.withContext;
import static io.github.boykaframework.actions.drivers.DriverActions.withDriver;
import static io.github.boykaframework.actions.elements.ClickableActions.withMouse;
import static io.github.boykaframework.actions.elements.ElementActions.onElement;
import static io.github.boykaframework.actions.elements.FingerActions.withFinger;
import static io.github.boykaframework.actions.elements.TextBoxActions.onTextBox;
import static io.github.boykaframework.enums.PlatformType.ANDROID;
import static io.github.boykaframework.manager.ParallelSession.clearSession;
import static io.github.boykaframework.manager.ParallelSession.createSession;
Expand All @@ -29,12 +32,8 @@
import static io.github.boykaframework.testng.ui.wdio.pages.SignUpPage.signUpPage;
import static io.github.boykaframework.testng.ui.wdio.pages.WDIOHomePage.wdioHomePage;
import static io.github.boykaframework.testng.ui.wdio.pages.WebViewPage.webViewPage;
import static java.text.MessageFormat.format;

import io.github.boykaframework.actions.device.DeviceActions;
import io.github.boykaframework.actions.drivers.ContextActions;
import io.github.boykaframework.actions.drivers.WindowActions;
import io.github.boykaframework.actions.elements.TextBoxActions;
import io.github.boykaframework.enums.PlatformType;
import org.testng.ITestResult;
import org.testng.annotations.AfterClass;
Expand Down Expand Up @@ -70,18 +69,16 @@ public void afterMethod (final ITestResult result) {
@BeforeClass (description = "Setup test class")
@Parameters ({ "platformType", "driverKey" })
public void setupTestClass (final PlatformType platformType, final String driverKey) {
createSession (format ("WdioDemoTest-{0}", platformType), platformType, driverKey);
DeviceActions.onDevice ()
.startRecording ();
createSession (platformType, driverKey);
onDevice ().startRecording ();
}

/**
* Tear down test class by closing driver.
*/
@AfterClass (description = "Tear down test class")
public void tearDownTestClass () {
DeviceActions.onDevice ()
.stopRecording ();
onDevice ().stopRecording ();
withDriver ().saveLogs ();
clearSession ();
}
Expand Down Expand Up @@ -113,16 +110,12 @@ public void testSignUp () {
withFinger (wdioHomePage ().getLoginTab ()).tap ();

withFinger (signUpPage ().getSignUpTab ()).tap ();
TextBoxActions.onTextBox (signUpPage ().getEmail ())
.enterText (userName);
TextBoxActions.onTextBox (signUpPage ().getPassword ())
.enterText (password);
TextBoxActions.onTextBox (signUpPage ().getConfirmPassword ())
.enterText (password);
onTextBox (signUpPage ().getEmail ()).enterText (userName);
onTextBox (signUpPage ().getPassword ()).enterText (password);
onTextBox (signUpPage ().getConfirmPassword ()).enterText (password);

if (getSession ().getPlatformType () == ANDROID) {
DeviceActions.onDevice ()
.hideKeyboard ();
onDevice ().hideKeyboard ();
}

withFinger (signUpPage ().getSignUp ()).tap ();
Expand All @@ -141,14 +134,12 @@ public void testWebView () {
}

private void verifyWebView () {
ContextActions.withContext ()
.switchToWebView ();
withContext ().switchToWebView ();

onElement (webViewPage ().getPageTitle ()).verifyText ()
.isEqualTo ("Next-gen browser and mobile automation test framework for Node.js");

ContextActions.withContext ()
.switchToNative ();
withContext ().switchToNative ();

onElement (wdioHomePage ().getWebViewTab ()).verifyIsDisplayed ()
.isTrue ();
Expand Down
Loading

0 comments on commit c4b4d8a

Please sign in to comment.