Skip to content
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

ll updates #54

Open
wants to merge 1 commit into
base: autoreview/main
Choose a base branch
from
Open
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
16 changes: 16 additions & 0 deletions AI/ll/AllStarsVisitedCongratulationPopUpView.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.project.automation.screens.starscapes;

import com.project.automation.base.BaseScreen;
import com.project.automation.elements.ws.WsButton;

public class AllStarsVisitedCongratulationPopUpView extends BaseScreen {

private static final WsButton BTN_CLAIM = new WsButton(getFormattedIdForButton("Claim_Button"), "Claim Button");
public AllStarsVisitedCongratulationPopUpView() {
super(BTN_CLAIM, "'You Have Visited All Stars!' Congratulation Pop-up");
}

public void clickOnClaimBtn() {
BTN_CLAIM.click();
}
}
29 changes: 29 additions & 0 deletions AI/ll/ApiSteps.java
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,31 @@ public void removeUserFromrrStrikes(int setId, User user) {
AppSteps.get().sleep(WAIT_FOR_API_STABLE_WORK);
}

@Step("Setting Starscapes welcoming pop up seen ")
public void setStarscapesWelcomingPopUpSeen(User user, boolean isSeen) {
setUserFlag(user.getApiToken(), UserFlags.builder().starscapesNonlinearOnboardingSeen(isSeen).build());
}

@Step("Setting Starscapes welcoming bonus awarded and tutorial seen ")
public void setStarscapesWelcomingBonusAwardedAndTutorialSeen(User user, boolean isSeen) {
setUserFlag(user.getApiToken(), UserFlags.builder().starscapesNonlinearOnboardingRewardsAwarded(isSeen).build());
}

//In order to enable Starscapes we need to set A/B test Asset Bundle Resource to CND variant
@Step("Setting Starscapes to '{variantConfig}'")
public void setStarscapes(User user, String variantConfig) {
setAbTestingConfigForUser(user, AbTestingConfig.builder().experimentConfigId(StarscapesConstants.STARSCAPES_AB_TEST_ID)
.variantConfigId(variantConfig)
.build());
}

@Step("Setting Asset Bundle Resource to '{variantConfig}'")
public void setAssetBundleResource(User user, String variantConfig) {
setAbTestingConfigForUser(user, AbTestingConfig.builder().experimentConfigId(StarscapesConstants.ASSET_BUNDLE_SOURCE_AB_TEST_ID)
.variantConfigId(variantConfig)
.build());
}

