-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
test: new test cases framework functions and Action selector #37566
Merged
+4,565
−6
Merged
Changes from 52 commits
Commits
Show all changes
59 commits
Select commit
Hold shift + click to select a range
a88888a
new test cases fof action
sagar-qa007 4790898
Update for flaky
sagar-qa007 cc8200d
Alert messsage code done
sagar-qa007 ba6a61d
update for test
sagar-qa007 59e9362
Modal related cases done
sagar-qa007 6b0d5dc
local storage related test cases
sagar-qa007 9906ca7
Run setup
sagar-qa007 1203bf5
update only
sagar-qa007 25a3d63
Merge remote-tracking branch 'origin/release' into test/frameworkfunc…
sagar-qa007 9ce0a1b
Saved changes for download
sagar-qa007 41ffc6f
Merge remote-tracking branch 'origin/release' into test/frameworkfunc…
sagar-qa007 0b7f0de
Merge remote-tracking branch 'origin/release' into test/frameworkfunc…
sagar-qa007 056527a
Merge remote-tracking branch 'origin/release' into test/frameworkfunc…
sagar-qa007 405a351
Merge remote-tracking branch 'origin/release' into test/frameworkfunc…
sagar-qa007 ba3a393
Merge remote-tracking branch 'origin/release' into test/frameworkfunc…
sagar-qa007 af97ce4
Minor update
sagar-qa007 68f0553
Merge remote-tracking branch 'origin/release' into test/frameworkfunc…
sagar-qa007 390638a
Merge remote-tracking branch 'origin/release' into test/frameworkfunc…
sagar-qa007 9038912
reverted only
sagar-qa007 359b47b
Download fun test cases
sagar-qa007 62fa7f0
Reverted only
sagar-qa007 4e0c35b
Completed download file
sagar-qa007 ceef715
Minor optimisations
sagar-qa007 683cf24
Optimisation for jsobject
sagar-qa007 dc24c4b
Copy to clipboard cases done
sagar-qa007 93575cc
Reset widget test cases
sagar-qa007 ae8b90a
Completed basic code for setInterval
sagar-qa007 ab2cf12
Data added
sagar-qa007 92fc503
Merge branch 'release' into test/frameworkfunctions
sagar-qa007 f6251eb
Small update for code
sagar-qa007 704c5c0
Merge remote-tracking branch 'origin' into test/frameworkfunctions
sagar-qa007 42f5163
Merge remote-tracking branch 'origin' into test/frameworkfunctions
sagar-qa007 cbf2217
Updated interval tc
sagar-qa007 bff309f
Watch geo location cases
sagar-qa007 d0fc084
some work progress
sagar-qa007 339795e
Merge branch 'release' into test/frameworkfunctions
yatinappsmith 7359fe9
Update with postmessage
sagar-qa007 de199ee
Update for postwindow
sagar-qa007 b2c711b
Merge branch 'release' into test/frameworkfunctions
sagar-qa007 f65f265
Basic setup
sagar-qa007 5878c38
Some steps written
sagar-qa007 dba856b
Progress saved
sagar-qa007 eb7bf2a
remove only
sagar-qa007 6dc9327
Fix local store and actionselector done
sagar-qa007 9756ce8
Fix for download file
sagar-qa007 4ea1a3b
Merge branch 'release' into test/frameworkfunctions
sagar-qa007 98300a1
Modal and stop location fixes
sagar-qa007 b8e53e2
Postwindownew cases
sagar-qa007 46ff2ce
Updated name
sagar-qa007 6dae3c9
Deleted unused file
sagar-qa007 c14d734
Minor update
sagar-qa007 9cda459
Prettier error resolve
sagar-qa007 09176be
Homepage revert
sagar-qa007 6560706
HomepageTs revert
sagar-qa007 e6768cb
Update for test fix
sagar-qa007 c6250d0
Update
sagar-qa007 fd8d5e2
Merge branch 'release' into test/frameworkfunctions
sagar-qa007 d89d870
Fix cases
sagar-qa007 56f7a2e
Merge remote-tracking branch 'origin' into test/frameworkfunctions
sagar-qa007 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,6 +79,241 @@ describe( | |
agHelper.ClickButton("ClearStore"); | ||
agHelper.AssertContains(JSON.stringify({})); | ||
deployMode.NavigateBacktoEditor(); | ||
EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); | ||
agHelper.GetNClick(propPane._deleteWidget); | ||
EditorNavigation.SelectEntityByName("Button2", EntityType.Widget); | ||
agHelper.GetNClick(propPane._deleteWidget); | ||
}); | ||
|
||
it("2. To verify both persistent and session-specific stored values are cleared when clearStore() is called.", function () { | ||
entityExplorer.DragDropWidgetNVerify("buttonwidget", 100, 100); | ||
const JS_OBJECT_BODY = `export default { | ||
storePersistentValue: async () => { | ||
let values = [ | ||
storeValue('persistentVal1', 'persistent value 1', true), | ||
storeValue('persistentVal2', 'persistent value 2', true), | ||
storeValue('sessionVal1', 'session value 1'), | ||
storeValue('sessionVal2', 'session value 2'), | ||
]; | ||
await Promise.all(values); | ||
await showAlert(JSON.stringify(appsmith.store)); | ||
}, | ||
clearStore: async () => { | ||
await clearStore(); | ||
await showAlert(JSON.stringify(appsmith.store)); | ||
} | ||
}`; | ||
|
||
jsEditor.CreateJSObject(JS_OBJECT_BODY, { | ||
paste: true, | ||
completeReplace: true, | ||
toRun: false, | ||
prettify: false, | ||
shouldCreateNewJSObj: true, | ||
}); | ||
|
||
EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); | ||
propPane.UpdatePropertyFieldValue("Label", ""); | ||
propPane.TypeTextIntoField("Label", "StorePersistentValue"); | ||
cy.get("@jsObjName").then((jsObj: any) => { | ||
propPane.SelectJSFunctionToExecute( | ||
"onClick", | ||
jsObj as string, | ||
"storePersistentValue", | ||
); | ||
}); | ||
|
||
entityExplorer.DragDropWidgetNVerify("buttonwidget", 200, 300); | ||
EditorNavigation.SelectEntityByName("Button2", EntityType.Widget); | ||
propPane.UpdatePropertyFieldValue("Label", ""); | ||
propPane.TypeTextIntoField("Label", "ClearStore"); | ||
cy.get("@jsObjName").then((jsObj: any) => { | ||
propPane.SelectJSFunctionToExecute( | ||
"onClick", | ||
jsObj as string, | ||
"clearStore", | ||
); | ||
}); | ||
|
||
deployMode.DeployApp(); | ||
agHelper.ClickButton("StorePersistentValue"); | ||
agHelper.AssertContains( | ||
JSON.stringify({ | ||
persistentVal1: "persistent value 1", | ||
persistentVal2: "persistent value 2", | ||
sessionVal1: "session value 1", | ||
sessionVal2: "session value 2", | ||
}), | ||
); | ||
agHelper.ClickButton("ClearStore"); | ||
agHelper.AssertContains(JSON.stringify({})); | ||
deployMode.NavigateBacktoEditor(); | ||
EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); | ||
agHelper.GetNClick(propPane._deleteWidget); | ||
EditorNavigation.SelectEntityByName("Button2", EntityType.Widget); | ||
agHelper.GetNClick(propPane._deleteWidget); | ||
}); | ||
|
||
it("3. To verify that clearStore() only removes values stored by the application and does not affect other unrelated data in the browser's local storage.", function () { | ||
entityExplorer.DragDropWidgetNVerify("buttonwidget", 100, 100); | ||
// Set some unrelated local storage data | ||
cy.window().then((win) => { | ||
win.localStorage.setItem("unrelatedKey1", "unrelated value 1"); | ||
win.localStorage.setItem("unrelatedKey2", "unrelated value 2"); | ||
}); | ||
|
||
entityExplorer.DragDropWidgetNVerify("buttonwidget", 100, 100); | ||
const JS_OBJECT_BODY = `export default { | ||
storeValue: async () => { | ||
let values = [ | ||
storeValue('val1', 'value 1'), | ||
storeValue('val2', 'value 2'), | ||
]; | ||
await Promise.all(values); | ||
await showAlert(JSON.stringify(appsmith.store)); | ||
}, | ||
clearStore: async () => { | ||
await clearStore(); | ||
await showAlert(JSON.stringify(appsmith.store)); | ||
} | ||
}`; | ||
|
||
jsEditor.CreateJSObject(JS_OBJECT_BODY, { | ||
paste: true, | ||
completeReplace: true, | ||
toRun: false, | ||
prettify: false, | ||
shouldCreateNewJSObj: true, | ||
}); | ||
|
||
EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); | ||
propPane.UpdatePropertyFieldValue("Label", ""); | ||
propPane.TypeTextIntoField("Label", "StoreValue"); | ||
cy.get("@jsObjName").then((jsObj: any) => { | ||
propPane.SelectJSFunctionToExecute( | ||
"onClick", | ||
jsObj as string, | ||
"storeValue", | ||
); | ||
}); | ||
|
||
entityExplorer.DragDropWidgetNVerify("buttonwidget", 200, 200); | ||
EditorNavigation.SelectEntityByName("Button2", EntityType.Widget); | ||
propPane.UpdatePropertyFieldValue("Label", ""); | ||
propPane.TypeTextIntoField("Label", "ClearStore"); | ||
cy.get("@jsObjName").then((jsObj: any) => { | ||
propPane.SelectJSFunctionToExecute( | ||
"onClick", | ||
jsObj as string, | ||
"clearStore", | ||
); | ||
}); | ||
|
||
deployMode.DeployApp(); | ||
agHelper.ClickButton("StoreValue"); | ||
agHelper.AssertContains( | ||
JSON.stringify({ | ||
val1: "value 1", | ||
val2: "value 2", | ||
}), | ||
); | ||
agHelper.ClickButton("ClearStore"); | ||
agHelper.AssertContains(JSON.stringify({})); | ||
|
||
// Verify unrelated local storage data is not cleared | ||
cy.window().then((win) => { | ||
expect(win.localStorage.getItem("unrelatedKey1")).to.equal( | ||
"unrelated value 1", | ||
); | ||
expect(win.localStorage.getItem("unrelatedKey2")).to.equal( | ||
"unrelated value 2", | ||
); | ||
}); | ||
|
||
deployMode.NavigateBacktoEditor(); | ||
EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); | ||
agHelper.GetNClick(propPane._deleteWidget); | ||
EditorNavigation.SelectEntityByName("Button2", EntityType.Widget); | ||
agHelper.GetNClick(propPane._deleteWidget); | ||
}); | ||
|
||
it("4. To verify that clearStore() only affects the current tab's storage and does not inadvertently impact session storage across tabs.", function () { | ||
entityExplorer.DragDropWidgetNVerify("buttonwidget", 100, 100); | ||
const JS_OBJECT_BODY = `export default { | ||
storeValue: async () => { | ||
let values = [ | ||
storeValue('val1', 'value 1'), | ||
storeValue('val2', 'value 2'), | ||
]; | ||
await Promise.all(values); | ||
await showAlert(JSON.stringify(appsmith.store)); | ||
}, | ||
clearStore: async () => { | ||
await clearStore(); | ||
await showAlert(JSON.stringify(appsmith.store)); | ||
} | ||
}`; | ||
|
||
jsEditor.CreateJSObject(JS_OBJECT_BODY, { | ||
paste: true, | ||
completeReplace: true, | ||
toRun: false, | ||
prettify: false, | ||
shouldCreateNewJSObj: true, | ||
}); | ||
|
||
EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); | ||
propPane.UpdatePropertyFieldValue("Label", ""); | ||
propPane.TypeTextIntoField("Label", "StoreValue"); | ||
cy.get("@jsObjName").then((jsObj: any) => { | ||
propPane.SelectJSFunctionToExecute( | ||
"onClick", | ||
jsObj as string, | ||
"storeValue", | ||
); | ||
}); | ||
|
||
entityExplorer.DragDropWidgetNVerify("buttonwidget", 200, 200); | ||
EditorNavigation.SelectEntityByName("Button2", EntityType.Widget); | ||
propPane.UpdatePropertyFieldValue("Label", ""); | ||
propPane.TypeTextIntoField("Label", "ClearStore"); | ||
cy.get("@jsObjName").then((jsObj: any) => { | ||
propPane.SelectJSFunctionToExecute( | ||
"onClick", | ||
jsObj as string, | ||
"clearStore", | ||
); | ||
}); | ||
|
||
deployMode.DeployApp(); | ||
agHelper.ClickButton("StoreValue"); | ||
agHelper.AssertContains( | ||
JSON.stringify({ | ||
val1: "value 1", | ||
val2: "value 2", | ||
}), | ||
); | ||
|
||
// Open a new tab and verify the storage is not affected | ||
cy.window().then((win) => { | ||
const newTab = win.open(win.location.href, "_blank"); | ||
if (newTab) { | ||
cy.wrap(newTab).should(() => { | ||
const isEmpty = Object.keys(newTab.localStorage).length === 0; | ||
expect(isEmpty).to.be.false; | ||
}); | ||
newTab.close(); | ||
} | ||
}); | ||
Comment on lines
+298
to
+307
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Avoid using 'window.open' in Cypress tests Cypress does not support multiple tabs or |
||
|
||
agHelper.ClickButton("ClearStore"); | ||
agHelper.AssertContains(JSON.stringify({})); | ||
|
||
deployMode.NavigateBacktoEditor(); | ||
EditorNavigation.SelectEntityByName("Button1", EntityType.Widget); | ||
agHelper.GetNClick(propPane._deleteWidget); | ||
EditorNavigation.SelectEntityByName("Button2", EntityType.Widget); | ||
agHelper.GetNClick(propPane._deleteWidget); | ||
}); | ||
}, | ||
); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Use API calls for test cleanup instead of UI interactions
Replace widget deletion via UI with API calls for more reliable and faster test execution.