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

add ics filter params #2647

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
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
13 changes: 9 additions & 4 deletions apps/teams-test-app/e2e-test-data/otherAppStateChange.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,22 @@
"type": "registerAndRaiseEvent",
"boxSelector": "#box_otherAppStateChange_registerInstallHandler",
"eventName": "otherApp.install",
"eventData":
{
"appIds": ["123", "456"]
},
"eventData": {
"appIds": ["123", "456"]
},
"expectedTestAppValue": "received"
},
{
"title": "unregisterAppInstallationHandler - Sends but not processed if app is not approved",
"type": "callResponse",
"boxSelector": "#box_otherAppStateChange_unregisterInstallHandler",
"expectedTestAppValue": "received"
},
{
"title": "notifyInstallCompleted - Success",
"type": "callResponse",
"boxSelector": "#box_otherAppStateChange_notifyInstallCompleted",
"expectedTestAppValue": "notified"
}
]
}
165 changes: 165 additions & 0 deletions apps/teams-test-app/e2e-test-data/store.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
{
"name": "Store",
"platforms": "Web",
"checkIsSupported": {
"domElementName": "checkCapabilityStore"
},
"version": ">2.31.0",
"hostSdkVersion": {
"web": ">4.5.0"
},
"testCases": [
{
"title": "openStoreExperience API Call Full Store - Success",
"type": "callResponse",
"boxSelector": "#box_storeOpen",
"inputValue": {
"dialogType": "fullstore",
"size": {
"width": "large",
"height": "large"
}
},
"expectedAlertValue": "openStoreExperience called with ##JSON_INPUT_VALUE##"
},
{
"title": "openStoreExperience API Call App Detail - Success",
"type": "callResponse",
"boxSelector": "#box_storeOpen",
"inputValue": {
"dialogType": "appdetail",
"appId": "1542629c-01b3-4a6d-8f76-1938b779e48d"
},
"expectedAlertValue": "openStoreExperience called with ##JSON_INPUT_VALUE##"
},
{
"title": "openStoreExperience API Call App Detail With Invalid AppId - Fail",
"type": "callResponse",
"boxSelector": "#box_storeOpen",
"inputValue": {
"dialogType": "appdetail",
"appId": "123"
},
"expectedTestAppValue": "Error: Error: Potential app id (123) is invalid; its length 3 is not within the length limits (4-256)."
},
{
"title": "openStoreExperience API Call App Detail With Empty AppId - Fail",
"type": "callResponse",
"boxSelector": "#box_storeOpen",
"inputValue": {
"dialogType": "appdetail",
"appId": ""
},
"expectedTestAppValue": "Error: Error: Potential app id () is invalid; its length 0 is not within the length limits (4-256)."
},
{
"title": "openStoreExperience API Call App Detail Without AppId - Fail",
"type": "callResponse",
"boxSelector": "#box_storeOpen",
"inputValue": {
"dialogType": "appdetail"
},
"expectedTestAppValue": "Error: Error: No App Id present, but AppId needed to open AppDetail store"
},
{
"title": "openStoreExperience API Call Specific Store - Success",
"type": "callResponse",
"boxSelector": "#box_storeOpen",
"inputValue": {
"dialogType": "specificstore",
"collectionId": "copilotplugins"
},
"expectedAlertValue": "openStoreExperience called with ##JSON_INPUT_VALUE##"
},
{
"title": "openStoreExperience API Call Specific Store With Empty CollectionId - Fail",
"type": "callResponse",
"boxSelector": "#box_storeOpen",
"inputValue": {
"dialogType": "specificstore",
"collectionId": ""
},
"expectedTestAppValue": "Error: Error: No Collection Id present, but CollectionId needed to open a store specific to a collection"
},
{
"title": "openStoreExperience API Call Specific Store Without CollectionId - Fail",
"type": "callResponse",
"boxSelector": "#box_storeOpen",
"inputValue": {
"dialogType": "specificstore"
},
"expectedTestAppValue": "Error: Error: No Collection Id present, but CollectionId needed to open a store specific to a collection"
},
{
"title": "openStoreExperience API Call With Invalid Dialog Type - Fail",
"type": "callResponse",
"boxSelector": "#box_storeOpen",
"inputValue": {
"dialogType": "123"
},
"expectedTestAppValue": "Error: Error: Invalid store dialog type, but type needed to specify store to open"
},
{
"title": "openStoreExperience API Call Without Permission - Fail",
"type": "callResponse",
"boxSelector": "#box_storeOpen",
"inputValue": {
"dialogType": "fullstore"
},
"testUrlParams": [["appDefOverrides", "{\"isFullTrustApp\": false, \"isMicrosoftOwned\": false}"]],
"expectedTestAppValue": "Error: Error: 500, message: App does not have the required permissions for this operation"
},
{
"title": "openStoreExperience API Call With Invalid Dialog Width Size - Fail",
"type": "callResponse",
"boxSelector": "#box_storeOpen",
"inputValue": {
"dialogType": "fullstore",
"size": {
"width": -300,
"height": "large"
}
},
"expectedTestAppValue": "Error: Error: Invalid store dialog size"
},
{
"title": "openStoreExperience API Call With Invalid Dialog Height Size - Fail",
"type": "callResponse",
"boxSelector": "#box_storeOpen",
"inputValue": {
"dialogType": "fullstore",
"size": {
"width": 300,
"height": -300
}
},
"expectedTestAppValue": "Error: Error: Invalid store dialog size"
},
{
"title": "openStoreExperience API Call In-Context-Store with Default Filters - Success",
"type": "callResponse",
"boxSelector": "#box_storeOpen",
"inputValue": {
"dialogType": "ics"
},
"expectedAlertValue": "openStoreExperience called with {\"dialogType\":\"ics\",\"appCapability\":\"Tab\",\"installationScope\":\"Personal\"}"
},
{
"title": "openStoreExperience API Call In-Context-Store with Customized Filters - Success",
"type": "callResponse",
"boxSelector": "#box_storeOpen",
"inputValue": {
"dialogType": "ics",
"appCapability": "Bot",
"appMetaCapabilities": ["copilotplugins", "copilotExtensions"],
"installationScope": "Team",
"filteredOutAppIds": ["123"],
"size": {
"width": "large",
"height": "large"
}
},
"expectedAlertValue": "openStoreExperience called with ##JSON_INPUT_VALUE##"
}
]
}
22 changes: 20 additions & 2 deletions apps/teams-test-app/src/components/StoreApis.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AppId, store } from '@microsoft/teams-js';
import { AppId, DialogSize, store } from '@microsoft/teams-js';
import { ReactElement } from 'react';
import React from 'react';

