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

feat(web,server): refactor reearth visualizer #1385

Closed
wants to merge 7 commits into from
Closed
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
418 changes: 417 additions & 1 deletion server/e2e/gql_custom_property_test.go

Large diffs are not rendered by default.

35 changes: 0 additions & 35 deletions server/e2e/gql_layer_test.go

This file was deleted.

37 changes: 2 additions & 35 deletions server/e2e/gql_project_import_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package e2e

import (
"net/http"
"os"
"testing"

Expand Down Expand Up @@ -84,16 +83,8 @@ func getScene(e *httpexpect.Expect, s string, l string) *httpexpect.Object {
"lang": l,
},
}
r := e.POST("/api/graphql").
WithHeader("Origin", "https://example.com").
WithHeader("authorization", "Bearer test").
WithHeader("X-Reearth-Debug-User", uID.String()).
WithHeader("Content-Type", "application/json").
WithJSON(requestBody).
Expect().
Status(http.StatusOK).
JSON().
Object()

r := Request(e, uID.String(), requestBody).Object()
v := r.Value("data").Object().Value("node")
v.NotNull()
return v.Object()
Expand All @@ -112,30 +103,6 @@ query GetScene($sceneId: ID!, $lang: Lang) {
...PropertyFragment
__typename
}
clusters {
id
name
propertyId
property {
id
...PropertyFragment
__typename
}
__typename
}
tags {
id
label
... on TagGroup {
tags {
id
label
__typename
}
__typename
}
__typename
}
plugins {
property {
id
Expand Down
130 changes: 0 additions & 130 deletions server/e2e/gql_storytelling_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,104 +409,6 @@ func duplicatePage(e *httpexpect.Expect, sID, storyID, pageID string) (GraphQLRe
return requestBody, res, pID.(string)
}

func addLayerToPage(e *httpexpect.Expect, sId, storyId, pageId, layerId string, swipeable *bool) (GraphQLRequest, *httpexpect.Value, string) {
requestBody := GraphQLRequest{
OperationName: "AddPageLayer",
Query: `mutation AddPageLayer($sceneId: ID!, $storyId: ID!, $pageId: ID!, $layerId: ID!, $swipeable: Boolean) {
addPageLayer( input: {sceneId: $sceneId, storyId: $storyId, pageId: $pageId, swipeable: $swipeable, layerId: $layerId} ) {
story {
id
pages{
id
}
}
page{
id
layers{
id
}
swipeableLayers{
id
}
}
}
}`,
Variables: map[string]any{
"sceneId": sId,
"storyId": storyId,
"pageId": pageId,
"layerId": layerId,
"swipeable": swipeable,
},
}

res := Request(e, uID.String(), requestBody)

pageRes := res.Object().
Value("data").Object().
Value("addPageLayer").Object().
Value("page").Object()

if swipeable != nil && *swipeable {
pageRes.Value("swipeableLayers").Array().
Path("$..id").Array().Contains(layerId)
} else {
pageRes.Value("layers").Array().
Path("$..id").Array().Contains(layerId)
}

return requestBody, res, layerId
}

func removeLayerToPage(e *httpexpect.Expect, sId, storyId, pageId, layerId string, swipeable *bool) (GraphQLRequest, *httpexpect.Value, string) {
requestBody := GraphQLRequest{
OperationName: "RemovePageLayer",
Query: `mutation RemovePageLayer($sceneId: ID!, $storyId: ID!, $pageId: ID!, $layerId: ID!, $swipeable: Boolean) {
removePageLayer( input: {sceneId: $sceneId, storyId: $storyId, pageId: $pageId, swipeable: $swipeable, layerId: $layerId} ) {
story {
id
pages{
id
}
}
page{
id
layers{
id
}
swipeableLayers{
id
}
}
}
}`,
Variables: map[string]any{
"sceneId": sId,
"storyId": storyId,
"pageId": pageId,
"layerId": layerId,
"swipeable": swipeable,
},
}

res := Request(e, uID.String(), requestBody)

pageRes := res.Object().
Value("data").Object().
Value("removePageLayer").Object().
Value("page").Object()

if swipeable != nil && *swipeable {
pageRes.Value("swipeableLayers").Array().
Path("$..id").Array().NotContains(layerId)
} else {
pageRes.Value("layers").Array().
Path("$..id").Array().NotContains(layerId)
}

return requestBody, res, layerId
}

func createBlock(e *httpexpect.Expect, sID, storyID, pageID, pluginId, extensionId string, idx *int) (GraphQLRequest, *httpexpect.Value, string) {
requestBody := GraphQLRequest{
OperationName: "CreateStoryBlock",
Expand Down Expand Up @@ -750,38 +652,6 @@ func TestStoryPageCRUD(t *testing.T) {
pagesRes.Path("$[:].title").Equal([]string{"test 1"})
}

func TestStoryPageLayersCRUD(t *testing.T) {
e := Server(t, baseSeeder)

pID := createProject(e, "test")

_, _, sID := createScene(e, pID)

_, _, storyID := createStory(e, sID, "test", 0)

_, _, pageID := createPage(e, sID, storyID, "test", true)

_, res := fetchSceneForStories(e, sID)
res.Object().
Path("$.data.node.stories[0].pages[0].layers").Equal([]any{})

rootLayerID := res.Path("$.data.node.rootLayerId").Raw().(string)

_, _, layerID := addLayerItemFromPrimitive(e, rootLayerID)

_, _, _ = addLayerToPage(e, sID, storyID, pageID, layerID, nil)

_, res = fetchSceneForStories(e, sID)
res.Object().
Path("$.data.node.stories[0].pages[0].layers[:].id").Equal([]string{layerID})

_, _, _ = removeLayerToPage(e, sID, storyID, pageID, layerID, nil)

_, res = fetchSceneForStories(e, sID)
res.Object().
Path("$.data.node.stories[0].pages[0].layers").Equal([]any{})
}

func TestStoryPageBlocksCRUD(t *testing.T) {
e := Server(t, baseSeeder)

Expand Down
50 changes: 0 additions & 50 deletions server/gql/cluster.graphql

This file was deleted.

Loading
Loading