add gs
This commit is contained in:
+248
@@ -0,0 +1,248 @@
|
||||
--to make ScriptAnalyzer Happy
|
||||
describe = nil
|
||||
step = nil
|
||||
expect = nil
|
||||
include = nil
|
||||
-------------------------------
|
||||
local Element = require(game.CoreGui.RobloxGui.Modules.Rhodium.Element)
|
||||
local MobileAppElements = require(game.CoreGui.RobloxGui.Modules.RhodiumTest.Common.MobileAppElements)
|
||||
local RobloxEventSimulator = require(game.CoreGui.RobloxGui.Modules.Rhodium.RobloxEventSimulator)
|
||||
|
||||
return function()
|
||||
describe.protected("Test Avatar", function()
|
||||
local function getProjectedPosition(position)
|
||||
local Camera = game.workspace.Camera
|
||||
local p = Camera.CFrame:pointToObjectSpace(position)
|
||||
local ly = math.tan(Camera.FieldOfView / 2 / 180 * math.pi)
|
||||
local aspect = Camera.ViewportSize.X / Camera.ViewportSize.Y
|
||||
local ry = (p.Y / -p.Z) / ly
|
||||
local rx = (p.X / -p.Z) / (ly * aspect)
|
||||
return Vector3.new(rx, ry, p.Z)
|
||||
end
|
||||
|
||||
local function similar(v1, v2, limit)
|
||||
return (v1 - v2).Magnitude < limit
|
||||
end
|
||||
|
||||
local function gotoAvatarPage()
|
||||
-- in changelist 232625, they introduced a flag "useWebPageWrapperForGameDetails"
|
||||
-- it will disable tool bar button for 1 second after click gamecard.
|
||||
wait(2)
|
||||
-- in studio we can navigate to different page by click on bottom bar
|
||||
-- in android devices, their is no lua bottom bar, we navigate by simulating roblox event.
|
||||
if game:GetService("RunService"):isStudio() then
|
||||
Element.new(MobileAppElements.avatarButton):click()
|
||||
else
|
||||
RobloxEventSimulator.gotoPage(RobloxEventSimulator.Enums.pageAvatarEditor)
|
||||
end
|
||||
end
|
||||
|
||||
local function loadAvatarPage()
|
||||
step("click avatar button on tool bar for studio", gotoAvatarPage)
|
||||
step("should have character ", function()
|
||||
assert(MobileAppElements.character:waitForFirstInstance(), "did not find character")
|
||||
end)
|
||||
step("should have r6 r15 switch ", function()
|
||||
assert(MobileAppElements.r6r15Switch:waitForFirstInstance(), "did not find r6 r15 switch")
|
||||
end)
|
||||
step("should have full screen button", function()
|
||||
assert(MobileAppElements.fullViewButton:waitForFirstInstance(), "did not find full screen button")
|
||||
end)
|
||||
step("should have tab button", function()
|
||||
assert(MobileAppElements.selectTabButton:waitForFirstInstance(), "did not find tab button")
|
||||
end)
|
||||
step("should have page title should be \"Avatar\"", function()
|
||||
assert(MobileAppElements.pageName:waitForFirstInstance().Text == "Avatar", "page name is not Avatar")
|
||||
wait(1)
|
||||
end)
|
||||
end
|
||||
|
||||
local function fullViewButtonInScreen()
|
||||
local button = MobileAppElements.fullViewButton:waitForFirstInstance()
|
||||
assert(button)
|
||||
local topLeftPos = button.AbsolutePosition()
|
||||
local bottomRightPos = topLeftPos + button.AbsoluteSize()
|
||||
local screenSize = game.workspace.Camera.ViewportSize
|
||||
local minX, minY, maxX, maxY = 0, 0, screenSize.X, screenSize.Y
|
||||
|
||||
local topBar = MobileAppElements.topBar:waitForFirstInstance()
|
||||
assert(topBar)
|
||||
minY = math.max(minY, topBar.AbsolutePosition.Y + topBar.AbsoluteSize.Y)
|
||||
|
||||
local rightFrame = MobileAppElements.rightFrame:waitForFirstInstance()
|
||||
assert(rightFrame)
|
||||
maxX = math.min(maxX, rightFrame.AbsolutePosition.X)
|
||||
|
||||
local bottomBar = MobileAppElements.topBarContent:waitForFirstInstance()
|
||||
assert(bottomBar)
|
||||
maxY = math.min(maxY, bottomBar.AbsolutePosition.Y)
|
||||
|
||||
assert(topLeftPos.X > minX)
|
||||
assert(topLeftPos.Y > minY)
|
||||
assert(bottomRightPos.X < maxX)
|
||||
assert(bottomRightPos.Y < maxY)
|
||||
end
|
||||
|
||||
local function testFullViewButtonLandScape()
|
||||
local button = MobileAppElements.fullViewButton:waitForFirstInstance()
|
||||
local rightFrame = MobileAppElements.rightFrame:waitForFirstInstance()
|
||||
assert(button)
|
||||
assert(rightFrame)
|
||||
|
||||
fullViewButtonInScreen()
|
||||
assert(similar(rightFrame.AbsolutePostion.X), game.workspace.Camera.ViewportSize.X / 2, 100)
|
||||
local element = Element.new(button)
|
||||
|
||||
element:click()
|
||||
wait(2) -- wait to finish animation
|
||||
fullViewButtonInScreen()
|
||||
assert(similar(rightFrame.AbsolutePostion.X), game.workspace.Camera.ViewportSize.X, 20)
|
||||
|
||||
element:click()
|
||||
wait(2) -- wait to finish animation
|
||||
fullViewButtonInScreen()
|
||||
assert(similar(rightFrame.AbsolutePostion.X), game.workspace.Camera.ViewportSize.X / 2, 100)
|
||||
|
||||
end
|
||||
|
||||
local function waitForCloseButton()
|
||||
return MobileAppElements.closeTabButton:waitForInstance()
|
||||
end
|
||||
|
||||
local function waitForCloseButtonDisappear()
|
||||
return MobileAppElements.closeTabButton:waitForDisappear()
|
||||
end
|
||||
|
||||
local function instanceInScreen(instance)
|
||||
local pos = getProjectedPosition(instance.Position)
|
||||
return((pos.Z < 0)
|
||||
and (pos.X > -1 and pos.X < 1)
|
||||
and (pos.Y > -1 and pos.Y < 1))
|
||||
end
|
||||
|
||||
local function checkAvatarInScreen()
|
||||
local character = MobileAppElements.character:waitForFirstInstance()
|
||||
assert(character)
|
||||
local rootPart = character.HumanoidRootPart
|
||||
local head = character.Head
|
||||
assert(rootPart)
|
||||
assert(head)
|
||||
assert(instanceInScreen(rootPart), "avatar is not inside of screen")
|
||||
end
|
||||
|
||||
local function gotoTab(tab)
|
||||
assert(waitForCloseButtonDisappear() == true)
|
||||
Element.new(MobileAppElements.selectTabButton):click()
|
||||
Element.new(tab):click()
|
||||
assert(waitForCloseButtonDisappear() == true)
|
||||
end
|
||||
|
||||
local function forEachTab(tab, subTabs)
|
||||
step("should go to that tab after click", function()
|
||||
gotoTab(tab)
|
||||
end)
|
||||
|
||||
step("tab should be yellow after click and character should be aways in screen", function()
|
||||
for name, path in pairs(subTabs) do
|
||||
print(string.format("testing avatar tab %q", name))
|
||||
local instance
|
||||
instance = path:waitForFirstInstance()
|
||||
assert(instance)
|
||||
Element.new(instance):click()
|
||||
wait(0.2)
|
||||
assert(instance.BackgroundColor3.r ~= 255)
|
||||
checkAvatarInScreen()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
local function testAllTabs_Portrait()
|
||||
describe.protected("all \"recent\" tabs should work", function()
|
||||
forEachTab(MobileAppElements.groupTabs_portrait.recentButton, MobileAppElements.recentTabs_portrait)
|
||||
end)
|
||||
describe.protected("all \"clothing\" tabs should work", function()
|
||||
forEachTab(MobileAppElements.groupTabs_portrait.clothingButton, MobileAppElements.clothingTabs_portrait)
|
||||
end)
|
||||
describe.protected("all \"body\" tabs should work", function()
|
||||
forEachTab(MobileAppElements.groupTabs_portrait.bodyButton, MobileAppElements.bodyTabs_portrait)
|
||||
end)
|
||||
describe.protected("all \"anomation\" tabs should work", function()
|
||||
forEachTab(MobileAppElements.groupTabs_portrait.animationButton, MobileAppElements.animationTabs_portrait)
|
||||
end)
|
||||
describe.protected("all \"outfits\" tabs should work", function()
|
||||
forEachTab(MobileAppElements.groupTabs_portrait.outfitsButton, MobileAppElements.outfitsTabs_portrait)
|
||||
end)
|
||||
end
|
||||
|
||||
local function testAllTabs()
|
||||
describe.protected("all \"recent\" tabs should work", function()
|
||||
forEachTab(MobileAppElements.groupTabs.recentButton, MobileAppElements.recentTabs)
|
||||
end)
|
||||
describe.protected("all \"clothing\" tabs should work", function()
|
||||
forEachTab(MobileAppElements.groupTabs.clothingButton, MobileAppElements.clothingTabs)
|
||||
end)
|
||||
describe.protected("all \"body\" tabs should work", function()
|
||||
forEachTab(MobileAppElements.groupTabs.bodyButton, MobileAppElements.bodyTabs)
|
||||
end)
|
||||
describe.protected("all \"anomation\" tabs should work", function()
|
||||
forEachTab(MobileAppElements.groupTabs.animationButton, MobileAppElements.animationTabs)
|
||||
end)
|
||||
describe.protected("all \"outfits\" tabs should work", function()
|
||||
forEachTab(MobileAppElements.groupTabs.outfitsButton, MobileAppElements.outfitsTabs)
|
||||
end)
|
||||
end
|
||||
|
||||
local function isR15()
|
||||
local switchFrame = MobileAppElements.r6r15SwitchFrame:waitForFirstInstance()
|
||||
assert(switchFrame)
|
||||
local switch = MobileAppElements.r6r15Switch:waitForFirstInstance()
|
||||
assert(switch)
|
||||
local frameCenter = Element.new(switchFrame):getCenter()
|
||||
local switchCenter = Element.new(switch):getCenter()
|
||||
return switchCenter.X > frameCenter.X
|
||||
end
|
||||
|
||||
local function switchToR15()
|
||||
if isR15() == true then return end
|
||||
Element.new(MobileAppElements.r6r15Switch):click()
|
||||
wait(1) -- it takes a long time to switch
|
||||
assert(isR15())
|
||||
end
|
||||
|
||||
local function switchToR6()
|
||||
if isR15() == false then return end
|
||||
Element.new(MobileAppElements.r6r15Switch):click()
|
||||
wait(1) -- it takes a long time to switch
|
||||
assert(not isR15())
|
||||
end
|
||||
|
||||
local function switchCharacter()
|
||||
if isR15() == true then
|
||||
switchToR6()
|
||||
else
|
||||
switchToR15()
|
||||
end
|
||||
end
|
||||
|
||||
local function switchTest()
|
||||
if isR15() == true then
|
||||
switchToR6()
|
||||
switchToR15()
|
||||
else
|
||||
switchToR15()
|
||||
switchToR6()
|
||||
end
|
||||
print("current avatar style is " .. (isR15() and "R15" or "R6"))
|
||||
end
|
||||
|
||||
describe("should be able to goto avatar page by navigation button", loadAvatarPage)
|
||||
step("switch should work", switchTest)
|
||||
describe.protected("test all tabs", testAllTabs)
|
||||
-- the R6 avatar can move out of screen in studio mode.
|
||||
if false then
|
||||
step("should switch to another character", switchCharacter)
|
||||
describe.protected("test all tabs after character switched", testAllTabs)
|
||||
step("should switch back to old character", switchCharacter)
|
||||
end
|
||||
end)
|
||||
end
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
--to make ScriptAnalyzer Happy
|
||||
describe = nil
|
||||
step = nil
|
||||
expect = nil
|
||||
include = nil
|
||||
-------------------------------
|
||||
local PageNavigation = require(game.CoreGui.RobloxGui.Modules.RhodiumTest.Common.PageNavigation)
|
||||
|
||||
return function()
|
||||
step("Switching pages", function()
|
||||
PageNavigation.gotoGamesPage()
|
||||
PageNavigation.gotoCatalogPage()
|
||||
PageNavigation.gotoAvatarPage()
|
||||
PageNavigation.gotoFriendPage()
|
||||
PageNavigation.gotoChatPage()
|
||||
PageNavigation.gotoMorePage()
|
||||
PageNavigation.gotoHomePage()
|
||||
end)
|
||||
end
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
--to make ScriptAnalyzer Happy
|
||||
describe = nil
|
||||
step = nil
|
||||
expect = nil
|
||||
include = nil
|
||||
-------------------------------
|
||||
local Element = require(game.CoreGui.RobloxGui.Modules.Rhodium.Element)
|
||||
local MobileAppElements = require(game.CoreGui.RobloxGui.Modules.RhodiumTest.Common.MobileAppElements)
|
||||
local VirtualInput = require(game.CoreGui.RobloxGui.Modules.Rhodium.VirtualInput)
|
||||
|
||||
return function()
|
||||
describe.protected("game Button should zoom out on its center point when touch and hold it, and resume after release",
|
||||
function()
|
||||
local myRecentEntry =
|
||||
MobileAppElements.filterBy(MobileAppElements.gameCategoryEntry, MobileAppElements.getGameCategoryDetail().title,
|
||||
"Text", "My Recent"
|
||||
)
|
||||
|
||||
local recentInstance = nil
|
||||
local gameFrame = nil
|
||||
local gameButton = nil
|
||||
|
||||
local element = nil
|
||||
local center = nil
|
||||
|
||||
local oldFrameSize = nil
|
||||
local oldGameButtonSize = nil
|
||||
local oldGameButtonCenter = nil
|
||||
|
||||
step("should find the carousel and game buttons", function()
|
||||
recentInstance = myRecentEntry:waitForFirstInstance()
|
||||
expect(recentInstance).to.be.ok()
|
||||
gameFrame = recentInstance.Carousel:waitForChild("1")
|
||||
gameButton = gameFrame.GameButton
|
||||
element = Element.new(gameButton)
|
||||
--bring it in screen, if not.
|
||||
element:centralize()
|
||||
wait(0.5)
|
||||
|
||||
center = element:getCenter()
|
||||
oldFrameSize = gameFrame.AbsoluteSize
|
||||
oldGameButtonSize = gameButton.AbsoluteSize
|
||||
oldGameButtonCenter = element:getCenter()
|
||||
end)
|
||||
|
||||
local function similar(v1, v2, limit)
|
||||
return (v1 - v2).Magnitude < limit
|
||||
end
|
||||
|
||||
step("game Button should zoom out on its center point when touch and hold it", function()
|
||||
VirtualInput.mouseLeftDown(center)
|
||||
VirtualInput.touchStart(center)
|
||||
wait(1) -- wait for animation finish
|
||||
local downFrameSize = gameFrame.AbsoluteSize
|
||||
local downGameButtonSize = gameButton.AbsoluteSize
|
||||
local downGameButtonCenter = Element.new(gameButton):getCenter()
|
||||
|
||||
assert(similar(oldFrameSize, downFrameSize, 2))
|
||||
assert(oldGameButtonSize.Magnitude > downGameButtonSize.Magnitude)
|
||||
assert(not similar(oldGameButtonSize, downGameButtonSize, 4))
|
||||
assert(similar(oldGameButtonCenter, downGameButtonCenter, 2))
|
||||
|
||||
VirtualInput.mouseLeftUp(center)
|
||||
VirtualInput.touchStop(center)
|
||||
end)
|
||||
|
||||
step("game Button should resume after release", function()
|
||||
wait(1) -- wait for animation finish
|
||||
local upFrameSize = gameFrame.AbsoluteSize
|
||||
local upGameButtonSize = gameButton.AbsoluteSize
|
||||
|
||||
local upGameButtonCenter = Element.new(gameButton):getCenter()
|
||||
|
||||
assert(similar(oldFrameSize, upFrameSize, 2))
|
||||
assert(similar(oldGameButtonSize, upGameButtonSize, 2))
|
||||
assert(similar(oldGameButtonCenter, upGameButtonCenter, 2))
|
||||
end)
|
||||
end)
|
||||
end
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
--to make ScriptAnalyzer Happy
|
||||
describe = nil
|
||||
step = nil
|
||||
expect = nil
|
||||
include = nil
|
||||
-------------------------------
|
||||
local Element = require(game.CoreGui.RobloxGui.Modules.Rhodium.Element)
|
||||
local MobileAppElements = require(game.CoreGui.RobloxGui.Modules.RhodiumTest.Common.MobileAppElements)
|
||||
local RobloxEventSimulator = require(game.CoreGui.RobloxGui.Modules.Rhodium.RobloxEventSimulator)
|
||||
local RunService = game:GetService("RunService")
|
||||
|
||||
return function()
|
||||
describe.protected("Home Page Should Load", function()
|
||||
if RunService:IsStudio() then
|
||||
step("should have tool bar", function()
|
||||
expect(MobileAppElements.topBar:setWait(10):waitForFirstInstance()).to.be.ok()
|
||||
end)
|
||||
|
||||
step("all tool bar buttons should be ok", function()
|
||||
expect(MobileAppElements.avatarButton:setWait(10):waitForFirstInstance()).to.be.ok()
|
||||
expect(MobileAppElements.catalogButton:waitForFirstInstance()).to.be.ok()
|
||||
expect(MobileAppElements.chatButton:waitForFirstInstance()).to.be.ok()
|
||||
expect(MobileAppElements.friendsButton:waitForFirstInstance()).to.be.ok()
|
||||
expect(MobileAppElements.gamesButton:waitForFirstInstance()).to.be.ok()
|
||||
expect(MobileAppElements.homeButton:waitForFirstInstance()).to.be.ok()
|
||||
expect(MobileAppElements.moreButton:waitForFirstInstance()).to.be.ok()
|
||||
end)
|
||||
end
|
||||
|
||||
step("should be able to goto home page", function()
|
||||
if RunService:IsStudio() then
|
||||
Element.new(MobileAppElements.homeButton):click()
|
||||
else
|
||||
RobloxEventSimulator.gotoPage(RobloxEventSimulator.Enums.pageHome)
|
||||
end
|
||||
expect(MobileAppElements.pageName:waitForFirstInstance().Text).to.equal("Home")
|
||||
end)
|
||||
|
||||
step("scroling frame should be at the top when entered home page", function()
|
||||
expect(MobileAppElements.verticalScrollingFrame:setWait(10):waitForFirstInstance().CanvasPosition.Y).to.equal(0)
|
||||
end)
|
||||
|
||||
step("should have [My Recent] [Friend Activity] and Recommended carousels", function()
|
||||
--"My Recent", only if the account played some games
|
||||
--"Friend Activity", only if the account has friends
|
||||
local carouselNames = {"Recommended"}
|
||||
local function checkCarousel(name)
|
||||
expect(MobileAppElements.filterBy(MobileAppElements.gameCategoryEntry,
|
||||
MobileAppElements.getGameCategoryDetail().title, "Text", name):waitForFirstInstance()).to.be.ok()
|
||||
end
|
||||
|
||||
for _, name in ipairs(carouselNames) do
|
||||
checkCarousel(name)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
--to make ScriptAnalyzer Happy
|
||||
describe = nil
|
||||
step = nil
|
||||
expect = nil
|
||||
include = nil
|
||||
-------------------------------
|
||||
local Element = require(game.CoreGui.RobloxGui.Modules.Rhodium.Element)
|
||||
local MobileAppElements = require(game.CoreGui.RobloxGui.Modules.RhodiumTest.Common.MobileAppElements)
|
||||
local VirtualInput = require(game.CoreGui.RobloxGui.Modules.Rhodium.VirtualInput)
|
||||
|
||||
return function()
|
||||
step("mouse wheel should be able to scroll the vertical scrollframe", function()
|
||||
local element = Element.new(MobileAppElements.verticalScrollingFrame)
|
||||
wait(0.5)
|
||||
VirtualInput.mouseWheel(element:getCenter(), 2)
|
||||
wait(0.5) -- wait for one frame to update GUIs.
|
||||
assert(MobileAppElements.verticalScrollingFrame:waitForFirstInstance().CanvasPosition.Y > 0)
|
||||
end)
|
||||
end
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
describe = nil
|
||||
step = nil
|
||||
expect = nil
|
||||
include = nil
|
||||
|
||||
local Modules = game:GetService("CoreGui").RobloxGui.Modules
|
||||
|
||||
local Constants = require(Modules.LuaApp.Constants)
|
||||
local Element = require(Modules.Rhodium.Element)
|
||||
local MobileAppElements = require(Modules.RhodiumTest.Common.MobileAppElements)
|
||||
local PageNavigation = require(Modules.RhodiumTest.Common.PageNavigation)
|
||||
local VirtualInput = require(Modules.Rhodium.VirtualInput)
|
||||
|
||||
local ADD_FRIEND_BUTTON_HEIGHT = 132
|
||||
local FRIEND_CAROUSEL = {
|
||||
Username_Font = Enum.Font.SourceSansLight,
|
||||
Username_TextColor = Constants.Color.GRAY1,
|
||||
Phone = {
|
||||
WIDTH = 115,
|
||||
HEIGHT = 153,
|
||||
ICON_SIZE = 84,
|
||||
},
|
||||
Tablet = {
|
||||
WIDTH = 105,
|
||||
HEIGHT = 161,
|
||||
ICON_SIZE = 90,
|
||||
}
|
||||
}
|
||||
|
||||
return function()
|
||||
local ADD_FRIENDS_ICON = "rbxasset://textures/ui/LuaApp/icons/ic-add.png"
|
||||
local ADD_FRIENDS_ICON_PRESSED = "rbxasset://textures/ui/LuaApp/icons/ic-add-down.png"
|
||||
|
||||
describe.protected("Homepage People List Rhodium Test", function()
|
||||
-- func step is executed step by step
|
||||
local peopleList
|
||||
local addFriendsButton
|
||||
local firstFriendCarousel
|
||||
|
||||
step("Navigate to homepage", function()
|
||||
-- make sure we are at homepage now
|
||||
PageNavigation.gotoHomePage()
|
||||
end)
|
||||
|
||||
step("Load elements", function()
|
||||
peopleList = MobileAppElements.homePagePeopleList:waitForFirstInstance()
|
||||
assert(peopleList, "create people list unsuccessfully")
|
||||
|
||||
-- AddFriendsButton
|
||||
addFriendsButton = peopleList["1"]
|
||||
assert(addFriendsButton, "create AddFriendsButton unsuccessfully")
|
||||
|
||||
-- First friend carousel
|
||||
firstFriendCarousel = peopleList["2"]
|
||||
assert(firstFriendCarousel)
|
||||
end)
|
||||
|
||||
describe.protected("Test AddFriendsButton on People List", function()
|
||||
step.protected("AddFriendsButton layout", function()
|
||||
-- check button size
|
||||
assert(addFriendsButton.AbsoluteSize.x == Constants.PeopleList.ADD_FRIENDS_FRAME_WIDTH, "AddFriendsButton width is wrong")
|
||||
assert(addFriendsButton.AbsoluteSize.y == ADD_FRIEND_BUTTON_HEIGHT, "AddFriendsButton height is wrong")
|
||||
end)
|
||||
|
||||
step.protected("AddFriendsButton click effect", function()
|
||||
-- check button asset
|
||||
assert(addFriendsButton.AddButton.Image == ADD_FRIENDS_ICON, "AddFriendsButton's image is wrong")
|
||||
|
||||
-- check button clicked asset
|
||||
local centerPoint = Element.new(addFriendsButton):getCenter()
|
||||
VirtualInput.touchStart(centerPoint)
|
||||
-- wait one frame
|
||||
wait()
|
||||
assert(addFriendsButton.AddButton.Image == ADD_FRIENDS_ICON_PRESSED, "AddFriendsButton's pressed image is wrong")
|
||||
|
||||
VirtualInput.touchStop(centerPoint)
|
||||
wait()
|
||||
assert(addFriendsButton.AddButton.Image == ADD_FRIENDS_ICON, "AddFriendsButton's image is wrong")
|
||||
end)
|
||||
end)
|
||||
|
||||
describe.protected("Test user carousel on people list", function()
|
||||
step.protected("User carousel layout", function()
|
||||
local headIcon = firstFriendCarousel.ThumbnailFrame.Thumbnail.Image
|
||||
local userName = firstFriendCarousel.ThumbnailFrame.Thumbnail.Username
|
||||
|
||||
assert(headIcon, "can not find head icon")
|
||||
assert(userName, "can not find username label")
|
||||
|
||||
-- Tablet
|
||||
if firstFriendCarousel.AbsoluteSize.x == FRIEND_CAROUSEL.Tablet.WIDTH then
|
||||
assert(firstFriendCarousel.AbsoluteSize.y == FRIEND_CAROUSEL.Tablet.HEIGHT)
|
||||
assert(headIcon.AbsoluteSize.x == FRIEND_CAROUSEL.Tablet.ICON_SIZE)
|
||||
else
|
||||
-- Phone
|
||||
assert(firstFriendCarousel.AbsoluteSize.x == FRIEND_CAROUSEL.Phone.WIDTH)
|
||||
assert(firstFriendCarousel.AbsoluteSize.y == FRIEND_CAROUSEL.Phone.HEIGHT)
|
||||
assert(headIcon.AbsoluteSize.x == FRIEND_CAROUSEL.Phone.ICON_SIZE)
|
||||
end
|
||||
|
||||
assert(userName.TextColor3 == FRIEND_CAROUSEL.Username_TextColor)
|
||||
assert(userName.Font == FRIEND_CAROUSEL.Username_Font)
|
||||
end)
|
||||
|
||||
step.protected("User carousel click event", function()
|
||||
-- click one of the friend carousel
|
||||
Element.new(firstFriendCarousel):click()
|
||||
local peopleListContextualMenu = MobileAppElements.peopleListContextualMenu:waitForFirstInstance()
|
||||
assert(peopleListContextualMenu, "create peopleList Contextual menu unsuccessfully")
|
||||
|
||||
wait(0.5)
|
||||
|
||||
Element.new(peopleListContextualMenu):click()
|
||||
wait(1)
|
||||
peopleListContextualMenu = MobileAppElements.peopleListContextualMenu:waitForFirstInstance()
|
||||
assert(peopleListContextualMenu == nil, "can not close people list contextual menu")
|
||||
end)
|
||||
end)
|
||||
|
||||
describe.protected("Test scrolling frame of people list", function()
|
||||
step.protected("People List Scrolling test", function ()
|
||||
local screenWidth = peopleList.AbsoluteSize.x
|
||||
local peopleListContentSize = peopleList.CanvasSize.X.Offset
|
||||
|
||||
local startPoint = Element.new(peopleList):getCenter()
|
||||
-- Move to left 100 pixel
|
||||
-- This number should be larger.
|
||||
-- if it's too small, the scrolling frame would be scrolled
|
||||
local endPoint = Vector2.new(startPoint.X - 100, startPoint.Y)
|
||||
VirtualInput.swipe(startPoint, endPoint, 0.2)
|
||||
wait(0.5)
|
||||
|
||||
if peopleListContentSize > screenWidth then
|
||||
assert(peopleList.CanvasPosition.X > 0, "Can not move people list")
|
||||
else
|
||||
assert(peopleList.CanvasPosition.X == 0, "Can move a non-scrollable people list")
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
end
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
--to make ScriptAnalyzer Happy
|
||||
describe = nil
|
||||
step = nil
|
||||
expect = nil
|
||||
include = nil
|
||||
-------------------------------
|
||||
local Element = require(game.CoreGui.RobloxGui.Modules.Rhodium.Element)
|
||||
local MobileAppElements = require(game.CoreGui.RobloxGui.Modules.RhodiumTest.Common.MobileAppElements)
|
||||
|
||||
--"My Recent", only if the account played some games
|
||||
--"Friend Activity", only if the account has friends
|
||||
local popupMenuText = {"Featured", "Friend Activity", "My Recent", "Popular",
|
||||
"Popular Near You", "Recommended", "Top Earning", "Top Rated"}
|
||||
|
||||
local function getMenuItem(text)
|
||||
return MobileAppElements.filterBy(MobileAppElements.listPickerItem,
|
||||
MobileAppElements.getListPickerItem().Text, "Text", text)
|
||||
end
|
||||
|
||||
local function clickMenu(text)
|
||||
local path = getMenuItem(text)
|
||||
local instance = path:waitForFirstInstance()
|
||||
assert(instance)
|
||||
Element.new(instance):click()
|
||||
end
|
||||
|
||||
local function checkAllMenuExists()
|
||||
for _, text in ipairs(popupMenuText) do
|
||||
local path = getMenuItem(text)
|
||||
assert(path:waitForFirstInstance())
|
||||
end
|
||||
end
|
||||
|
||||
local function isMenuOpen()
|
||||
return MobileAppElements.listPicker:getFirstInstance() ~= nil
|
||||
end
|
||||
|
||||
local function getCurrentListDetail()
|
||||
--because it takes some time to set old screen as disabled
|
||||
wait(0.2)
|
||||
local homePath = MobileAppElements.homeScreen
|
||||
homePath = MobileAppElements.filterBy(homePath, nil, "Enabled", true)
|
||||
local result = homePath:waitForDisappear()
|
||||
assert(result)
|
||||
|
||||
local currentGameList = MobileAppElements.currentGameList
|
||||
local currentGameListInstance = currentGameList:waitForFirstInstance()
|
||||
assert(currentGameListInstance)
|
||||
assert(currentGameListInstance.Name ~= "Home")
|
||||
|
||||
local gameListDetail = MobileAppElements.getGameListDetail(currentGameListInstance)
|
||||
return gameListDetail
|
||||
end
|
||||
|
||||
local function openMenu()
|
||||
if isMenuOpen() then return end
|
||||
local element = Element.new(getCurrentListDetail().dropDownText)
|
||||
element:click()
|
||||
end
|
||||
|
||||
local function closeMenu()
|
||||
if not isMenuOpen() then return end
|
||||
local element = Element.new(getCurrentListDetail().dropDownText)
|
||||
element:click()
|
||||
end
|
||||
|
||||
local function clickSeeAll(category)
|
||||
local recommendedEntry = MobileAppElements.filterBy(MobileAppElements.gameCategoryEntry,
|
||||
MobileAppElements.getGameCategoryDetail().title, "Text", category)
|
||||
|
||||
local recommendedEntryInstance = recommendedEntry:waitForFirstInstance()
|
||||
|
||||
assert(recommendedEntryInstance)
|
||||
|
||||
local seeAllButton = MobileAppElements.getGameCategoryDetail(recommendedEntryInstance).seeAllButton
|
||||
|
||||
local seeAllButtonInstance = seeAllButton:waitForFirstInstance()
|
||||
|
||||
assert(seeAllButtonInstance)
|
||||
|
||||
Element.new(seeAllButtonInstance):click()
|
||||
end
|
||||
|
||||
local function checkIsList(name)
|
||||
print("checking game list: ", name)
|
||||
local gameListDetail = getCurrentListDetail()
|
||||
local gameTitle = MobileAppElements.filterBy(gameListDetail.gameTitle, nil, "Text", name)
|
||||
local gameTitleInstance = gameTitle:waitForFirstInstance()
|
||||
assert(gameTitleInstance)
|
||||
|
||||
assert(gameListDetail.dropDownText:waitForFirstInstance())
|
||||
assert(gameListDetail.gameTitle:waitForFirstInstance())
|
||||
assert(gameListDetail.gameCard:waitForFirstInstance())
|
||||
|
||||
assert(gameListDetail.dropDownText:waitForFirstInstance().Text == name)
|
||||
assert(gameListDetail.gameTitle:waitForFirstInstance().Text == name)
|
||||
end
|
||||
|
||||
local function canNavigateToAllMenu()
|
||||
for _, text in ipairs(popupMenuText) do
|
||||
step(string.format("should be able to navigate to game list %q ", text), function()
|
||||
openMenu()
|
||||
clickMenu(text)
|
||||
checkIsList(text)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
local function gameCardExist()
|
||||
local gameListDetail = getCurrentListDetail()
|
||||
local gameCard = MobileAppElements.filterBy(gameListDetail.gameCard,
|
||||
MobileAppElements.getGameCardDetailFromCarouselItem().gameButton, "ClassName", "TextButton")
|
||||
local instance = gameCard:waitForFirstInstance()
|
||||
assert(instance)
|
||||
end
|
||||
|
||||
return function()
|
||||
describe.protected("should be able to navigate to all game lists", function()
|
||||
step("should be able to find the SeeAll button on home page and click it", function()
|
||||
clickSeeAll("Recommended")
|
||||
end)
|
||||
step("should open recommended page after click see all", function()
|
||||
checkIsList("Recommended")
|
||||
end)
|
||||
step("the pop up menu should not show up when switch to that page", function()
|
||||
assert(isMenuOpen() == false)
|
||||
end)
|
||||
step("should have some game cards on this page", function()
|
||||
gameCardExist()
|
||||
end)
|
||||
describe("should be able to navigate to every game list by drop down menu", function()
|
||||
include(canNavigateToAllMenu)
|
||||
end)
|
||||
end)
|
||||
end
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
--to make ScriptAnalyzer Happy
|
||||
describe = nil
|
||||
step = nil
|
||||
expect = nil
|
||||
include = nil
|
||||
-------------------------------
|
||||
|
||||
local Test = game.CoreGui.RobloxGui.Modules.Test4R
|
||||
local startTest = require(Test.startTest)
|
||||
local TextReporter = require(Test.Reporters.TextReporter)
|
||||
local TeamCityReporter = require(Test.Reporters.TeamCityReporter)
|
||||
local reporter = _G["TEAMCITY"] and TeamCityReporter or TextReporter
|
||||
|
||||
local HomePageLoad = require(script.Parent.Modules.HomePageLoad)
|
||||
local HomePageScroll = require(script.Parent.Modules.HomePageScroll)
|
||||
local GameGardZoom = require(script.Parent.Modules.GameGardZoom)
|
||||
local NavigateToAllGameLists = require(script.Parent.Modules.NavigateToAllGameLists)
|
||||
local AvatarTest = require(script.Parent.Modules.AvatarTest)
|
||||
local AllTabsSwitch = require(script.Parent.Modules.BVT.AllTabsSwitch)
|
||||
|
||||
|
||||
local function test()
|
||||
describe.protected("Mobile Place Rhodium Test", function()
|
||||
include(AllTabsSwitch)
|
||||
include(HomePageLoad)
|
||||
include(HomePageScroll)
|
||||
include(GameGardZoom)
|
||||
-- gametest1 do not have to much games for testting.
|
||||
-- include(NavigateToAllGameLists)
|
||||
include(AvatarTest)
|
||||
end)
|
||||
end
|
||||
|
||||
function run()
|
||||
startTest(test, reporter)
|
||||
end
|
||||
return run
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
--to make ScriptAnalyzer Happy
|
||||
describe = nil
|
||||
step = nil
|
||||
expect = nil
|
||||
include = nil
|
||||
-------------------------------
|
||||
|
||||
local Test = game.CoreGui.RobloxGui.Modules.Test4R
|
||||
local startTest = require(Test.startTest)
|
||||
local TextReporter = require(Test.Reporters.TextReporter)
|
||||
local TeamCityReporter = require(Test.Reporters.TeamCityReporter)
|
||||
local reporter = _G["TEAMCITY"] and TeamCityReporter or TextReporter
|
||||
|
||||
local AllTabsSwitch = require(script.Parent.Modules.BVT.AllTabsSwitch)
|
||||
|
||||
|
||||
local function test()
|
||||
describe.protected("Mobile Place Rhodium Basic Functional Test", function()
|
||||
--include(YourFunctionalTest)
|
||||
end)
|
||||
end
|
||||
|
||||
function run()
|
||||
startTest(test, reporter)
|
||||
end
|
||||
return run
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
--to make ScriptAnalyzer Happy
|
||||
describe = nil
|
||||
step = nil
|
||||
expect = nil
|
||||
include = nil
|
||||
-------------------------------
|
||||
|
||||
local Test = game.CoreGui.RobloxGui.Modules.Test4R
|
||||
local startTest = require(Test.startTest)
|
||||
local TextReporter = require(Test.Reporters.TextReporter)
|
||||
local TeamCityReporter = require(Test.Reporters.TeamCityReporter)
|
||||
local reporter = _G["TEAMCITY"] and TeamCityReporter or TextReporter
|
||||
|
||||
local AllTabsSwitch = require(script.Parent.Modules.BVT.AllTabsSwitch)
|
||||
|
||||
|
||||
local function test()
|
||||
describe.protected("Mobile Place Rhodium Basic Verification Test", function()
|
||||
include(AllTabsSwitch)
|
||||
end)
|
||||
end
|
||||
|
||||
function run()
|
||||
startTest(test, reporter)
|
||||
end
|
||||
return run
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
--to make ScriptAnalyzer Happy
|
||||
describe = nil
|
||||
step = nil
|
||||
expect = nil
|
||||
include = nil
|
||||
-------------------------------
|
||||
|
||||
local Test = game.CoreGui.RobloxGui.Modules.Test4R
|
||||
local startTest = require(Test.startTest)
|
||||
local TextReporter = require(Test.Reporters.TextReporter)
|
||||
local TeamCityReporter = require(Test.Reporters.TeamCityReporter)
|
||||
local reporter = _G["TEAMCITY"] and TeamCityReporter or TextReporter
|
||||
|
||||
local AllTabsSwitch = require(script.Parent.Modules.BVT.AllTabsSwitch)
|
||||
|
||||
|
||||
local function test()
|
||||
describe.protected("Mobile Place Rhodium Comprehensive Test", function()
|
||||
--include(YourComprehensiveTest)
|
||||
end)
|
||||
end
|
||||
|
||||
function run()
|
||||
startTest(test, reporter)
|
||||
end
|
||||
return run
|
||||
Reference in New Issue
Block a user