Update e2e tests and n8n node for the portal
Follow the new domain model in tests: drop organization profile assertions, add a trust center profile test, and hit the dedicated HTTPS listener with SNI for the visitor API. Mirror the custom link rename and profile field moves in the n8n node operations. Signed-off-by: Bryan Frimin <bryan@probo.com>
This commit is contained in:
@@ -34,7 +34,7 @@ func TestOrganization_Update(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
|
||||
t.Run("update name and description", func(t *testing.T) {
|
||||
t.Run("update name", func(t *testing.T) {
|
||||
newName := fmt.Sprintf("Updated Org %d", time.Now().UnixNano())
|
||||
|
||||
query := `
|
||||
@@ -43,7 +43,6 @@ func TestOrganization_Update(t *testing.T) {
|
||||
organization {
|
||||
id
|
||||
name
|
||||
description
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,9 +51,8 @@ func TestOrganization_Update(t *testing.T) {
|
||||
var result struct {
|
||||
UpdateOrganization struct {
|
||||
Organization struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"organization"`
|
||||
} `json:"updateOrganization"`
|
||||
}
|
||||
@@ -63,82 +61,12 @@ func TestOrganization_Update(t *testing.T) {
|
||||
"input": map[string]any{
|
||||
"organizationId": owner.GetOrganizationID().String(),
|
||||
"name": newName,
|
||||
"description": "Updated organization description",
|
||||
},
|
||||
}, &result)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, owner.GetOrganizationID().String(), result.UpdateOrganization.Organization.ID)
|
||||
assert.Equal(t, newName, result.UpdateOrganization.Organization.Name)
|
||||
assert.Equal(t, "Updated organization description", result.UpdateOrganization.Organization.Description)
|
||||
})
|
||||
|
||||
t.Run("update website and email", func(t *testing.T) {
|
||||
query := `
|
||||
mutation UpdateOrganization($input: UpdateOrganizationInput!) {
|
||||
updateOrganization(input: $input) {
|
||||
organization {
|
||||
id
|
||||
websiteUrl
|
||||
email
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
var result struct {
|
||||
UpdateOrganization struct {
|
||||
Organization struct {
|
||||
ID string `json:"id"`
|
||||
WebsiteUrl string `json:"websiteUrl"`
|
||||
Email string `json:"email"`
|
||||
} `json:"organization"`
|
||||
} `json:"updateOrganization"`
|
||||
}
|
||||
|
||||
err := owner.ExecuteConnect(query, map[string]any{
|
||||
"input": map[string]any{
|
||||
"organizationId": owner.GetOrganizationID().String(),
|
||||
"websiteUrl": "https://example.com",
|
||||
"email": "contact@example.com",
|
||||
},
|
||||
}, &result)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, "https://example.com", result.UpdateOrganization.Organization.WebsiteUrl)
|
||||
assert.Equal(t, "contact@example.com", result.UpdateOrganization.Organization.Email)
|
||||
})
|
||||
|
||||
t.Run("update headquarter address", func(t *testing.T) {
|
||||
query := `
|
||||
mutation UpdateOrganization($input: UpdateOrganizationInput!) {
|
||||
updateOrganization(input: $input) {
|
||||
organization {
|
||||
id
|
||||
headquarterAddress
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
var result struct {
|
||||
UpdateOrganization struct {
|
||||
Organization struct {
|
||||
ID string `json:"id"`
|
||||
HeadquarterAddress string `json:"headquarterAddress"`
|
||||
} `json:"organization"`
|
||||
} `json:"updateOrganization"`
|
||||
}
|
||||
|
||||
err := owner.ExecuteConnect(query, map[string]any{
|
||||
"input": map[string]any{
|
||||
"organizationId": owner.GetOrganizationID().String(),
|
||||
"headquarterAddress": "123 Main St, Suite 100, San Francisco, CA 94102",
|
||||
},
|
||||
}, &result)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, "123 Main St, Suite 100, San Francisco, CA 94102", result.UpdateOrganization.Organization.HeadquarterAddress)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -200,10 +128,6 @@ func TestOrganization_Get(t *testing.T) {
|
||||
... on Organization {
|
||||
id
|
||||
name
|
||||
description
|
||||
websiteUrl
|
||||
email
|
||||
headquarterAddress
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -211,12 +135,8 @@ func TestOrganization_Get(t *testing.T) {
|
||||
|
||||
var result struct {
|
||||
Node struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
WebsiteUrl string `json:"websiteUrl"`
|
||||
Email string `json:"email"`
|
||||
HeadquarterAddress string `json:"headquarterAddress"`
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"node"`
|
||||
}
|
||||
|
||||
|
||||
@@ -1324,7 +1324,7 @@ func TestRBAC(t *testing.T) {
|
||||
client: owner,
|
||||
query: updateOrganizationMutation,
|
||||
variables: func() map[string]any {
|
||||
return map[string]any{"input": map[string]any{"organizationId": owner.GetOrganizationID().String(), "description": factory.SafeName("Updated Desc")}}
|
||||
return map[string]any{"input": map[string]any{"organizationId": owner.GetOrganizationID().String(), "name": factory.SafeName("Updated Org")}}
|
||||
},
|
||||
shouldAllow: true,
|
||||
useConnect: true,
|
||||
@@ -1335,7 +1335,7 @@ func TestRBAC(t *testing.T) {
|
||||
client: admin,
|
||||
query: updateOrganizationMutation,
|
||||
variables: func() map[string]any {
|
||||
return map[string]any{"input": map[string]any{"organizationId": owner.GetOrganizationID().String(), "description": factory.SafeName("Updated Desc")}}
|
||||
return map[string]any{"input": map[string]any{"organizationId": owner.GetOrganizationID().String(), "name": factory.SafeName("Updated Org")}}
|
||||
},
|
||||
shouldAllow: true,
|
||||
useConnect: true,
|
||||
@@ -1346,7 +1346,7 @@ func TestRBAC(t *testing.T) {
|
||||
client: viewer,
|
||||
query: updateOrganizationMutation,
|
||||
variables: func() map[string]any {
|
||||
return map[string]any{"input": map[string]any{"organizationId": owner.GetOrganizationID().String(), "description": factory.SafeName("Updated Desc")}}
|
||||
return map[string]any{"input": map[string]any{"organizationId": owner.GetOrganizationID().String(), "name": factory.SafeName("Updated Org")}}
|
||||
},
|
||||
shouldAllow: false,
|
||||
useConnect: true,
|
||||
|
||||
106
e2e/console/trust_center_profile_test.go
Normal file
106
e2e/console/trust_center_profile_test.go
Normal file
@@ -0,0 +1,106 @@
|
||||
// Copyright (c) 2026 Probo Inc <hello@probo.com>.
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
// PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
package console_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.probo.inc/probo/e2e/internal/testutil"
|
||||
)
|
||||
|
||||
func TestTrustCenter_UpdateProfile(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
organizationID := owner.GetOrganizationID().String()
|
||||
|
||||
const trustCenterQuery = `
|
||||
query($organizationId: ID!) {
|
||||
node(id: $organizationId) {
|
||||
... on Organization {
|
||||
trustCenter {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
var trustCenterLookup struct {
|
||||
Node struct {
|
||||
TrustCenter struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"trustCenter"`
|
||||
} `json:"node"`
|
||||
}
|
||||
|
||||
err := owner.Execute(trustCenterQuery, map[string]any{
|
||||
"organizationId": organizationID,
|
||||
}, &trustCenterLookup)
|
||||
require.NoError(t, err)
|
||||
require.NotEmpty(t, trustCenterLookup.Node.TrustCenter.ID)
|
||||
|
||||
trustCenterID := trustCenterLookup.Node.TrustCenter.ID
|
||||
|
||||
const updateMutation = `
|
||||
mutation UpdateTrustCenter($input: UpdateTrustCenterInput!) {
|
||||
updateTrustCenter(input: $input) {
|
||||
trustCenter {
|
||||
id
|
||||
description
|
||||
websiteUrl
|
||||
email
|
||||
headquarterAddress
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
var result struct {
|
||||
UpdateTrustCenter struct {
|
||||
TrustCenter struct {
|
||||
ID string `json:"id"`
|
||||
Description *string `json:"description"`
|
||||
WebsiteURL *string `json:"websiteUrl"`
|
||||
Email *string `json:"email"`
|
||||
HeadquarterAddress *string `json:"headquarterAddress"`
|
||||
} `json:"trustCenter"`
|
||||
} `json:"updateTrustCenter"`
|
||||
}
|
||||
|
||||
err = owner.Execute(updateMutation, map[string]any{
|
||||
"input": map[string]any{
|
||||
"trustCenterId": trustCenterID,
|
||||
"description": "We keep your data safe.",
|
||||
"websiteUrl": "https://example.com",
|
||||
"email": "security@example.com",
|
||||
"headquarterAddress": "123 Main St, San Francisco, CA 94102",
|
||||
},
|
||||
}, &result)
|
||||
require.NoError(t, err)
|
||||
|
||||
tc := result.UpdateTrustCenter.TrustCenter
|
||||
assert.Equal(t, trustCenterID, tc.ID)
|
||||
require.NotNil(t, tc.Description)
|
||||
assert.Equal(t, "We keep your data safe.", *tc.Description)
|
||||
require.NotNil(t, tc.WebsiteURL)
|
||||
assert.Equal(t, "https://example.com", *tc.WebsiteURL)
|
||||
require.NotNil(t, tc.Email)
|
||||
assert.Equal(t, "security@example.com", *tc.Email)
|
||||
require.NotNil(t, tc.HeadquarterAddress)
|
||||
assert.Equal(t, "123 Main St, San Francisco, CA 94102", *tc.HeadquarterAddress)
|
||||
}
|
||||
Reference in New Issue
Block a user