Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.evolutiongaming.test.elements.casino;
- import com.evolutiongaming.test.elements.games.lobby.Lobby;
- import com.evolutiongaming.test.elements.models.Account;
- import com.evolutiongaming.test.elements.user.Player;
- import com.evolutiongaming.test.elements.utils.CasinoUtil;
- import static com.evolutiongaming.test.elements.element.ElementsFactory.provideLobby;
- import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
- import static java.util.concurrent.TimeUnit.SECONDS;
- import static org.testng.Assert.fail;
- import com.evolutiongaming.test.elements.backoffice.tablemanagement.TableListPage;
- import com.evolutiongaming.test.elements.games.lobby.Lobby;
- import com.evolutiongaming.test.elements.models.Account;
- import com.evolutiongaming.test.elements.user.Admin;
- import com.evolutiongaming.test.elements.utils.CasinoUtil;
- import com.evolutiongaming.test.elements.utils.SystemSettingsUtil;
- import com.google.common.util.concurrent.Uninterruptibles;
- import javax.inject.Inject;
- import javax.inject.Provider;
- import java.util.concurrent.TimeUnit;
- import static com.evolutiongaming.test.elements.element.ElementsFactory.provideLobby;
- import static com.evolutiongaming.test.elements.utils.CasinoUtil.acceptAlert;
- import static com.evolutiongaming.test.elements.utils.SystemSettingsUtil.getSystemPropertyTableName;
- import static com.evolutiongaming.test.elements.utils.SystemSettingsUtil.getSystemPropertyVTableName;
- public class DafabetCasino extends AbstractCasino {
- @Inject
- private Provider<Admin> adminProvider;
- private Admin freshAdmin;
- public DafabetCasino() {
- name = "Dafabet 1";
- defaultBaseUrl = "https://dafabet1.uat1.evo-test.com";
- defaultAccount = new Account("", "");
- casinoOptions.setTableWhitelist(true);
- }
- private String authUrl = defaultBaseUrl + "/ua/v1/dafabet100000001/test123";
- private String authPart;
- @Override
- public Lobby openLobby(Player player) {
- driver = player.getDriver();
- // this is strange casino and operates only on virttables - make sure both table+vttable are in launch config
- // here we are making table to disappear from flash lobby
- freshAdmin = adminProvider.get();
- TableListPage tableListPage = freshAdmin.getMainPage()
- .menu()
- .openMainPage()
- .openChangeCurrentCasinoPage()
- .selectCasinoByName(name)
- .clickSubmitButton()
- .openTableListPage();
- String tableListPageUrl = tableListPage.getDriver().getCurrentUrl();
- //updating main table
- String systemPropertyTableName = getSystemPropertyTableName();
- String systemPropertyVTableName = getSystemPropertyVTableName();
- tableListPage.editTableByName(systemPropertyTableName);
- Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS);
- String physTableConf = freshAdmin.getDriver().findElementById("table_data").getText();
- freshAdmin.getDriver().findElementById("table_data").sendKeys("\ndisplay=0\n");
- Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS);
- freshAdmin.getDriver().findElementByXPath("//input[@value='Set Table Config']").click();
- Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS);
- //updating virtualTable
- freshAdmin.getDriver().get(tableListPageUrl);
- tableListPage.openVirtualTableListPageByTableName(systemPropertyTableName)
- .editVirtualTableByName(systemPropertyVTableName);
- String vtId = freshAdmin.getDriver().getCurrentUrl().split("vt_id=")[1].split("&")[0];
- // SystemSettingsUtil.setProperty("vtable.id", vtId);//forgive me, if you can
- Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS);
- freshAdmin.getDriver().findElementById("table_data").clear();
- freshAdmin.getDriver().findElementById("table_data").sendKeys(physTableConf + "\ndisplay=as_physical_table" +
- "\nsiteAssignedTable=3"); //check in Dolphin for corresponding siteAssignedTable parameter for test user
- Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS);
- freshAdmin.getDriver().findElementByXPath("//input[@value='Save changes']").click();
- acceptAlert(getDriver());
- Uninterruptibles.sleepUninterruptibly(5, TimeUnit.SECONDS);
- freshAdmin.quit();
- try {
- authPart = CasinoUtil.getEvoStdSsid(authUrl,
- "{ \"uuid\":\"bd0e960b-d898-4297-9927-fcb37c2489a1\"," +
- "\"player\": {\"id\": \"2392474\",\"update\": false,\"firstName\": \"EVOQA001\",\"lastName\": \"EVOQA001\"," +
- "\"country\": \"CN\",\"language\": \"en\",\"currency\": \"CNY\"," +
- "\"session\": {\"id\": \"eb4ba253-cfc1-44ed-aa94-2a34af22cffe@internet\",\"ip\": \"192.168.0.1\"}}," +
- "\"config\": {\"brand\": {\"id\": \"1\",\"skin\": \"1\"},\"channel\":"+
- " {\"mobile\": false, \"wrapped\": true}}}").responseMessage;
- } catch (Exception ex) {
- fail("Something went wrong. Lobby should've opened: " + ex.getMessage());
- }
- driver.get(defaultBaseUrl + authPart);
- String currentUrl = driver.getCurrentUrl();
- logger.info("Current Url - \n[{}]", currentUrl);
- sleepUninterruptibly(5, SECONDS);
- driver.get("https://dafabet1.uat1.evo-test.com/entry?game=blackjack");
- playerConfiguration = CasinoUtil.readPlayerConfiguration(driver, casinoOptions);
- return provideLobby(player, playerConfiguration);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement