mirror of
https://github.com/ToolJet/ToolJet
synced 2026-04-21 13:37:28 +00:00
Updated cypress folder structure (#2909)
* Removed outdated cypress tests * Updated cypress folder structure
This commit is contained in:
parent
010a31304b
commit
794e708e6a
43 changed files with 39 additions and 946 deletions
|
|
@ -1,13 +0,0 @@
|
|||
{
|
||||
"baseUrl": "http://localhost:8082",
|
||||
"execTimeout": 1800000,
|
||||
"defaultCommandTimeout": 30000,
|
||||
"requestTimeout": 10000,
|
||||
"pageLoadTimeout": 20000,
|
||||
"responseTimeout": 10000,
|
||||
"viewportWidth": 1200,
|
||||
"viewportHeight": 960,
|
||||
"testFiles": "**/*.spec.js",
|
||||
"chromeWebSecurity": true
|
||||
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
/// <reference types="cypress" />
|
||||
// ***********************************************************
|
||||
// This example plugins/index.js can be used to load plugins
|
||||
//
|
||||
// You can change the location of this file or turn off loading
|
||||
// the plugins file with the 'pluginsFile' configuration option.
|
||||
//
|
||||
// You can read more here:
|
||||
// https://on.cypress.io/plugins-guide
|
||||
// ***********************************************************
|
||||
|
||||
// This function is called when a project is opened or re-opened (e.g. due to
|
||||
// the project's config changing)
|
||||
|
||||
/**
|
||||
* @type {Cypress.PluginConfig}
|
||||
*/
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
module.exports = (on, config) => {
|
||||
// `on` is used to hook into various events Cypress emits
|
||||
// `config` is the resolved Cypress config
|
||||
}
|
||||
const webpack = require("@cypress/webpack-preprocessor");
|
||||
module.exports = (on) => {
|
||||
const options = {
|
||||
webpackOptions: require("../webpack.config"),
|
||||
watchOptions: {}
|
||||
};
|
||||
on("file:preprocessor", webpack(options));
|
||||
};
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
import { loginSelectors} from "Selectors/login";
|
||||
|
||||
Cypress.Commands.add("login",(email,password)=>{
|
||||
cy.visit("/");
|
||||
cy.clearAndType(loginSelectors.emailField, email);
|
||||
cy.clearAndType(loginSelectors.passwordField, password);
|
||||
cy.get(loginSelectors.signInButton).click();
|
||||
cy.get(loginSelectors.homePage).should("be.visible");
|
||||
})
|
||||
|
||||
Cypress.Commands.add("clearAndType", (selector, text) => {
|
||||
cy.get(selector).clear().type(text);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("verifyToastMessage", (selector,message) => {
|
||||
cy.get(selector)
|
||||
.should("be.visible")
|
||||
.should("have.text", message);
|
||||
})
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
// ***********************************************************
|
||||
// This example support/index.js is processed and
|
||||
// loaded automatically before your test files.
|
||||
//
|
||||
// This is a great place to put global configuration and
|
||||
// behavior that modifies Cypress.
|
||||
//
|
||||
// You can change the location of this file or turn off
|
||||
// automatically serving support files with the
|
||||
// 'supportFile' configuration option.
|
||||
//
|
||||
// You can read more here:
|
||||
// https://on.cypress.io/configuration
|
||||
// ***********************************************************
|
||||
|
||||
// Import commands.js using ES2015 syntax:
|
||||
import './commands'
|
||||
|
||||
// Alternatively you can use CommonJS syntax:
|
||||
// require('./commands')
|
||||
42
cypress.json
42
cypress.json
|
|
@ -1,33 +1,13 @@
|
|||
{
|
||||
"baseUrl": "http://localhost:8082",
|
||||
"env": {
|
||||
"apiUrl": "http://localhost:3000"
|
||||
},
|
||||
"viewportWidth": 1536,
|
||||
"viewportHeight": 960,
|
||||
"testFiles": [
|
||||
"auth.spec.js",
|
||||
"dashboard/empty-state-dashboard.spec.js",
|
||||
"dashobard/dashboard.spec.js",
|
||||
"dashboard/apps-page-operations.spec.js",
|
||||
"editor/editor-navigation-bar.spec.js",
|
||||
"editor/editor-datasource-postgres.spec.js",
|
||||
"editor/widgets/editor-widget-checkbox.spec.js",
|
||||
"editor/widgets/editor-widget-table.spec.js",
|
||||
"editor/widgets/editor-widget-button.spec.js",
|
||||
"editor/widgets/editor-widget-chart.spec.js",
|
||||
"editor/widgets/editor-widget-modal.spec.js",
|
||||
"editor/widgets/editor-widget-text-input.spec.js",
|
||||
"editor/widgets/editor-widget-date-picker.spec.js",
|
||||
"editor/widgets/editor-widget-toggle-switch.spec.js",
|
||||
"editor/widgets/editor-widget-text-area.spec.js",
|
||||
"editor/widgets/editor-widget-text.spec.js",
|
||||
"editor/widgets/editor-widget-text-editor.spec.js",
|
||||
"editor/widgets/editor-widget-image.spec.js",
|
||||
"editor/widgets/editor-widget-container.spec.js",
|
||||
"editor/widgets/editor-widget-dropdown.spec.js",
|
||||
"editor/widgets/editor-widget-multiselect.spec.js",
|
||||
"editor/widgets/editor-widget-map.spec.js",
|
||||
"editor/widgets/editor-widget-qr-scanner.spec.js"
|
||||
]
|
||||
"baseUrl": "http://localhost:8082",
|
||||
"execTimeout": 1800000,
|
||||
"defaultCommandTimeout": 30000,
|
||||
"requestTimeout": 10000,
|
||||
"pageLoadTimeout": 20000,
|
||||
"responseTimeout": 10000,
|
||||
"viewportWidth": 1200,
|
||||
"viewportHeight": 960,
|
||||
"testFiles": "**/*.spec.js",
|
||||
"chromeWebSecurity": true
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
{
|
||||
"email": "dev@tooljet.io",
|
||||
"password": "password"
|
||||
}
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
describe('User login', () => {
|
||||
it('should take user to login page', () => {
|
||||
cy.visit('/login');
|
||||
cy.get('.card-title').should('have.text', 'Login to your account');
|
||||
});
|
||||
|
||||
it('should redirect unauthenticated user to login page', () => {
|
||||
cy.visit('/');
|
||||
cy.location('pathname').should('equal', '/login');
|
||||
});
|
||||
|
||||
it('should display invalid email or password error', () => {
|
||||
cy.login('fake_email', 'abcdefg');
|
||||
cy.checkToastMessage('toast-login-auth-error', 'Invalid email or password');
|
||||
});
|
||||
|
||||
it('should take user to the forgot password page', () => {
|
||||
cy.visit('/forgot-password');
|
||||
cy.get('.card-title').should('have.text', 'Forgot Password');
|
||||
});
|
||||
|
||||
it('should take user to the signup page', () => {
|
||||
cy.visit('/signup');
|
||||
cy.get('.card-title').should('have.text', 'Create a ToolJet account');
|
||||
});
|
||||
|
||||
it('should sign in the user', () => {
|
||||
cy.visit('/login');
|
||||
cy.login('dev@tooljet.io', 'password');
|
||||
cy.location('pathname').should('equal', '/');
|
||||
cy.get('.page-title').should('have.text', 'All applications');
|
||||
});
|
||||
|
||||
it('should display error if email is not found for "Forgot password"', () => {
|
||||
cy.visit('/forgot-password');
|
||||
cy.get('[data-testid="emailField"]').type('abc@def.com');
|
||||
cy.get('[data-testid="submitButton"').click();
|
||||
cy.checkToastMessage(
|
||||
'toast-forgot-password-email-error',
|
||||
'Email address is not associated with a ToolJet cloud account.'
|
||||
);
|
||||
});
|
||||
|
||||
it('should send reset password confirmation code to email', () => {
|
||||
cy.intercept('POST', '/password/forgot').as('forgotPasswordConfirmationCode');
|
||||
|
||||
cy.visit('/forgot-password');
|
||||
cy.get('[data-testid="emailField"]').type('dev@tooljet.io');
|
||||
cy.get('[data-testid="submitButton"').click();
|
||||
|
||||
cy.wait('@forgotPasswordConfirmationCode').its('response.statusCode').should('eq', 200);
|
||||
cy.checkToastMessage(
|
||||
'toast-forgot-password-confirmation-code',
|
||||
"We've sent the confirmation code to your email address"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
describe('Dashboard operations on Apps', () => {
|
||||
const currentDate = new Date();
|
||||
const folderName = 'folder ' + currentDate.toJSON();
|
||||
|
||||
beforeEach(() => {
|
||||
//read data from fixtures
|
||||
cy.fixture('login-data').then(function (testdata) {
|
||||
cy.login(testdata.email, testdata.password);
|
||||
});
|
||||
cy.wait(1000);
|
||||
cy.createAppIfEmptyDashboard();
|
||||
});
|
||||
|
||||
it('should open app in app builder using Edit button', () => {
|
||||
cy.wait(2000);
|
||||
cy.get('.badge').contains('Edit').click();
|
||||
cy.get('title').should('have.text', 'ToolJet - Dashboard');
|
||||
});
|
||||
|
||||
it('should show Tooltip "App does not have a deployed version" on Launch button', () => {
|
||||
cy.get('tbody a:nth-child(2)').find('span[class="badge bg-light-grey mx-2"]')
|
||||
.trigger('mouseover')
|
||||
.should('have.attr', 'aria-describedby', 'button-tooltip')
|
||||
cy.get('div[id="button-tooltip"]').should('have.text', 'App does not have a deployed version')
|
||||
});
|
||||
|
||||
it('should launch app and show Tooltip -"Open in app viewer", when App is deployed with a single version', () => {
|
||||
//Create and save App with version 1.0
|
||||
cy.get('.badge').contains('Edit').click();
|
||||
cy.deployAppWithSingleVersion();
|
||||
|
||||
//Go back to dashboard
|
||||
cy.go('back');
|
||||
|
||||
//Check Tooltip text
|
||||
cy.get('tbody a:nth-child(2)').find('span[class="badge bg-light-grey mx-2"]')
|
||||
.trigger('mouseover')
|
||||
.should('have.attr', 'aria-describedby', 'button-tooltip')
|
||||
cy.get('div[id="button-tooltip"]').should('have.text', 'Open in app viewer');
|
||||
|
||||
//Click to launch app
|
||||
cy.get('tbody a:nth-child(2)').find('span[class="badge bg-light-grey mx-2"]').click();
|
||||
});
|
||||
|
||||
it('should be able to add app to a folder', () => {
|
||||
//Pre-requisite: Create folder
|
||||
cy.get('a[class="mx-3"]').contains('+ Folder').click();
|
||||
cy.get('input[placeholder="folder name"]').should('have.attr', 'placeholder', 'folder name').type(folderName);
|
||||
cy.get('.btn').contains('Save').click();
|
||||
|
||||
//Steps to select the folder name and add app to folder.
|
||||
cy.get('span[role="button"]').click();
|
||||
cy.get('span[role="button"]').contains('Add to folder ').click();
|
||||
cy.get('input[placeholder="Select folder"]').type(folderName);
|
||||
cy.get('[data-index="0"] > .select-search__option').click();
|
||||
});
|
||||
|
||||
it('should be able to delete app', () => {
|
||||
cy.get('td img.svg-icon').eq(0).click();
|
||||
cy.get('[role="button"]').contains('Delete app').click();
|
||||
cy.get('.modal-body').should(
|
||||
'have.text',
|
||||
'The app and the associated data will be permanently deleted, do you want to continue?'
|
||||
);
|
||||
cy.get('.btn').contains('Yes').click();
|
||||
cy.get('.Toastify__toast-body').should('have.text', 'App deleted successfully.')
|
||||
});
|
||||
});
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
describe('Dashboard', () => {
|
||||
beforeEach(() => {
|
||||
//read data from fixtures
|
||||
cy.fixture('login-data').then(function (testdata) {
|
||||
cy.login(testdata.email, testdata.password);
|
||||
});
|
||||
|
||||
cy.wait(1000);
|
||||
cy.createAppIfEmptyDashboard();
|
||||
});
|
||||
|
||||
it('should show site header with nav items', () => {
|
||||
cy.get('.navbar').find('.navbar-nav').should('be.visible');
|
||||
});
|
||||
|
||||
it('should navigate to users page using users tab', () => {
|
||||
cy.get('.navbar').find('.navbar-nav').find('li').not('.active').click();
|
||||
cy.location('pathname').should('equal', '/users');
|
||||
cy.get('.page-title').should('have.text', 'Users & Permissions');
|
||||
cy.get('[data-testid="usersTable"]').should('be.visible');
|
||||
});
|
||||
|
||||
it('should navigate to apps page using apps tab', () => {
|
||||
cy.get('.navbar').find('.navbar-nav').find('li.active').click();
|
||||
cy.location('pathname').should('equal', '/');
|
||||
cy.get('.page-title').should('have.text', 'All applications');
|
||||
cy.get('[data-testid="appsTable"]').should('be.visible');
|
||||
});
|
||||
|
||||
it('should show user avatar and logout the user when user clicks logout', () => {
|
||||
cy.get('[data-testid="userAvatarHeader"]').should('be.visible');
|
||||
// TODO - Add functionality to detect when user hovers over the avatar,
|
||||
// Issues with hover functionality and hide/show of dom elements
|
||||
});
|
||||
|
||||
it('should show list of application folders', () => {
|
||||
cy.get('[data-testid="applicationFoldersList"]').should('be.visible');
|
||||
});
|
||||
|
||||
it('should show correct number of applications in the count bubble of "All Applications" list', () => {
|
||||
cy.get('[data-testid="allApplicationsCount"]').then(($countBubble) => {
|
||||
cy.get('[data-testid="appsTable"]')
|
||||
.wait(500)
|
||||
.find('tr')
|
||||
.then((row) => {
|
||||
expect(Number($countBubble.text())).to.equal(row.length);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
describe('Empty state of dashboard', () => {
|
||||
beforeEach(() => {
|
||||
//read data from fixtures
|
||||
cy.fixture('login-data').then(function (testdata) {
|
||||
cy.login(testdata.email, testdata.password);
|
||||
});
|
||||
});
|
||||
|
||||
it('should show empty screen when there are no apps', () => {
|
||||
cy.wait(1000);
|
||||
cy.get('body').then(($title) => {
|
||||
//if user has not created any app yet
|
||||
if ($title.text().includes("You haven't created any apps yet.")) {
|
||||
//image for empty state should be visible
|
||||
cy.get('.empty-img').should('be.visible');
|
||||
|
||||
//empty title should be visible
|
||||
cy.log('Testing empty state dashboard view.');
|
||||
cy.get('.empty-title').should('be.visible').and('have.text', "You haven't created any apps yet.");
|
||||
|
||||
//Read Documentation button should be present and working
|
||||
cy.get('a.btn')
|
||||
.eq(1)
|
||||
.should('have.attr', 'href', 'https://docs.tooljet.io')
|
||||
.and('have.text', 'Read documentation');
|
||||
|
||||
//test Create your first app button should be visible and working
|
||||
cy.get('a.btn').eq(0).should('be.visible').and('have.text', 'Create your first app').click();
|
||||
cy.get('title').should('have.text', 'ToolJet - Dashboard');
|
||||
} else {
|
||||
cy.log('User has already created few apps hence this test will be skipped.');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
describe('Editor- Add "PostgreSQL" datasource', () => {
|
||||
beforeEach(() => {
|
||||
//read login data from fixtures
|
||||
cy.fixture('login-data').then(function (testdata) {
|
||||
cy.login(testdata.email, testdata.password);
|
||||
});
|
||||
cy.wait(1000);
|
||||
cy.createAppIfEmptyDashboard();
|
||||
cy.wait(2000);
|
||||
cy.get('.badge').contains('Edit').click();
|
||||
cy.get('title').should('have.text', 'ToolJet - Dashboard');
|
||||
});
|
||||
|
||||
it.only('should add First data source successfully', () => {
|
||||
//test database icon
|
||||
cy.get('.left-sidebar')
|
||||
.find('.svg-icon[src="/assets/images/icons/editor/left-sidebar/database.svg"]')
|
||||
.should('be.visible')
|
||||
.click()
|
||||
|
||||
cy.get('.table-responsive')
|
||||
.find('.p-2')
|
||||
.should('have.text', "You haven't added any datasources yet. ")
|
||||
|
||||
cy.get('div[class="table-responsive"] button[class="btn btn-sm btn-outline-azure mt-3"]')
|
||||
.should('have.text', 'Add datasource')
|
||||
.click();
|
||||
|
||||
//create database
|
||||
cy.addPostgresDataSource();
|
||||
|
||||
//verify if you can see postgres database in the list now.
|
||||
cy.get('.left-sidebar')
|
||||
.find('.svg-icon[src="/assets/images/icons/editor/left-sidebar/database.svg"]')
|
||||
.should('be.visible')
|
||||
.click()
|
||||
|
||||
cy.get('.table-responsive')
|
||||
.find('tr td')
|
||||
.contains('PostgreSQL')
|
||||
});
|
||||
});
|
||||
|
|
@ -1,117 +0,0 @@
|
|||
describe('Editor - Navigation Bar', () => {
|
||||
beforeEach(() => {
|
||||
//read data from fixtures
|
||||
cy.fixture('login-data').then(function (testdata) {
|
||||
cy.login(testdata.email, testdata.password);
|
||||
});
|
||||
cy.wait(1000);
|
||||
cy.createAppIfEmptyDashboard();
|
||||
cy.wait(2000);
|
||||
cy.get('.badge').contains('Edit').click();
|
||||
cy.get('title').should('have.text', 'ToolJet - Dashboard');
|
||||
});
|
||||
|
||||
it('should show site header with nav items', () => {
|
||||
cy.get('.navbar').find('.navbar-nav').should('be.visible');
|
||||
});
|
||||
|
||||
it('should show tooljet brand image and clicking on it should take user to dashboard', () => {
|
||||
cy.get('.navbar')
|
||||
.find('.navbar-brand-image')
|
||||
.should('be.visible')
|
||||
.click()
|
||||
.get('title')
|
||||
.should('have.text', 'ToolJet - Dashboard');
|
||||
});
|
||||
|
||||
it('should hide query editor', () => {
|
||||
//check query pane is visible
|
||||
cy.get('.query-pane').should('be.visible');
|
||||
|
||||
//click on Hide query editor button
|
||||
cy.get('.editor-buttons')
|
||||
.find('[data-tip="Hide query editor"] img')
|
||||
.click()
|
||||
.get('[data-tip="Show query editor"] img');
|
||||
|
||||
//check the query editor pane should not be visible
|
||||
cy.get('.query-pane').find('.row.main-row').should('not.be.visible');
|
||||
});
|
||||
|
||||
it('should resize canvas', () => {
|
||||
//default size should be 100%
|
||||
cy.get('.sidebar-zoom').should('have.text', '100 %');
|
||||
|
||||
cy.get('.sidebar-zoom').click();
|
||||
|
||||
//check minimize button
|
||||
var scale;
|
||||
var styleString = 'transform: scale(1);';
|
||||
for (var i = 100; i >= 60; i = i - 10) {
|
||||
cy.get('.sidebar-zoom').click();
|
||||
cy.get('div[class="card popover zoom-popover show"]')
|
||||
.find('tbody tr')
|
||||
.contains(i + '%')
|
||||
.click();
|
||||
scale = i / 100;
|
||||
styleString = 'transform: scale(' + scale + ');';
|
||||
cy.get('.canvas-container.align-items-center').should('have.attr', 'style', styleString);
|
||||
}
|
||||
});
|
||||
|
||||
it('should switch from desktop layout to mobile view ', () => {
|
||||
//check canvas default(desktop view) dimensions
|
||||
cy.get('.real-canvas').should('have.css', 'width').and('eq', '1292px');
|
||||
|
||||
cy.get('.real-canvas').should('have.css', 'height').and('eq', '2400px');
|
||||
|
||||
//check default layout(Desktop view) button. it should be disabled
|
||||
cy.get('.layout-buttons').find('button:nth-child(1)').should('be.disabled');
|
||||
|
||||
//mobile button should be enabled.
|
||||
cy.get('.layout-buttons').find('button:nth-child(2)').should('be.enabled').click();
|
||||
|
||||
//clicking on layout button should change view to mobile canvas. check canvas dimensions
|
||||
cy.get('.real-canvas').should('have.css', 'width').and('eq', '450px');
|
||||
|
||||
cy.get('.real-canvas').should('have.css', 'height').and('eq', '2400px');
|
||||
});
|
||||
|
||||
it('should switch to dark theme', () => {
|
||||
cy.get('.main-wrapper');
|
||||
cy.get('div:nth-child(3) > svg:nth-child(1)').should('have.attr', 'color', '#808080').click();
|
||||
cy.get('div:nth-child(3) > svg:nth-child(1)').should('have.attr', 'color', '#fff').click();
|
||||
});
|
||||
|
||||
it('should be able to share app', () => {
|
||||
//check share button
|
||||
cy.get('.navbar')
|
||||
.find('.navbar-nav')
|
||||
.find('.nav-item')
|
||||
.find('button[class="btn btn-sm"]')
|
||||
.should('have.text', 'Share')
|
||||
.and('be.visible')
|
||||
.click();
|
||||
|
||||
//check clicking on share should open sharing dialog
|
||||
cy.get('.modal-content').find('.modal-header').find('.modal-title').should('have.text', 'Share');
|
||||
|
||||
cy.get('.form-label').should('have.text', 'Get shareable link for this application');
|
||||
|
||||
cy.get('.input-group').find('.btn.btn-secondary.btn-sm').should('have.text', 'Copy').click(); //check how to validate clipboard content
|
||||
});
|
||||
|
||||
it('should deploy app', () => {
|
||||
cy.deployAppWithSingleVersion();
|
||||
});
|
||||
|
||||
it('should launch app', () => {
|
||||
cy.get('.navbar-nav.flex-row.order-md-last')
|
||||
.find('a[target="_blank"]')
|
||||
.should('have.text', 'Launch')
|
||||
.invoke('removeAttr', 'target')
|
||||
.click();
|
||||
|
||||
cy.url().should('include', '/applications');
|
||||
});
|
||||
});
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
describe('Editor- Test Button widget', () => {
|
||||
beforeEach(() => {
|
||||
//read login data from fixtures
|
||||
cy.fixture('login-data').then(function (testdata) {
|
||||
cy.login(testdata.email, testdata.password);
|
||||
});
|
||||
cy.wait(1000);
|
||||
cy.createAppIfEmptyDashboard();
|
||||
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').contains('Button').drag('.real-canvas', { force: true, position: 'topLeft' });
|
||||
});
|
||||
});
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
describe('Editor- Test chart widget', () => {
|
||||
beforeEach(() => {
|
||||
//read login data from fixtures
|
||||
cy.fixture('login-data').then(function (testdata) {
|
||||
cy.login(testdata.email, testdata.password);
|
||||
});
|
||||
cy.wait(1000);
|
||||
cy.createAppIfEmptyDashboard();
|
||||
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').contains('Chart').drag('.real-canvas', { force: true, position: 'topLeft' });
|
||||
});
|
||||
});
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
describe('Editor- Test checkbox widget', () => {
|
||||
beforeEach(() => {
|
||||
//read login data from fixtures
|
||||
cy.fixture('login-data').then(function (testdata) {
|
||||
cy.login(testdata.email, testdata.password);
|
||||
});
|
||||
cy.wait(1000);
|
||||
cy.createAppIfEmptyDashboard();
|
||||
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();
|
||||
});
|
||||
});
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
describe('Editor- Test Container widget', () => {
|
||||
beforeEach(() => {
|
||||
//read login data from fixtures
|
||||
cy.fixture('login-data').then(function (testdata) {
|
||||
cy.login(testdata.email, testdata.password);
|
||||
});
|
||||
cy.wait(1000);
|
||||
cy.createAppIfEmptyDashboard();
|
||||
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').contains('Container').drag('.real-canvas', { force: true, position: 'topLeft' });
|
||||
});
|
||||
});
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
describe('Editor- Test Button widget', () => {
|
||||
beforeEach(() => {
|
||||
//read login data from fixtures
|
||||
cy.fixture('login-data').then(function (testdata) {
|
||||
cy.login(testdata.email, testdata.password);
|
||||
});
|
||||
cy.wait(1000);
|
||||
cy.createAppIfEmptyDashboard();
|
||||
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').contains('Date Picker').drag('.real-canvas', { force: true, position: 'topLeft' });
|
||||
});
|
||||
});
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
describe('Editor- Test dropdown widget', () => {
|
||||
beforeEach(() => {
|
||||
//read login data from fixtures
|
||||
cy.fixture('login-data').then(function (testdata) {
|
||||
cy.login(testdata.email, testdata.password);
|
||||
});
|
||||
cy.wait(1000);
|
||||
cy.createAppIfEmptyDashboard();
|
||||
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').contains('Dropdown').drag('.real-canvas', { force: true, position: 'topLeft' });
|
||||
});
|
||||
});
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
describe('Editor- Test Image widget', () => {
|
||||
beforeEach(() => {
|
||||
//read login data from fixtures
|
||||
cy.fixture('login-data').then(function (testdata) {
|
||||
cy.login(testdata.email, testdata.password);
|
||||
});
|
||||
cy.wait(1000);
|
||||
cy.createAppIfEmptyDashboard();
|
||||
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').contains('Image').drag('.real-canvas', { force: true, position: 'topLeft' });
|
||||
});
|
||||
});
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
describe('Editor- Test map widget', () => {
|
||||
beforeEach(() => {
|
||||
//read login data from fixtures
|
||||
cy.fixture('login-data').then(function (testdata) {
|
||||
cy.login(testdata.email, testdata.password);
|
||||
});
|
||||
cy.wait(1000);
|
||||
cy.createAppIfEmptyDashboard();
|
||||
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').contains('Map').drag('.real-canvas', { force: true, position: 'topLeft' });
|
||||
});
|
||||
});
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
describe('Editor- Test Modal widget', () => {
|
||||
beforeEach(() => {
|
||||
//read login data from fixtures
|
||||
cy.fixture('login-data').then(function (testdata) {
|
||||
cy.login(testdata.email, testdata.password);
|
||||
});
|
||||
cy.wait(1000);
|
||||
cy.createAppIfEmptyDashboard();
|
||||
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').contains('Modal').drag('.real-canvas', { force: true, position: 'topLeft' });
|
||||
});
|
||||
});
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
describe('Editor- Test multiselect widget', () => {
|
||||
beforeEach(() => {
|
||||
//read login data from fixtures
|
||||
cy.fixture('login-data').then(function (testdata) {
|
||||
cy.login(testdata.email, testdata.password);
|
||||
});
|
||||
cy.wait(1000);
|
||||
cy.createAppIfEmptyDashboard();
|
||||
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').contains('Multiselect').drag('.real-canvas', { force: true, position: 'topLeft' });
|
||||
});
|
||||
});
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
describe('Editor- Test QR scanner widget', () => {
|
||||
beforeEach(() => {
|
||||
//read login data from fixtures
|
||||
cy.fixture('login-data').then(function (testdata) {
|
||||
cy.login(testdata.email, testdata.password);
|
||||
});
|
||||
cy.wait(1000);
|
||||
cy.createAppIfEmptyDashboard();
|
||||
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 QR Scanner to canvas', () => {
|
||||
cy.get('input[placeholder="Search…"]').type('QR');
|
||||
|
||||
cy.get('.draggable-box').contains('QR Scanner').drag('.real-canvas', { force: true, position: 'topLeft' });
|
||||
});
|
||||
});
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
describe('Editor- Test radio button widget', () => {
|
||||
beforeEach(() => {
|
||||
//read login data from fixtures
|
||||
cy.fixture('login-data').then(function (testdata) {
|
||||
cy.login(testdata.email, testdata.password);
|
||||
});
|
||||
cy.wait(1000);
|
||||
cy.createAppIfEmptyDashboard();
|
||||
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('radio');
|
||||
|
||||
cy.get('.draggable-box').contains('Radio button').drag('.real-canvas', { force: true, position: 'topLeft' });
|
||||
});
|
||||
});
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
describe('Editor- Test Table widget', () => {
|
||||
beforeEach(() => {
|
||||
//read login data from fixtures
|
||||
cy.fixture('login-data').then(function (testdata) {
|
||||
cy.login(testdata.email, testdata.password);
|
||||
});
|
||||
cy.wait(1000);
|
||||
cy.createAppIfEmptyDashboard();
|
||||
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 table to canvas', () => {
|
||||
cy.get('input[placeholder="Search…"]').type('table');
|
||||
|
||||
cy.get('.draggable-box').contains('Table').drag('.real-canvas', { force: true, position: 'topLeft' });
|
||||
});
|
||||
});
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
describe('Editor- Test text area widget', () => {
|
||||
beforeEach(() => {
|
||||
//read login data from fixtures
|
||||
cy.fixture('login-data').then(function (testdata) {
|
||||
cy.login(testdata.email, testdata.password);
|
||||
});
|
||||
cy.wait(1000);
|
||||
cy.createAppIfEmptyDashboard();
|
||||
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 text-area to canvas', () => {
|
||||
cy.get('input[placeholder="Search…"]').type('textarea');
|
||||
|
||||
cy.get('.draggable-box').contains('Textarea').drag('.real-canvas', { force: true, position: 'topLeft' });
|
||||
});
|
||||
});
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
describe('Editor- Test text editor widget', () => {
|
||||
beforeEach(() => {
|
||||
//read login data from fixtures
|
||||
cy.fixture('login-data').then(function (testdata) {
|
||||
cy.login(testdata.email, testdata.password);
|
||||
});
|
||||
cy.wait(1000);
|
||||
cy.createAppIfEmptyDashboard();
|
||||
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 text-editor to canvas', () => {
|
||||
cy.get('input[placeholder="Search…"]').type('text editor');
|
||||
|
||||
cy.get('.draggable-box').contains('Text Editor').drag('.real-canvas', { force: true, position: 'topLeft' });
|
||||
});
|
||||
});
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
describe('Editor- Test text-input widget', () => {
|
||||
beforeEach(() => {
|
||||
//read login data from fixtures
|
||||
cy.fixture('login-data').then(function (testdata) {
|
||||
cy.login(testdata.email, testdata.password);
|
||||
});
|
||||
cy.wait(1000);
|
||||
cy.createAppIfEmptyDashboard();
|
||||
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 text-input to canvas', () => {
|
||||
cy.get('input[placeholder="Search…"]').type('text input');
|
||||
|
||||
cy.get('.draggable-box').contains('Text Input').drag('.real-canvas', { force: true, position: 'topLeft' });
|
||||
});
|
||||
});
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
describe('Editor- Test text widget', () => {
|
||||
beforeEach(() => {
|
||||
//read login data from fixtures
|
||||
cy.fixture('login-data').then(function (testdata) {
|
||||
cy.login(testdata.email, testdata.password);
|
||||
});
|
||||
cy.wait(1000);
|
||||
cy.createAppIfEmptyDashboard();
|
||||
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 text to canvas', () => {
|
||||
cy.get('input[placeholder="Search…"]').type('text');
|
||||
|
||||
cy.get('.draggable-box').contains('Text').drag('.real-canvas', { force: true, position: 'topLeft' });
|
||||
});
|
||||
});
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
describe('Editor- Toggle switch widget', () => {
|
||||
beforeEach(() => {
|
||||
//read login data from fixtures
|
||||
cy.fixture('login-data').then(function (testdata) {
|
||||
cy.login(testdata.email, testdata.password);
|
||||
});
|
||||
cy.wait(1000);
|
||||
cy.createAppIfEmptyDashboard();
|
||||
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('toggle');
|
||||
|
||||
cy.get('.draggable-box').contains('Toggle Switch').drag('.real-canvas', { force: true, position: 'topLeft' });
|
||||
});
|
||||
});
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
/// <reference types="cypress" />
|
||||
// ***********************************************************
|
||||
// This example plugins/index.js can be used to load plugins
|
||||
//
|
||||
|
|
@ -14,12 +15,16 @@
|
|||
/**
|
||||
* @type {Cypress.PluginConfig}
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
|
||||
module.exports = (on, config) => {
|
||||
// modify env value
|
||||
config.env = process.env;
|
||||
// return config
|
||||
return config;
|
||||
// `on` is used to hook into various events Cypress emits
|
||||
// `config` is the resolved Cypress config
|
||||
}
|
||||
const webpack = require("@cypress/webpack-preprocessor");
|
||||
module.exports = (on) => {
|
||||
const options = {
|
||||
webpackOptions: require("../webpack.config"),
|
||||
watchOptions: {}
|
||||
};
|
||||
on("file:preprocessor", webpack(options));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,100 +1,19 @@
|
|||
Cypress.Commands.add('login', (email, password) => {
|
||||
cy.visit('/login');
|
||||
cy.get('[data-testid="emailField"]').type(email);
|
||||
cy.get('[data-testid="passwordField"]').type(password);
|
||||
cy.get('[data-testid="loginButton"').click();
|
||||
import { loginSelectors} from "Selectors/login";
|
||||
|
||||
Cypress.Commands.add("login",(email,password)=>{
|
||||
cy.visit("/");
|
||||
cy.clearAndType(loginSelectors.emailField, email);
|
||||
cy.clearAndType(loginSelectors.passwordField, password);
|
||||
cy.get(loginSelectors.signInButton).click();
|
||||
cy.get(loginSelectors.homePage).should("be.visible");
|
||||
})
|
||||
|
||||
Cypress.Commands.add("clearAndType", (selector, text) => {
|
||||
cy.get(selector).clear().type(text);
|
||||
});
|
||||
|
||||
|
||||
Cypress.Commands.add('checkToastMessage', (toastId, message) => {
|
||||
cy.get(`[id=${toastId}]`).should('contain', message);
|
||||
});
|
||||
|
||||
Cypress.Commands.add('addPostgresDataSource', fn => {
|
||||
|
||||
cy.get('div[class="modal-title h4"] span[class="text-muted"]')
|
||||
.should('have.text', 'Add new datasource')
|
||||
.and('be.visible')
|
||||
|
||||
cy.get('.modal-body')
|
||||
.find('div[class="row row-deck"]')
|
||||
.find('h4[class="text-muted mb-2"]')
|
||||
.should('have.text', 'DATABASES')
|
||||
|
||||
cy.get('.modal-body')
|
||||
.find('.col-md-2')
|
||||
.contains('PostgreSQL')
|
||||
.and('be.visible')
|
||||
.click()
|
||||
|
||||
cy.get('.row.mt-3')
|
||||
.find('.col-md-4')
|
||||
.find('.form-label')
|
||||
.contains('Database Name')
|
||||
|
||||
cy.get('div[class="row mt-3"] div:nth-child(1)')
|
||||
.find('.form-control')
|
||||
.should('have.attr', 'type', 'text')
|
||||
.type(Cypress.env('TEST_PG_DB'))
|
||||
|
||||
cy.get('.row.mt-3')
|
||||
.find('.col-md-4')
|
||||
.find('.form-label')
|
||||
.contains('Username')
|
||||
|
||||
cy.get('div[class="row mt-3"] div:nth-child(2)')
|
||||
.find('.form-control')
|
||||
.should('have.attr', 'type', 'text')
|
||||
.type(Cypress.env('TEST_PG_USERNAME'))
|
||||
|
||||
cy.get('.row.mt-3')
|
||||
.find('.col-md-4')
|
||||
.find('.form-label')
|
||||
.contains('Password')
|
||||
|
||||
cy.get('div[class="row mt-3"] div:nth-child(3)')
|
||||
.find('.form-control')
|
||||
.should('have.attr', 'type', 'password')
|
||||
.type(Cypress.env('TEST_PG_PASSWORD'))
|
||||
|
||||
cy.get('input[type="checkbox"]')
|
||||
.uncheck()
|
||||
|
||||
cy.get('button[class="m-2 btn btn-success"]')
|
||||
.should('have.text', 'Test Connection')
|
||||
.click()
|
||||
|
||||
cy.get('.badge')
|
||||
.should('have.text', 'connection verified')
|
||||
|
||||
cy.get('div[class="col-auto"] button[type="button"]')
|
||||
.should('have.text', 'Save')
|
||||
.click()
|
||||
});
|
||||
Cypress.Commands.add('createAppIfEmptyDashboard', fn => {
|
||||
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')
|
||||
}
|
||||
}))
|
||||
});
|
||||
|
||||
Cypress.Commands.add('deployAppWithSingleVersion', fn => {
|
||||
cy.get('.navbar')
|
||||
.find('.navbar-nav')
|
||||
.find('.nav-item')
|
||||
.find('button[class="btn btn-primary btn-sm"]')
|
||||
.should('have.text', 'Deploy')
|
||||
.and('be.visible')
|
||||
.click();
|
||||
|
||||
cy.get('.modal-title.h4').should('have.text', 'Versions and deployments').and('be.visible');
|
||||
cy.get('.btn.btn-primary.btn-sm.mx-2').contains('+ Version').click();
|
||||
cy.get('input[placeholder="version name"]').type('1.0');
|
||||
cy.get('button[class="btn btn-primary"]').should('have.text', 'Create').click();
|
||||
cy.get('table').contains('td', 'save').click().contains('td', 'deploy').click();
|
||||
});
|
||||
Cypress.Commands.add("verifyToastMessage", (selector,message) => {
|
||||
cy.get(selector)
|
||||
.should("be.visible")
|
||||
.should("have.text", message);
|
||||
})
|
||||
|
|
@ -15,12 +15,6 @@
|
|||
|
||||
// Import commands.js using ES2015 syntax:
|
||||
import './commands'
|
||||
import '@4tw/cypress-drag-drop'
|
||||
///<reference types="cypress" />
|
||||
|
||||
// Alternatively you can use CommonJS syntax:
|
||||
// require('./commands')
|
||||
Cypress.on('uncaught:exception', (err, runnable) => {
|
||||
// returning false here prevents Cypress from
|
||||
// failing the test
|
||||
return false
|
||||
})
|
||||
Loading…
Reference in a new issue