Commit 0836a1f2 authored by Aneta Steimarova's avatar Aneta Steimarova

#941 Created i-tests for game Night Watch bonus difficulty

parent 0b2c2e29
......@@ -48,6 +48,7 @@ public class GameRulesHelper {
public static final float BONUS_MAX_LID_TIME = 2.5f;
public static final float BONUS_MIN_LID_TIME = 1.2f;
public static final int NUMBER_OF_ROUNDS = 12;
public static final int BONUS_NUMBER_OF_ROUNDS = 20;
public static final int[] ZERO_NUMBER_OF_SHADOWED = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
public static float getCurrentLidTime(NightWatchDifficulty nightWatchDifficulty, int currentRound){
......
TestGamePursuitEasyNoneStar
TestGamePursuitEasyOneStar
TestGamePursuitEasyTwoStar
TestGamePursuitEasyThreeStar
TestGamePursuitMediumNoneStar
TestGamePursuitMediumOneStar
TestGamePursuitMediumTwoStar
TestGamePursuitMediumThreeStar
TestGamePursuitHardNoneStar
TestGamePursuitHardOneStar
TestGamePursuitHardTwoStar
TestGamePursuitHardThreeStar
TestGamePursuitBonusNoneStar
TestGamePursuitBonusOneStar
TestGamePursuitBonusTwoStars
TestGamePursuitBonusThreeStars
\ No newline at end of file
TestGameNightWatchEasyNoneStar
TestGameNightWatchEasyOneStar
TestGameNightWatchEasyTwoStar
TestGameNightWatchEasyThreeStar
TestGameNightWatchMediumNoneStar
TestGameNightWatchMediumOneStar
TestGameNightWatchMediumTwoStar
TestGameNightWatchMediumThreeStar
TestGameNightWatchHardNoneStar
TestGameNightWatchHardOneStar
TestGameNightWatchHardTwoStar
TestGameNightWatchHardThreeStar
TestGameNightWatchBonusNoneStar
TestGameNightWatchBonusOneStar
TestGameNightWatchBonusTwoStars
TestGameNightWatchBonusThreeStars
\ No newline at end of file
......@@ -61,6 +61,10 @@ import cz.nic.tablexia.testing.games.kidnapping.TestGameKidnappingMediumNoneStar
import cz.nic.tablexia.testing.games.kidnapping.TestGameKidnappingMediumOneStar;
import cz.nic.tablexia.testing.games.kidnapping.TestGameKidnappingMediumThreeStar;
import cz.nic.tablexia.testing.games.kidnapping.TestGameKidnappingMediumTwoStar;
import cz.nic.tablexia.testing.games.night_watch.TestGameNightWatchBonusNoneStar;
import cz.nic.tablexia.testing.games.night_watch.TestGameNightWatchBonusOneStar;
import cz.nic.tablexia.testing.games.night_watch.TestGameNightWatchBonusThreeStars;
import cz.nic.tablexia.testing.games.night_watch.TestGameNightWatchBonusTwoStars;
import cz.nic.tablexia.testing.games.night_watch.TestGameNightWatchEasyNoneStar;
import cz.nic.tablexia.testing.games.night_watch.TestGameNightWatchEasyOneStar;
import cz.nic.tablexia.testing.games.night_watch.TestGameNightWatchEasyThreeStar;
......@@ -245,6 +249,10 @@ public class TestRunner {
listOfTests.add(TestGameNightWatchHardOneStar.class);
listOfTests.add(TestGameNightWatchHardTwoStar.class);
listOfTests.add(TestGameNightWatchHardThreeStar.class);
listOfTests.add(TestGameNightWatchBonusNoneStar.class);
listOfTests.add(TestGameNightWatchBonusOneStar.class);
listOfTests.add(TestGameNightWatchBonusTwoStars.class);
listOfTests.add(TestGameNightWatchBonusThreeStars.class);
listOfTests.add(TestGamePursuitEasyNoneStar.class);
listOfTests.add(TestGamePursuitEasyOneStar.class);
listOfTests.add(TestGamePursuitEasyTwoStar.class);
......
......@@ -89,6 +89,7 @@ public class TestGameNightWatch extends AbstractTestGame {
clickAt(incGetSteps() + ". Click at medium difficulty button", GamePageGroup.DIFFICULTY_BUTTON_MEDIUM);
clickAt(incGetSteps() + ". Click at hard difficulty button", GamePageGroup.DIFFICULTY_BUTTON_HARD);
clickAt(incGetSteps() + ". Click at easy difficulty button", GamePageGroup.DIFFICULTY_BUTTON_EASY);
clickAt(incGetSteps() + ". Click at bonus difficulty button", GamePageGroup.DIFFICULTY_BUTTON_BONUS);
//setDifficulty
setGameDificulty();
......@@ -131,7 +132,9 @@ public class TestGameNightWatch extends AbstractTestGame {
List<Pair<Integer, Integer>> windowPositions = getWindowsPositionsByDif(difficulty);
for(int i=0;i< GameRulesHelper.NUMBER_OF_ROUNDS;i++){
int numberOfRounds = (difficulty == GameDifficulty.BONUS) ? GameRulesHelper.BONUS_NUMBER_OF_ROUNDS : GameRulesHelper.NUMBER_OF_ROUNDS;
for(int i=0;i< numberOfRounds;i++){
waitForEvent(incGetSteps() + ". Wait for new day event", NightWatchGame.EVENT_NEW_DAY +i);
//play round
Solution solution = NightWatchGame.lastSolution;
......@@ -178,7 +181,7 @@ public class TestGameNightWatch extends AbstractTestGame {
break;
}
if(i != GameRulesHelper.NUMBER_OF_ROUNDS-1) {
if(i != numberOfRounds-1) {
waitForEvent(incGetSteps() + ". Wait for evaluate round event",NightWatchGame.EVENT_EVALUATE_ROUND+i);
waitForEvent(incGetSteps() + ". Wait for new night event", NightWatchGame.EVENT_NEW_NIGHT + i);
}
......@@ -213,12 +216,19 @@ public class TestGameNightWatch extends AbstractTestGame {
}
private boolean doMistake(){
if(difficulty == GameDifficulty.BONUS){
if(expectedResult == AbstractTablexiaGame.GameResult.TWO_STAR && playedRound >= NightWatchScoreResolver_V3_4.BONUS_SCORE_THREE_STARS_V3_4 -NightWatchGame.MAX_GAME_ERRORS -1){ return true;}
else if(expectedResult == AbstractTablexiaGame.GameResult.ONE_STAR && playedRound >= NightWatchScoreResolver_V3_4.BONUS_SCORE_TWO_STARS_V3_4 -NightWatchGame.MAX_GAME_ERRORS-1){ return true;}
else if(expectedResult == AbstractTablexiaGame.GameResult.NO_STAR && playedRound >= NightWatchScoreResolver_V3_4.BONUS_SCORE_ONE_STAR_V3_4-NightWatchGame.MAX_GAME_ERRORS-1) { return true;}
if(expectedResult == AbstractTablexiaGame.GameResult.TWO_STAR && playedRound >= NightWatchScoreResolver_V3_4.SCORE_THREE_STARS_V3_4 -NightWatchGame.MAX_GAME_ERRORS -1){ return true;}
else if(expectedResult == AbstractTablexiaGame.GameResult.ONE_STAR && playedRound >= NightWatchScoreResolver_V3_4.SCORE_TWO_STARS_V3_4 -NightWatchGame.MAX_GAME_ERRORS-1){ return true;}
else if(expectedResult == AbstractTablexiaGame.GameResult.NO_STAR && playedRound >= NightWatchScoreResolver_V3_4.SCORE_ONE_STAR_V3_4-NightWatchGame.MAX_GAME_ERRORS-1) { return true;}
return false;
} else {
if(expectedResult == AbstractTablexiaGame.GameResult.TWO_STAR && playedRound >= NightWatchScoreResolver_V3_4.SCORE_THREE_STARS_V3_4 -NightWatchGame.MAX_GAME_ERRORS -1){ return true;}
else if(expectedResult == AbstractTablexiaGame.GameResult.ONE_STAR && playedRound >= NightWatchScoreResolver_V3_4.SCORE_TWO_STARS_V3_4 -NightWatchGame.MAX_GAME_ERRORS-1){ return true;}
else if(expectedResult == AbstractTablexiaGame.GameResult.NO_STAR && playedRound >= NightWatchScoreResolver_V3_4.SCORE_ONE_STAR_V3_4-NightWatchGame.MAX_GAME_ERRORS-1) { return true;}
return false;
return false;
}
}
private void clickWindowsByIndex(int index, Stage stage, List<Pair<Integer, Integer>> windowPositions){
......@@ -238,7 +248,6 @@ public class TestGameNightWatch extends AbstractTestGame {
}
if(isSelectedWindowVisible(index,stage)){
logOK();
waitForEvent(incGetSteps() + ". Wait for window selected event",NightWatchGame.EVENT_WINDOW_SELECTED+index);
}else{
writeToLogFile("Window not selected [TRY NEXT]\n");
......@@ -295,6 +304,8 @@ public class TestGameNightWatch extends AbstractTestGame {
private List<Pair<Integer, Integer>> getWindowsPositionsByDif(GameDifficulty difficulty){
switch (difficulty){
case BONUS:
return TextureHelper.testThirtyTwoWindowsPositions;
case HARD:
return TextureHelper.testThirtyTwoWindowsPositions;
case MEDIUM:
......@@ -307,8 +318,9 @@ public class TestGameNightWatch extends AbstractTestGame {
@Override
protected void checkVictoryTable(int daoScore, Table table) {
if(!checkScoreInTable(table,Integer.toString(daoScore) + " / " + GameRulesHelper.NUMBER_OF_ROUNDS)){
logError("Not found label in " + AbstractTablexiaGame.RESULT_TABLE+ " with correct dao score: " + Integer.toString(daoScore) + " / " + GameRulesHelper.NUMBER_OF_ROUNDS);
int numberOfRounds = (difficulty == GameDifficulty.BONUS) ? GameRulesHelper.BONUS_NUMBER_OF_ROUNDS : GameRulesHelper.NUMBER_OF_ROUNDS;
if(!checkScoreInTable(table,Integer.toString(daoScore) + " / " + numberOfRounds)){
logError("Not found label in " + AbstractTablexiaGame.RESULT_TABLE+ " with correct dao score: " + Integer.toString(daoScore) + " / " + numberOfRounds);
stopTheTest();
}
}
......@@ -324,10 +336,17 @@ public class TestGameNightWatch extends AbstractTestGame {
@Override
protected int getCubsCount() {
if (playedRound > NightWatchScoreResolver_V3_4.SCORE_THREE_STARS_V3_4) return 3;
else if (playedRound > NightWatchScoreResolver_V3_4.SCORE_TWO_STARS_V3_4) return 2;
else if (playedRound > NightWatchScoreResolver_V3_4.SCORE_ONE_STAR_V3_4) return 1;
return 0;
if(difficulty == GameDifficulty.BONUS){
if (playedRound > NightWatchScoreResolver_V3_4.BONUS_SCORE_THREE_STARS_V3_4) return 3;
else if (playedRound > NightWatchScoreResolver_V3_4.BONUS_SCORE_TWO_STARS_V3_4) return 2;
else if (playedRound > NightWatchScoreResolver_V3_4.BONUS_SCORE_ONE_STAR_V3_4) return 1;
return 0;
} else {
if (playedRound > NightWatchScoreResolver_V3_4.SCORE_THREE_STARS_V3_4) return 3;
else if (playedRound > NightWatchScoreResolver_V3_4.SCORE_TWO_STARS_V3_4) return 2;
else if (playedRound > NightWatchScoreResolver_V3_4.SCORE_ONE_STAR_V3_4) return 1;
return 0;
}
}
@Override
......
/*
* Copyright (C) 2017 CZ.NIC, z.s.p.o. (http://www.nic.cz/)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package cz.nic.tablexia.testing.games.night_watch;
import cz.nic.tablexia.Tablexia;
import cz.nic.tablexia.game.AbstractTablexiaGame;
import cz.nic.tablexia.game.difficulty.GameDifficulty;
public class TestGameNightWatchBonusNoneStar extends TestGameNightWatch {
public TestGameNightWatchBonusNoneStar(Tablexia tablexia) {
super(tablexia);
difficulty = GameDifficulty.BONUS;
expectedResult = AbstractTablexiaGame.GameResult.NO_STAR;
}
}
/*
* Copyright (C) 2017 CZ.NIC, z.s.p.o. (http://www.nic.cz/)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package cz.nic.tablexia.testing.games.night_watch;
import cz.nic.tablexia.Tablexia;
import cz.nic.tablexia.game.AbstractTablexiaGame;
import cz.nic.tablexia.game.difficulty.GameDifficulty;
public class TestGameNightWatchBonusOneStar extends TestGameNightWatch {
public TestGameNightWatchBonusOneStar(Tablexia tablexia) {
super(tablexia);
difficulty = GameDifficulty.BONUS;
expectedResult = AbstractTablexiaGame.GameResult.ONE_STAR;
}
}
/*
* Copyright (C) 2017 CZ.NIC, z.s.p.o. (http://www.nic.cz/)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package cz.nic.tablexia.testing.games.night_watch;
import cz.nic.tablexia.Tablexia;
import cz.nic.tablexia.game.AbstractTablexiaGame;
import cz.nic.tablexia.game.difficulty.GameDifficulty;
public class TestGameNightWatchBonusThreeStars extends TestGameNightWatch {
public TestGameNightWatchBonusThreeStars(Tablexia tablexia) {
super(tablexia);
difficulty = GameDifficulty.BONUS;
expectedResult = AbstractTablexiaGame.GameResult.THREE_STAR;
}
}
/*
* Copyright (C) 2017 CZ.NIC, z.s.p.o. (http://www.nic.cz/)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package cz.nic.tablexia.testing.games.night_watch;
import cz.nic.tablexia.Tablexia;
import cz.nic.tablexia.game.AbstractTablexiaGame;
import cz.nic.tablexia.game.difficulty.GameDifficulty;
public class TestGameNightWatchBonusTwoStars extends TestGameNightWatch {
public TestGameNightWatchBonusTwoStars(Tablexia tablexia) {
super(tablexia);
difficulty = GameDifficulty.BONUS;
expectedResult = AbstractTablexiaGame.GameResult.TWO_STAR;
}
}
......@@ -10,3 +10,7 @@ TestGameNightWatchHardNoneStar
TestGameNightWatchHardOneStar
TestGameNightWatchHardTwoStar
TestGameNightWatchHardThreeStar
TestGameNightWatchBonusNoneStar
TestGameNightWatchBonusOneStar
TestGameNightWatchBonusTwoStars
TestGameNightWatchBonusThreeStars
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment