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

Update WebStorage to test proper result responses from the host sdk #2463

Open
wants to merge 3 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
28 changes: 26 additions & 2 deletions apps/teams-test-app/e2e-test-data/webStorage.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,39 @@
},
"checkIsSupported": {
"domElementName": "checkWebStorageCapability",
"expectedOutput": "webStorage is not supported"
"expectedOutput": "webStorage is supported"
},
"testCases": [
{
"title": "isWebStorageClearedOnUserLogOut function Call - Success",
"type": "callResponse",
"boxSelector": "#box_isWebStorageClearedOnUserLogOut",
"expectedAlertValue": "isWebStorageClearedOnUserLogOut called",
"expectedTestAppValue": "webStorage is cleared on user log out"
"expectedTestAppValue": "webStorage is cleared on user log out",
"hostSdkVersion": {
"web": "<4.0.2"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this PR might need to wait for a little bit since Web Host SDK is releasing and I am not sure which version you should exactly to have here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good, will wait

}
},
{
"title": "isWebStorageClearedOnUserLogOut function Call - Success (True case)",
"type": "callResponse",
"boxSelector": "#box_isWebStorageClearedOnUserLogOut",
"expectedAlertValue": "isWebStorageClearedOnUserLogOut called",
"expectedTestAppValue": "webStorage is cleared on user log out. Result from sdk: true",
"hostSdkVersion": {
"web": ">=4.0.2"
}
},
{
"title": "isWebStorageClearedOnUserLogOut function Call - Success (False case)",
"type": "callResponse",
"boxSelector": "#box_isWebStorageClearedOnUserLogOut",
"modulesToDisable": ["shouldWebStorageResolveToTrueToggle"],
"expectedAlertValue": "isWebStorageClearedOnUserLogOut called",
"expectedTestAppValue": "webStorage is not cleared on user log out. Result from sdk: false",
"hostSdkVersion": {
"web": ">=4.0.2"
}
}
]
}
16 changes: 14 additions & 2 deletions apps/teams-test-app/src/components/WebStorageAPIs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,20 @@ const IsWebStorageClearedOnLogOut = (): React.ReactElement =>
ApiWithoutInput({
name: 'isWebStorageClearedOnUserLogOut',
title: 'Is Web Storage Cleared on Log Out',
onClick: async () =>
`webStorage ${(await webStorage.isWebStorageClearedOnUserLogOut()) ? 'is' : 'is not'} cleared on user log out`,
onClick: async () => {
const result = await webStorage.isWebStorageClearedOnUserLogOut();
try {
if (result === true) {
return `webStorage is cleared on user log out. Result from sdk: ${result}`;
} else if (result === false) {
return `webStorage is not cleared on user log out. Result from sdk: ${result}`;
} else {
throw new Error('Invalid result: must be true or false');
}
} catch (error) {
return `Error: ${error}. Result from sdk: ${result}`;
}
},
});

const WebStorageAPIs = (): ReactElement => (
Expand Down
Loading