-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from ThePalaceProject/refactoring
updated settings, added screenshot hook
- Loading branch information
Showing
11 changed files
with
99 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package framework.utilities; | ||
|
||
import aquality.appium.mobile.application.AqualityServices; | ||
import org.openqa.selenium.OutputType; | ||
|
||
public class ScreenshotUtils { | ||
public static byte[] getScreenshot() { | ||
AqualityServices.getApplication().getDriver().getPageSource(); | ||
return AqualityServices.getApplication().getDriver().getScreenshotAs(OutputType.BYTES); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package hooks; | ||
|
||
import framework.configuration.ConfigurationStorage; | ||
import io.cucumber.java.After; | ||
import io.cucumber.java.Scenario; | ||
|
||
public class CredentialsHooks { | ||
@After(order = 2) | ||
public void unlockCredentials(Scenario scenario) { | ||
ConfigurationStorage.unlockCredentials(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package hooks; | ||
|
||
import aquality.appium.mobile.application.AqualityServices; | ||
import com.google.inject.Inject; | ||
import constants.keysForContext.ScenarioContextKey; | ||
import framework.utilities.ScreenshotUtils; | ||
import framework.utilities.ScenarioContext; | ||
import io.cucumber.java.After; | ||
import io.cucumber.java.Before; | ||
import io.cucumber.java.Scenario; | ||
|
||
public class ScreenshotHooks { | ||
private ScenarioContext context; | ||
|
||
@Inject | ||
public ScreenshotHooks(ScenarioContext context) { | ||
this.context = context; | ||
} | ||
|
||
@Before | ||
public void startScenarioLogger(Scenario scenario) { | ||
context.add(ScenarioContextKey.SCENARIO_KEY, scenario); | ||
} | ||
|
||
@After(order = 4) | ||
public void takeScreenshot(Scenario scenario) { | ||
AqualityServices.getLogger().info("Taking screenshot"); | ||
scenario.attach(ScreenshotUtils.getScreenshot(), "image/png", "screenshot.png"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters