Skip to content
This repository has been archived by the owner on Jun 1, 2024. It is now read-only.

fix: including missing files #1476

Merged
merged 2 commits into from
Apr 7, 2021
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package br.com.zup.beagle.appiumapp.activity

import android.net.Uri
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import br.com.zup.beagle.android.utils.newServerDrivenIntent
import br.com.zup.beagle.android.view.ScreenRequest
import br.com.zup.beagle.appiumapp.R

class BffDeepLinkActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

val data: Uri? = intent?.data
val bffUrl = data.toString().substringAfter("appiumapp://bffurl/")

val intent = this.newServerDrivenIntent<AppBeagleActivity>(ScreenRequest(bffUrl))
startActivity(intent)
finish()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ import io.appium.java_client.touch.offset.PointOption
import org.apache.commons.io.FileUtils
import org.apache.commons.io.FilenameUtils
import org.openqa.selenium.By
import org.openqa.selenium.JavascriptExecutor
import org.openqa.selenium.ScreenOrientation
import java.io.File
import java.util.HashMap


abstract class AbstractStep {
Expand All @@ -47,21 +49,27 @@ abstract class AbstractStep {
return driver!!
}

protected fun loadBffScreenFromMainScreen(){
protected fun loadBffScreenFromMainScreen() {
val mainScreen = MainScreen(getDriver())
mainScreen.setBffUrl(SuiteSetup.getBffBaseUrl() + bffRelativeUrlPath)
mainScreen.clickOnGoButton()
}

protected fun loadBffScreenFromDeepLink(){
getDriver().get("appiumapp://bffurl/" + SuiteSetup.getBffBaseUrl() + bffRelativeUrlPath)
protected fun loadBffScreenFromDeepLink() {
if (SuiteSetup.isAndroid()) {
val params = HashMap<String, String>()
params["url"] = "appiumapp://bffurl/" + SuiteSetup.getBffBaseUrl() + bffRelativeUrlPath
params["package"] = "br.com.zup.beagle.appiumapp"
(getDriver() as JavascriptExecutor).executeScript("mobile:deepLink", params)
} else {
// TODO: iOS
}
}

protected fun loadBffScreen(){
protected fun loadBffScreen() {
if (SuiteSetup.isAndroid()) {
loadBffScreenFromDeepLink()
}
else{
} else {
loadBffScreenFromMainScreen()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ class HookManager {
} catch (exception: Exception) {
println("ERROR taking a screenshot on error: ${exception.message}")
}

// Always restarts after a test failure because the failure might be caused by a random app crash
SuiteSetup.restartApp()
}

// Android tests by default won't restart app anymore because they now use deep links to load bff screens
Expand Down