forked from ToolJet/ToolJet
-
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.
Cypress tests if widgets are draggable to canvas (ToolJet#626)
* Cypress tests to test if widgets are draggable 1. Added tests for all widgets to test if user is able to drag and drop them to canvas. 2. Re-organised Integration test folder according to the Pages. * Updated package-lock.json file Updated NPM to 7.20.0 and created this file again. * Last update- package-lock.json 31 Sep- Steps followed: $ rm -rf node_modules/ $ npm cache clean --force (Revert the changes in your package-lock.json file) step 3 -> copy and paste the file from develop branch $ npm i still generating 21552 lines.
- Loading branch information
Mohini Dahiya
authored
Sep 2, 2021
1 parent
274b648
commit 5533527
Showing
26 changed files
with
2,577 additions
and
32 deletions.
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
31 changes: 31 additions & 0 deletions
31
cypress/integration/editor/widgets/editor-widget-button.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,31 @@ | ||
import '@4tw/cypress-drag-drop'; | ||
describe('Editor- Test Button widget', () => { | ||
|
||
beforeEach(() => { | ||
|
||
cy.viewport(1536, 960); | ||
//read login data from fixtures | ||
cy.fixture('login-data').then(function (testdata) { | ||
cy.login(testdata.email, testdata.password) | ||
}) | ||
cy.wait(1000) | ||
cy.get('body').then(($title => { | ||
//check you are not running tests on empty dashboard state | ||
if ($title.text().includes('You haven\'t created any apps yet.')) { | ||
cy.get('a.btn').eq(0).should('have.text', 'Create your first app') | ||
.click() | ||
cy.go('back') | ||
} | ||
cy.wait(2000) | ||
cy.get('.badge').contains('Edit').click() | ||
cy.get('title').should('have.text', 'ToolJet - Dashboard') | ||
})) | ||
}) | ||
|
||
it('should be able to drag and drop button to canvas', () => { | ||
cy.get('input[placeholder="Search…"]').type('button') | ||
|
||
cy.get('.draggable-box') | ||
.drag('.real-canvas',{force: true, position: 'topLeft' }) | ||
}); | ||
}) |
31 changes: 31 additions & 0 deletions
31
cypress/integration/editor/widgets/editor-widget-chart.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,31 @@ | ||
import '@4tw/cypress-drag-drop'; | ||
describe('Editor- Test chart widget', () => { | ||
|
||
beforeEach(() => { | ||
|
||
cy.viewport(1536, 960); | ||
//read login data from fixtures | ||
cy.fixture('login-data').then(function (testdata) { | ||
cy.login(testdata.email, testdata.password) | ||
}) | ||
cy.wait(1000) | ||
cy.get('body').then(($title => { | ||
//check you are not running tests on empty dashboard state | ||
if ($title.text().includes('You haven\'t created any apps yet.')) { | ||
cy.get('a.btn').eq(0).should('have.text', 'Create your first app') | ||
.click() | ||
cy.go('back') | ||
} | ||
cy.wait(2000) | ||
cy.get('.badge').contains('Edit').click() | ||
cy.get('title').should('have.text', 'ToolJet - Dashboard') | ||
})) | ||
}) | ||
|
||
it('should be able to drag and drop chart to canvas', () => { | ||
cy.get('input[placeholder="Search…"]').type('chart') | ||
|
||
cy.get('.draggable-box') | ||
.drag('.real-canvas',{force: true, position: 'topLeft' }) | ||
}); | ||
}) |
40 changes: 40 additions & 0 deletions
40
cypress/integration/editor/widgets/editor-widget-checkbox.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,40 @@ | ||
import '@4tw/cypress-drag-drop'; | ||
describe('Editor- Test checkbox widget', () => { | ||
|
||
beforeEach(() => { | ||
|
||
cy.viewport(1536, 960); | ||
//read login data from fixtures | ||
cy.fixture('login-data').then(function (testdata) { | ||
cy.login(testdata.email, testdata.password) | ||
}) | ||
cy.wait(1000) | ||
cy.get('body').then(($title => { | ||
//check you are not running tests on empty dashboard state | ||
if ($title.text().includes('You haven\'t created any apps yet.')) { | ||
cy.get('a.btn').eq(0).should('have.text', 'Create your first app') | ||
.click() | ||
cy.go('back') | ||
} | ||
cy.wait(2000) | ||
cy.get('.badge').contains('Edit').click() | ||
cy.get('title').should('have.text', 'ToolJet - Dashboard') | ||
})) | ||
}) | ||
|
||
it('should drag and drop checkbox to canvas', () => { | ||
cy.get('input[placeholder="Search…"]').type('checkbox') | ||
|
||
cy.get('.draggable-box') | ||
.drag('.real-canvas',{force: true, position: 'topLeft' }) | ||
}); | ||
|
||
it('should be able to set checkbox value to true', () => { | ||
cy.get('input[placeholder="Search…"]').type('checkbox') | ||
|
||
cy.get('.draggable-box') | ||
.drag('.real-canvas',{force: true, position: 'topLeft' }) | ||
|
||
cy.get('.form-check-label').click() | ||
}); | ||
}) |
31 changes: 31 additions & 0 deletions
31
cypress/integration/editor/widgets/editor-widget-container.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,31 @@ | ||
import '@4tw/cypress-drag-drop'; | ||
describe('Editor- Test Container widget', () => { | ||
|
||
beforeEach(() => { | ||
|
||
cy.viewport(1536, 960); | ||
//read login data from fixtures | ||
cy.fixture('login-data').then(function (testdata) { | ||
cy.login(testdata.email, testdata.password) | ||
}) | ||
cy.wait(1000) | ||
cy.get('body').then(($title => { | ||
//check you are not running tests on empty dashboard state | ||
if ($title.text().includes('You haven\'t created any apps yet.')) { | ||
cy.get('a.btn').eq(0).should('have.text', 'Create your first app') | ||
.click() | ||
cy.go('back') | ||
} | ||
cy.wait(2000) | ||
cy.get('.badge').contains('Edit').click() | ||
cy.get('title').should('have.text', 'ToolJet - Dashboard') | ||
})) | ||
}) | ||
|
||
it('should be able to drag and drop image to canvas', () => { | ||
cy.get('input[placeholder="Search…"]').type('Container') | ||
|
||
cy.get('.draggable-box').eq(0).should('have.text','Container') | ||
.drag('.real-canvas',{force: true, position: 'topLeft' }) | ||
}); | ||
}) |
31 changes: 31 additions & 0 deletions
31
cypress/integration/editor/widgets/editor-widget-date-picker.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,31 @@ | ||
import '@4tw/cypress-drag-drop'; | ||
describe('Editor- Test Button widget', () => { | ||
|
||
beforeEach(() => { | ||
|
||
cy.viewport(1536, 960); | ||
//read login data from fixtures | ||
cy.fixture('login-data').then(function (testdata) { | ||
cy.login(testdata.email, testdata.password) | ||
}) | ||
cy.wait(1000) | ||
cy.get('body').then(($title => { | ||
//check you are not running tests on empty dashboard state | ||
if ($title.text().includes('You haven\'t created any apps yet.')) { | ||
cy.get('a.btn').eq(0).should('have.text', 'Create your first app') | ||
.click() | ||
cy.go('back') | ||
} | ||
cy.wait(2000) | ||
cy.get('.badge').contains('Edit').click() | ||
cy.get('title').should('have.text', 'ToolJet - Dashboard') | ||
})) | ||
}) | ||
|
||
it('should be able to drag and drop data-picker to canvas', () => { | ||
cy.get('input[placeholder="Search…"]').type('date picker') | ||
|
||
cy.get('.draggable-box').eq(0).should('have.text','Date Picker') | ||
.drag('.real-canvas',{force: true, position: 'topLeft' }) | ||
}); | ||
}) |
31 changes: 31 additions & 0 deletions
31
cypress/integration/editor/widgets/editor-widget-dropdown.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,31 @@ | ||
import '@4tw/cypress-drag-drop'; | ||
describe('Editor- Test dropdown widget', () => { | ||
|
||
beforeEach(() => { | ||
|
||
cy.viewport(1536, 960); | ||
//read login data from fixtures | ||
cy.fixture('login-data').then(function (testdata) { | ||
cy.login(testdata.email, testdata.password) | ||
}) | ||
cy.wait(1000) | ||
cy.get('body').then(($title => { | ||
//check you are not running tests on empty dashboard state | ||
if ($title.text().includes('You haven\'t created any apps yet.')) { | ||
cy.get('a.btn').eq(0).should('have.text', 'Create your first app') | ||
.click() | ||
cy.go('back') | ||
} | ||
cy.wait(2000) | ||
cy.get('.badge').contains('Edit').click() | ||
cy.get('title').should('have.text', 'ToolJet - Dashboard') | ||
})) | ||
}) | ||
|
||
it('should be able to drag and drop dropdown to canvas', () => { | ||
cy.get('input[placeholder="Search…"]').type('dropdown') | ||
|
||
cy.get('.draggable-box').eq(0).should('have.text','Dropdown') | ||
.drag('.real-canvas',{force: true, position: 'topLeft' }) | ||
}); | ||
}) |
31 changes: 31 additions & 0 deletions
31
cypress/integration/editor/widgets/editor-widget-image.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,31 @@ | ||
import '@4tw/cypress-drag-drop'; | ||
describe('Editor- Test Image widget', () => { | ||
|
||
beforeEach(() => { | ||
|
||
cy.viewport(1536, 960); | ||
//read login data from fixtures | ||
cy.fixture('login-data').then(function (testdata) { | ||
cy.login(testdata.email, testdata.password) | ||
}) | ||
cy.wait(1000) | ||
cy.get('body').then(($title => { | ||
//check you are not running tests on empty dashboard state | ||
if ($title.text().includes('You haven\'t created any apps yet.')) { | ||
cy.get('a.btn').eq(0).should('have.text', 'Create your first app') | ||
.click() | ||
cy.go('back') | ||
} | ||
cy.wait(2000) | ||
cy.get('.badge').contains('Edit').click() | ||
cy.get('title').should('have.text', 'ToolJet - Dashboard') | ||
})) | ||
}) | ||
|
||
it('should be able to drag and drop image to canvas', () => { | ||
cy.get('input[placeholder="Search…"]').type('image') | ||
|
||
cy.get('.draggable-box').eq(0).should('have.text','Image') | ||
.drag('.real-canvas',{force: true, position: 'topLeft' }) | ||
}); | ||
}) |
31 changes: 31 additions & 0 deletions
31
cypress/integration/editor/widgets/editor-widget-map.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,31 @@ | ||
import '@4tw/cypress-drag-drop'; | ||
describe('Editor- Test map widget', () => { | ||
|
||
beforeEach(() => { | ||
|
||
cy.viewport(1536, 960); | ||
//read login data from fixtures | ||
cy.fixture('login-data').then(function (testdata) { | ||
cy.login(testdata.email, testdata.password) | ||
}) | ||
cy.wait(1000) | ||
cy.get('body').then(($title => { | ||
//check you are not running tests on empty dashboard state | ||
if ($title.text().includes('You haven\'t created any apps yet.')) { | ||
cy.get('a.btn').eq(0).should('have.text', 'Create your first app') | ||
.click() | ||
cy.go('back') | ||
} | ||
cy.wait(2000) | ||
cy.get('.badge').contains('Edit').click() | ||
cy.get('title').should('have.text', 'ToolJet - Dashboard') | ||
})) | ||
}) | ||
|
||
it('should be able to drag and drop map to canvas', () => { | ||
cy.get('input[placeholder="Search…"]').type('map') | ||
|
||
cy.get('.draggable-box').eq(0).should('have.text','Map') | ||
.drag('.real-canvas',{force: true, position: 'topLeft'}) | ||
}); | ||
}) |
31 changes: 31 additions & 0 deletions
31
cypress/integration/editor/widgets/editor-widget-modal.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,31 @@ | ||
import '@4tw/cypress-drag-drop'; | ||
describe('Editor- Test Modal widget', () => { | ||
|
||
beforeEach(() => { | ||
|
||
cy.viewport(1536, 960); | ||
//read login data from fixtures | ||
cy.fixture('login-data').then(function (testdata) { | ||
cy.login(testdata.email, testdata.password) | ||
}) | ||
cy.wait(1000) | ||
cy.get('body').then(($title => { | ||
//check you are not running tests on empty dashboard state | ||
if ($title.text().includes('You haven\'t created any apps yet.')) { | ||
cy.get('a.btn').eq(0).should('have.text', 'Create your first app') | ||
.click() | ||
cy.go('back') | ||
} | ||
cy.wait(2000) | ||
cy.get('.badge').contains('Edit').click() | ||
cy.get('title').should('have.text', 'ToolJet - Dashboard') | ||
})) | ||
}) | ||
|
||
it('should be able to drag and drop Modal to canvas', () => { | ||
cy.get('input[placeholder="Search…"]').type('modal') | ||
|
||
cy.get('.draggable-box') | ||
.drag('.real-canvas',{force: true, position: 'topLeft' }) | ||
}); | ||
}) |
31 changes: 31 additions & 0 deletions
31
cypress/integration/editor/widgets/editor-widget-multiselect.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,31 @@ | ||
import '@4tw/cypress-drag-drop'; | ||
describe('Editor- Test multiselect widget', () => { | ||
|
||
beforeEach(() => { | ||
|
||
cy.viewport(1536, 960); | ||
//read login data from fixtures | ||
cy.fixture('login-data').then(function (testdata) { | ||
cy.login(testdata.email, testdata.password) | ||
}) | ||
cy.wait(1000) | ||
cy.get('body').then(($title => { | ||
//check you are not running tests on empty dashboard state | ||
if ($title.text().includes('You haven\'t created any apps yet.')) { | ||
cy.get('a.btn').eq(0).should('have.text', 'Create your first app') | ||
.click() | ||
cy.go('back') | ||
} | ||
cy.wait(2000) | ||
cy.get('.badge').contains('Edit').click() | ||
cy.get('title').should('have.text', 'ToolJet - Dashboard') | ||
})) | ||
}) | ||
|
||
it('should be able to drag and drop multiselect to canvas', () => { | ||
cy.get('input[placeholder="Search…"]').type('multiselect') | ||
|
||
cy.get('.draggable-box').eq(0).should('have.text','Multiselect') | ||
.drag('.real-canvas',{force: true, position: 'topLeft' }) | ||
}); | ||
}) |
Oops, something went wrong.