Skip to content

Commit

Permalink
Attempt to revive automatic testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaming32 committed Sep 3, 2024
1 parent b0e913c commit f9ed87b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 17 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ jobs:
- 1.20.4-fabric
- 1.20.6-neoforge
- 1.20.6-fabric
side:
- Host
- Joiner
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -40,7 +43,5 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 21
- name: Compile World Host
run: ./gradlew :${{ matrix.subproject }}:classes
- name: Run tests
run: xvfb-run -a -s "-screen 0 1920x1080x24" bash runTests.sh ${{ matrix.subproject }}
run: xvfb-run -a -s "-screen 0 1920x1080x24" ./gradlew :${{ matrix.subproject }}:runTest${{ matrix.side }}
10 changes: 0 additions & 10 deletions runTests.sh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import net.minecraft.server.players.GameProfileCache;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.VisibleForTesting;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -28,10 +29,12 @@ public class AddFriendScreen extends WorldHostScreen {
private static final Component FRIEND_USERNAME_TEXT = Components.translatable("world-host.add_friend.enter_username");
private static final Component ADD_FRIEND_TEXT = Components.literal("+");
//#if MC >= 1.20.0
private static final Component ADD_FRIEND_SILENT_TEXT = Components.literal("+\ud83d\udd08");
@VisibleForTesting
public static final Component ADD_FRIEND_SILENT_TEXT = Components.literal("+\ud83d\udd08");
private static final Component ADD_FRIEND_NOTIFY_TEXT = Components.literal("+\ud83d\udd0a");
//#else
//$$ private static final Component ADD_FRIEND_SILENT_TEXT = Components.literal("+Q");
//$$ @VisibleForTesting
//$$ public static final Component ADD_FRIEND_SILENT_TEXT = Components.literal("+Q");
//$$ private static final Component ADD_FRIEND_NOTIFY_TEXT = Components.literal("+N");
//#endif
private static final Component ADD_FRIEND_SILENT_TOOLTIP = Components.translatable("world-host.friends.add_silently.tooltip");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

//#if MC >= 1.19.2
import net.minecraft.network.chat.contents.TranslatableContents;
import org.intellij.lang.annotations.RegExp;
//#else
//$$ import net.minecraft.network.chat.TranslatableComponent;
//#endif
Expand Down Expand Up @@ -65,7 +66,7 @@ public static void enterText(AbstractWidget widget, String text) {
type(text);
}

public static AbstractWidget findWidgetByRegex(String regex) {
public static AbstractWidget findWidgetByRegex(@RegExp String regex) {
return findWidgetByRegex(Pattern.compile(regex));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ private static ScreenChain addFriend(TestingUser user) {
.then(FriendsScreen.class, () -> click(findWidgetByTranslation("world-host.add_friend")))
.then(AddFriendScreen.class, () -> {
enterText(findWidgetByTranslation("world-host.add_friend.enter_username"), "o:" + user + getUsernameSuffix());
click(findWidgetByTranslation("world-host.add_friend"));
click(findWidgetByComponent(AddFriendScreen.ADD_FRIEND_SILENT_TEXT));
})
.then(FriendsScreen.class, () -> click(findWidgetByTranslation("gui.done")))
.then(WorldHostConfigScreen.class, () -> click(findWidgetByTranslation("gui.done")));
Expand Down

0 comments on commit f9ed87b

Please sign in to comment.