forked from appsmithorg/appsmith
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: clearInterval action creator adds argument in the wrong slot (ap…
- Loading branch information
Showing
4 changed files
with
199 additions
and
59 deletions.
There are no files selected for viewing
108 changes: 108 additions & 0 deletions
108
...t/cypress/integration/Smoke_TestSuite/ClientSideTests/ActionExecution/setInterval_spec.js
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 |
---|---|---|
@@ -0,0 +1,108 @@ | ||
const commonlocators = require("../../../../locators/commonlocators.json"); | ||
const dsl = require("../../../../fixtures/buttonApiDsl.json"); | ||
const widgetsPage = require("../../../../locators/Widgets.json"); | ||
const publishPage = require("../../../../locators/publishWidgetspage.json"); | ||
|
||
describe("Test Create Api and Bind to Table widget", function() { | ||
before(() => { | ||
cy.addDsl(dsl); | ||
}); | ||
|
||
it("Test_Add users api and execute api", function() { | ||
cy.createAndFillApi(this.data.userApi, "/users"); | ||
cy.RunAPI(); | ||
}); | ||
|
||
it("selects set interval function", () => { | ||
cy.SearchEntityandOpen("Button1"); | ||
cy.get(widgetsPage.buttonOnClick) | ||
.last() | ||
.click({ force: true }); | ||
cy.get(commonlocators.chooseAction) | ||
.children() | ||
.contains("Set interval") | ||
.click(); | ||
}); | ||
|
||
it("Fill setInterval action creator and test code generated", () => { | ||
cy.get(widgetsPage.toggleOnClick) | ||
.invoke("attr", "class") | ||
.then((classes) => { | ||
if (classes.includes("is-active")) { | ||
cy.get(widgetsPage.toggleOnClick).click(); | ||
} | ||
}); | ||
|
||
cy.get("label") | ||
.contains("Callback function") | ||
.parent() | ||
.then(($el) => { | ||
cy.updateCodeInput($el, "{{() => { Api1.run() }}}"); | ||
}); | ||
|
||
cy.get("label") | ||
.contains("Id") | ||
.parent() | ||
.then(($el) => { | ||
cy.updateCodeInput($el, "myInterval"); | ||
}); | ||
|
||
cy.get(widgetsPage.toggleOnClick).click(); | ||
|
||
cy.get(".t--property-control-onclick") | ||
.find(".CodeMirror-code") | ||
.invoke("text") | ||
.should( | ||
"equal", | ||
"{{setInterval(() => { Api1.run() }, 5000,'myInterval')}}", | ||
); | ||
|
||
cy.get(widgetsPage.toggleOnClick).click(); | ||
}); | ||
|
||
it("works in the published version", () => { | ||
cy.PublishtheApp(); | ||
|
||
cy.get(publishPage.buttonWidget).click(); | ||
|
||
cy.wait("@postExecute").should( | ||
"have.nested.property", | ||
"response.body.responseMeta.status", | ||
200, | ||
); | ||
cy.wait(5000); | ||
cy.wait("@postExecute").should( | ||
"have.nested.property", | ||
"response.body.responseMeta.status", | ||
200, | ||
); | ||
cy.get(publishPage.backToEditor).click({ force: true }); | ||
}); | ||
|
||
it("selects clear interval function", () => { | ||
cy.SearchEntityandOpen("Button1"); | ||
cy.get(widgetsPage.buttonOnClick) | ||
.last() | ||
.click({ force: true }); | ||
cy.get(commonlocators.chooseAction) | ||
.children() | ||
.contains("Clear interval") | ||
.click(); | ||
}); | ||
|
||
it("Fill clearInterval action creator and test code generated", () => { | ||
cy.get("label") | ||
.contains("Id") | ||
.parent() | ||
.then(($el) => { | ||
cy.updateCodeInput($el, "myInterval"); | ||
}); | ||
|
||
cy.get(widgetsPage.toggleOnClick).click(); | ||
|
||
cy.get(".t--property-control-onclick") | ||
.find(".CodeMirror-code") | ||
.invoke("text") | ||
.should("equal", "{{clearInterval('myInterval')}}"); | ||
}); | ||
}); |
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
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
Oops, something went wrong.