@Step("Getting Piglet Bank instance id")
private Long getPigletBankInstanceId(User user, PigletBankType type) {
PiggyBanksResponse response = PIGGY_BANK_CLIENT.getPiggyBanks(user.getApiToken());
Expand Down Expand Up @@ -574,6 +599,10 @@ public Gpu getSessionGpuMetricsFromGameBenchDashboard(String sessionId) {
.getSessionGpuMetrics(sessionId);
}

private void setUserFlag(@NonNull String userApiToken, UserFlags flags) {
USER_FLAGS_CLIENT.setUserFlag(FlagsModel.builder().apiToken(userApiToken).flags(flags).build());
}

private int getRequiredPointsForItem(GetCollectablesResponse response, int item, int level) {
int itemId = getCollectableItem(response, item).getId();
return response
Expand Down
11 changes: 11 additions & 0 deletions AI/ll/BasePMTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.project.automation.constants.CommonTestConstants;
import com.project.automation.constants.MissionsConstants;
import com.project.automation.constants.PigletBankConstants;
import com.project.automation.constants.StarscapesConstants;
import com.project.automation.enums.*;
import com.project.automation.enums.config.TestProperty;
import com.project.automation.enums.pigletbank.PigletBankType;
Expand Down Expand Up @@ -240,6 +241,16 @@ public void enableURW() {
AppSteps.get().relaunchApp();
}

@BeforeMethod(alwaysRun = true, dependsOnMethods = "beforeMethod", onlyForGroups = "base_starscapes_nonlinear")
public void enableStarscapesNonlinear() {
this.user = UserSteps.get().getUserInformation();
ApiSteps.get().setStarscapes(user, StarscapesConstants.STARSCAPES_NONLINEAR_ENABLE_ID);
ApiSteps.get().setAssetBundleResource(user, StarscapesConstants.CDN_BUNDLE_RESOURCE_ID);
ApiSteps.get().setStarscapesWelcomingPopUpSeen(user, true);
ApiSteps.get().setStarscapesWelcomingBonusAwardedAndTutorialSeen(user, true);
AppSteps.get().relaunchApp();
}

@AfterMethod(alwaysRun = true, dependsOnMethods = "tryToSaveScreenshotAndVideo", onlyForGroups = {"base_missions",
"base_global_missions", "base_global_generic_missions", "base_portrait_missions", "base_rr_strikes"})
public void cleanupMissionsProgress() {
Expand Down
9 changes: 9 additions & 0 deletions AI/ll/LobbyScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class LobbyScreen extends BaseScreen {
"Upgrade Piggy notification descriptions");
private final WsText txtUpgradePiggyNotificationHeader = new WsText("PiggyNotification_Text TextMeshProUGUI",
"Upgrade Piggy notification header");
private final WsButton btnStarscapes = new WsButton("StarscapesButton", "Starscapes Button");

public LobbyScreen() {
super(TXT_BONUS_READY_HEADER, "Lobby screen", true);
Expand Down Expand Up @@ -203,4 +204,12 @@ public String getUpgradePiggyNotificationDescriptionsText() {
public String getUpgradePiggyNotificationHeaderText() {
return txtUpgradePiggyNotificationHeader.getText();
}

public void clickStarscapesBtn() {
btnStarscapes.click();
}

public void isStarscapesBtnPresent() {
btnStarscapes.waitForIsPresent();
}
}
10 changes: 10 additions & 0 deletions AI/ll/LobbySteps.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ public void tapUpgradeNotification() {
new LobbyScreen().clickUpgradeNotification();
}

@Step("Opening Starscapes")
public void openStarscapes() {
new LobbyScreen().clickStarscapesBtn();
}

// asserting steps
@Step("Asserting that lobby is opened")
public void assertThatLobbyIsOpened() {
Expand Down Expand Up @@ -291,4 +296,9 @@ public void assertThatLSNotificationIsPresent() {
public void assertThatLSNotificationIsNotPresent() {
assertion.assertTrue(new LobbyScreen().isLsNotificationNotPresent(), "'rr Strikes' notification is present");
}

@Step("Asserting Starscapes button is present")
public void assertStarscapesButtonIsPresent() {
new LobbyScreen().isStarscapesBtnPresent();
}
}
16 changes: 16 additions & 0 deletions AI/ll/SeasonalConstellationScreen.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.project.automation.screens.starscapes;

import com.project.automation.base.BaseScreen;
import com.project.automation.elements.ws.WsButton;

public class SeasonalConstellationScreen extends BaseScreen {

private static final WsButton BTN_PLANETS = new WsButton(getFormattedIdForButton("PlanetsButton"), "Planets Button");
public SeasonalConstellationScreen() {
super(BTN_PLANETS, "Seasonal Constellation Screen");
}

public void clickOnPlanetsBtn() {
BTN_PLANETS.click();
}
}
29 changes: 29 additions & 0 deletions AI/ll/SectorsScreen.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.project.automation.screens.starscapes;

import com.project.automation.base.BaseScreen;
import com.project.automation.elements.ws.WsButton;

public class SectorsScreen extends BaseScreen {

private final static WsButton BTN_SEASONAL_STARS = new WsButton(getFormattedIdForButton("SectorIcon_Seasonal(Clone)>Button"), "Seasonal Stars");
private final WsButton btnHomeSector = new WsButton(getFormattedIdForButton("SectorPlaceholder_Beginner>SectorIconBase(Clone)>Button"), "Home Sector");
private final WsButton btnCoinSector = new WsButton(getFormattedIdForButton("SectorPlaceholder_2>SectorIconBase(Clone)>Button"), "Coin Sector");
private final WsButton btnOrbsSector = new WsButton(getFormattedIdForButton("SectorPlaceholder_3>SectorIconBase(Clone)>Button"), "Orb Sector");
private final WsButton btnrrSector = new WsButton(getFormattedIdForButton("SectorPlaceholder_3>SectorIconBase(Clone)>Button"), "rr Sector");

public SectorsScreen() {
super(BTN_SEASONAL_STARS, "Starscapes Sectors Screen");
}

public void clickOnSeasonalStarsBtn() {
BTN_SEASONAL_STARS.click();
}

public void clickOnHomeSectorBtn() {
btnHomeSector.click();
}

public void clickOnCoinSectorBtn() {
btnCoinSector.click();
}
}
16 changes: 16 additions & 0 deletions AI/ll/StarscapesNonlinearRankingView.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.project.automation.screens.views;

import com.project.automation.base.BaseScreen;
import com.project.automation.elements.ws.WsButton;

public class StarscapesNonlinearRankingView extends BaseScreen {

public static final WsButton BTN_CLOSE = new WsButton(getFormattedIdForButton("Close_Button"), "Close Button");
public StarscapesNonlinearRankingView() {
super(BTN_CLOSE, "Ranking View");
}

public void clickOnCloseBtn() {
BTN_CLOSE.click();
}
}
12 changes: 12 additions & 0 deletions AI/ll/StarscapesNonlinearRanksUnlockedCongratulationPopUpView.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.project.automation.screens.views;

import com.project.automation.base.BaseScreen;
import com.project.automation.elements.ws.WsButton;

public class StarscapesNonlinearRanksUnlockedCongratulationPopUpView extends BaseScreen {

public static final WsButton BTN_GREAT = new WsButton(getFormattedIdForButton("UpgradeButton"), "Great Button");
public StarscapesNonlinearRanksUnlockedCongratulationPopUpView() {
super(BTN_GREAT, "'Ranks Unlocked' Congratulation Pop-up");
}
}
36 changes: 36 additions & 0 deletions AI/ll/StarscapesNonlinearTopBarMenu.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.project.automation.screens.menus;

import com.project.automation.base.BaseScreen;
import com.project.automation.elements.ws.WsButton;

public class StarscapesNonlinearTopBarMenu extends BaseScreen {

private final static WsButton BTN_INFO = new WsButton(getFormattedIdForButton("InfoButton>InfoIcon"), "Info Button");
private final WsButton btnHome = new WsButton(getFormattedIdForButton("HomeButton>HomeIcon"), "Home Button");
private final WsButton btnRankWidget = new WsButton(getFormattedIdForButton("RankWidget>Button"), "Rank Widget");
private final WsButton btnGalaxy = new WsButton(getFormattedIdForButton("GalaxyButton"), "Galaxy Button");

public StarscapesNonlinearTopBarMenu() {
super(BTN_INFO, "Starscapes Frame Screen");
}

public void clickOnInfoBtn() {
BTN_INFO.click();
}

public void clickOnHomeBtn() {
btnHome.click();
}

public void clickOnRankWidgetBtn() {
btnRankWidget.click();
}

public void clickOnGalaxyBtn() {
btnGalaxy.click();
}

public boolean isRankWidgetPresent() {
return btnRankWidget.waitForIsPresent();
}
}
31 changes: 31 additions & 0 deletions AI/ll/StarscapesNonlinearTutorialView.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.project.automation.screens.views;

import com.project.automation.base.BaseScreen;
import com.project.automation.elements.ws.WsButton;

public class StarscapesNonlinearTutorialView extends BaseScreen {

private static final WsButton BTN_CLOSE = new WsButton(getFormattedIdForButton("StarscapesNonLinear_InfoPopup(Clone)>CloseButton"), "Close Button");
private final WsButton btnNextArrow = new WsButton(getFormattedIdForButton("ButtonArrowNext"), "Next Arrow");
private final WsButton btnPreviousArrow = new WsButton(getFormattedIdForButton("ButtonArrowPrevious"), "Previous Arrow");

public StarscapesNonlinearTutorialView() {
super(BTN_CLOSE, "Starscapes Tutorial View");
}

public void clickOnNextArrow() {
btnNextArrow.click();
}

public void clickOnPreviousArrow() {
btnPreviousArrow.click();
}

public boolean isNextArrowPresent() {
return btnNextArrow.waitForIsPresent();
}

public boolean isPreviousArrowPresent() {
return btnPreviousArrow.waitForIsPresent();
}
}
17 changes: 17 additions & 0 deletions AI/ll/StarscapesNonlinearWelcomeBonusPopUpView.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.project.automation.screens.views;

import com.project.automation.base.BaseScreen;
import com.project.automation.elements.ws.WsButton;

public class StarscapesNonlinearWelcomeBonusPopUpView extends BaseScreen {

private static final WsButton BTN_CLAIM = new WsButton(getFormattedIdForButton("Button_Basic9Sclice_Green_WithShine"), "Check Button");

public StarscapesNonlinearWelcomeBonusPopUpView() {
super(BTN_CLAIM, "Starscapes Welcome Bonus Pop-up");
}

public void clickOnClaimBtn() {
BTN_CLAIM.click();
}
}
17 changes: 17 additions & 0 deletions AI/ll/StarscapesNonlinearWelcomePopUpView.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.project.automation.screens.views;

import com.project.automation.base.BaseScreen;
import com.project.automation.elements.ws.WsButton;

public class StarscapesNonlinearWelcomePopUpView extends BaseScreen {

private static final WsButton btnCheck = new WsButton(getFormattedIdForButton("Button_Basic9Sclice_Green_WithShine"), "Check Button");

public StarscapesNonlinearWelcomePopUpView() {
super(btnCheck, "Starscapes Welcome Pop-up");
}

public void clickOnCheckBtn() {
btnCheck.click();
}
}
36 changes: 36 additions & 0 deletions AI/ll/StarscapesSteps.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.project.automation.steps.ui.starscapes;

import com.project.automation.base.BaseSteps;
import com.project.automation.screens.starscapes.SectorsScreen;
import com.project.automation.screens.menus.StarscapesNonlinearTopBarMenu;

public class StarscapesSteps extends BaseSteps {

private static ThreadLocal<BaseSteps> stepsInstanceHolder = new InheritableThreadLocal<>();

public static synchronized StarscapesSteps get() {
return (StarscapesSteps) get(stepsInstanceHolder, StarscapesSteps.class).get();
}

//Action steps
public void goToLobby() {
new StarscapesNonlinearTopBarMenu().clickOnHomeBtn();
}

public void openTutorial() {
new StarscapesNonlinearTopBarMenu().clickOnInfoBtn();
}

public void openHomeSector() {
new SectorsScreen().clickOnHomeSectorBtn();
}

public void openSeasonalConstellation() {
new SectorsScreen().clickOnSeasonalStarsBtn();
}

//Assertion steps
public void assertThatStarscapesSectorsScreenIsOpen() {
assertion.assertTrue(new SectorsScreen().isScreenPresent(), "Starscapes Sectors Screen is now present");
}
}