Expand All @@ -20,7 +20,16 @@ const StoreAPIs = (): ReactElement => {
});

const OpenStore = (): ReactElement =>
ApiWithTextInput<{ dialogType: string; appId?: string; collectionId?: string }>({
ApiWithTextInput<{
dialogType: string;
appId?: string;
collectionId?: string;
size?: DialogSize;
appCapability?: string;
appMetaCapabilities?: string[];
installationScope?: string;
filteredOutAppIds?: string[];
}>({
name: 'storeOpen',
title: 'Store Open',
onClick: {
Expand All @@ -35,6 +44,11 @@ const StoreAPIs = (): ReactElement => {
dialogType: input.dialogType,
appId: appId,
collectionId: input.collectionId,
size: input.size,
appCapability: input.appCapability,
appMetaCapabilities: input.appMetaCapabilities,
installationScope: input.installationScope,
filteredOutAppIds: input.filteredOutAppIds,
};
// eslint-disable-next-line no-useless-catch
try {
Expand All @@ -48,6 +62,10 @@ const StoreAPIs = (): ReactElement => {
defaultInput: JSON.stringify({
dialogType: 'appdetail',
appId: '1542629c-01b3-4a6d-8f76-1938b779e48d',
size: {
width: 'large',
height: 300,
},
}),
});
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "Added the ability to specify size of store dialogs and ability to pass filter info for ics.",
"packageName": "@microsoft/teams-js",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Loading
Loading