merge 3.16.0 changes to develop

This commit is contained in:
gsmithun4 2025-08-03 12:39:18 +05:30
parent d07725181a
commit 3513c3f6fa
2037 changed files with 141991 additions and 65361 deletions

2
.nvmrc
View file

@ -1 +1 @@
v18.18.2
v22.15.1

View file

@ -1 +1 @@
3.7.0
3.16.0

View file

@ -1,6 +1,6 @@
{
"[javascript, typescript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"eslint.validate": [
"javascript",

View file

@ -17,6 +17,9 @@
/package.json @shah21 @gsmithun4 @adishm98
/package-lock.json @shah21 @gsmithun4 @adishm98
# Server service files
/server/src/services/email.service.ts @shah21 @gsmithun4
/server/src/mails @shah21 @gsmithun4
# Code owners for all module.ts files
**/module.ts @shah21 @gsmithun4
# Server migration directories
/server/migrations/* @shah21 @gsmithun4
/server/data-migrations/* @shah21 @gsmithun4

View file

@ -1,10 +1,8 @@
ToolJet is an **open-source low-code** platform for building and deploying internal tools with minimal engineering effort. With its drag-and-drop app-builder, you can create complex, responsive applications in minutes. ToolJet supports integration with a wide range of data sources, including databases like PostgreSQL, MongoDB, and Elasticsearch; API endpoints with OpenAPI spec and OAuth2 support; SaaS tools such as Stripe, Slack, Google Sheets, Airtable, and Notion; and object storage services like S3, Google Cloud Storage, and MinIO — enabling you to fetch, transform, and write data with ease.
ToolJet is an **open-source low-code framework** to build and deploy internal tools with minimal engineering effort. ToolJet's drag-and-drop frontend builder allows you to create complex, responsive frontends within minutes. Additionally, you can integrate various data sources, including databases like PostgreSQL, MongoDB, and Elasticsearch; API endpoints with OpenAPI spec and OAuth2 support; SaaS tools such as Stripe, Slack, Google Sheets, Airtable, and Notion; as well as object storage services like S3, GCS, and Minio, to fetch and write data.
ToolJet supports **AI integrations** with services like OpenAI, Hugging Face, Mistral, and more — allowing you to build secure AI-powered applications such as chat assistants, document analyzers, or content generators, all within the same low-code environment.
:star: If you find ToolJet useful, please consider giving us a star on GitHub! Your support helps us continue to innovate and deliver exciting features.
:star: If you find ToolJet useful, please consider giving us a star on GitHub! Your support helps us continue to innovate and deliver exciting features.
![Docker Cloud Build Status](https://img.shields.io/docker/automated/tooljet/tooljet-ce)
![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/tooljet/tooljet-ce)
![Number of GitHub contributors](https://img.shields.io/github/contributors/tooljet/tooljet)
[![Number of GitHub issues that are open](https://img.shields.io/github/issues/ToolJet/ToolJet)](https://github.com/ToolJet/ToolJet/issues)
[![Number of GitHub stars](https://img.shields.io/github/stars/ToolJet/ToolJet)](https://github.com/ToolJet/ToolJet/stargazers)
@ -16,30 +14,31 @@ ToolJet supports **AI integrations** with services like OpenAI, Hugging Face, Mi
[![Follow us on X, formerly Twitter](https://img.shields.io/twitter/follow/ToolJet?style=social)](https://twitter.com/ToolJet)
<p align="center">
<img src="docs/static/img/readme/banner.png" alt="Tooljet dashboard"/>
<img src="https://user-images.githubusercontent.com/7828962/211444352-4d6d2e4a-13c9-4980-9e16-4aed4af9811b.png" alt="Tooljet dashboard showing inventory and orders"/>
</p>
<p align="center">
<img src="docs/static/img/readme/flowchart.png" alt="Platform overview"/>
<img src="https://github.com/ToolJet/ToolJet/assets/25361949/0e711f3a-edb7-496b-8833-107de3826933"/>
</p>
## All features
- **Visual App Builder:** 60+ built-in responsive components, including Tables, Charts, Lists, Forms, and Progress Bars.
- **Visual App Builder:** 45+ built-in responsive components, including Tables, Charts, Lists, Forms, and Progress Bars.
- **ToolJet Database:** Built-in no-code database.
- **Multi-Page:** Build an application with multiple pages.
- **Multiplayer editing:** Allows simultaneous app building by multiple developers.
- **65+ data sources:** Integrate with external databases, cloud storage, and APIs.
- **AI-powered applications:** Connect with OpenAI, Hugging Face, Mistral, and more to build intelligent apps powered by state-of-the-art language models.
- **50+ data sources:** Integrate with external databases, cloud storage, and APIs.
- **Desktop & mobile:** Customize layout widths to fit various screen sizes.
- **Self-host:** Supports Docker, Kubernetes, AWS AMI, Google Cloud Run, and more.
- **Self-host:** Supports Docker, Kubernetes, AWS EC2, Google Cloud Run, and more.
- **Collaborate:** Add comments anywhere on the canvas and tag your team members.
- **Extend with plugins:** Use our [command-line tool](https://www.npmjs.com/package/@tooljet/cli) to easily bootstrap new connectors.
- **Version control:** Manage multiple application versions with a structured release cycle.
- **Run JS & Python code:** Execute custom JavaScript and Python snippets.
- **Granular access control:** Set permissions at both group and app levels.
- **Low-code:** Use JS code almost anywhere within the builder, such as setting text color based on status with
`status === 'success' ? 'green' : 'red'`.
- **No-code query editors:** Query Editors are available for all supported data sources.
- **Transform data:** Process and transform complex data using JavaScript or Python code.
- **Join and transform data:** Transform query results using JavaScript or Python code.
- **Secure:** All the credentials are securely encrypted using `aes-256-gcm`.
- **Data Privacy:** ToolJet serves solely as a proxy and does not store data.
- **SSO:** Supports multiple Single Sign-On providers.
@ -47,13 +46,12 @@ ToolJet supports **AI integrations** with services like OpenAI, Hugging Face, Mi
<hr>
## Quickstart
The easiest way to get started with ToolJet is by creating a [ToolJet Cloud](https://tooljet.ai) account. ToolJet Cloud offers a hosted solution of ToolJet. If you want to self-host ToolJet, kindly proceed to [deployment documentation](https://docs.tooljet.ai/docs/setup/).
### Try using Docker
Want to give ToolJet a quick spin on your local machine? You can run the following command from your terminal to have ToolJet up and running right away.
```bash
docker run \
--name tooljet \
@ -64,16 +62,15 @@ docker run \
tooljet/try:ee-lts-latest
```
_For users upgrading their ToolJet version, we recommend choosing the LTS version over the latest version. The LTS version ensures stability with production bug fixes, security patches, and performance enhancements._
*For users upgrading their ToolJet version, we recommend choosing the LTS version over the latest version. The LTS version ensures stability with production bug fixes, security patches, and performance enhancements.*
## Tutorials and examples
[Build an Employee Directory](https://docs.tooljet.ai/docs/#quickstart-guide/)<br>
[Build your own Ed Tech CRM](https://blog.tooljet.ai/building-an-ed-tech-sales-crm-using-tooljet/)<br>
[Build an Employee Engagement Survey Dashboard](https://blog.tooljet.ai/build-an-employee-engagement-survey-dashboard-using-tooljet/)<br>
[Time Tracker Application](https://docs.tooljet.ai/docs/#quickstart-guide)<br>
[Build your own CMS using low-code](https://blog.tooljet.ai/build-cms-using-lowcode-and-mongodb/)<br>
[AWS S3 Browser](https://blog.tooljet.ai/build-an-aws-s3-broswer-with-tooljet/)<br>
## Documentation
Documentation is available at https://docs.tooljet.ai.
- [Getting Started](https://docs.tooljet.ai)<br>
@ -81,33 +78,30 @@ Documentation is available at https://docs.tooljet.ai.
- [Component Reference](https://docs.tooljet.ai/docs/widgets/button)
## Self-hosted
You can use ToolJet Cloud for a fully managed solution. If you want to self-host ToolJet, we have guides on deploying ToolJet on Kubernetes, AWS EC2, Docker, and more.
You can use ToolJet Cloud for a fully managed solution. If you want to self-host ToolJet, we have guides on deploying ToolJet on Kubernetes, AWS AMI, Docker, and more.
| Provider | Documentation |
| :----------------------------- | :---------------------------------------------------------- |
| Digital Ocean | [Link](https://docs.tooljet.ai/docs/setup/digitalocean) |
| Docker | [Link](https://docs.tooljet.ai/docs/setup/docker) |
| AWS AMI | [Link](https://docs.tooljet.ai/docs/setup/ami) |
| AWS ECS | [Link](https://docs.tooljet.ai/docs/setup/ecs) |
| OpenShift | [Link](https://docs.tooljet.ai/docs/setup/openshift) |
| Helm | [Link](https://docs.tooljet.ai/docs/setup/helm) |
| AWS EKS (Kubernetes) | [Link](https://docs.tooljet.ai/docs/setup/kubernetes) |
| GCP GKE (Kubernetes) | [Link](https://docs.tooljet.ai/docs/setup/kubernetes-gke) |
| Azure AKS (Kubernetes) | [Link](https://docs.tooljet.ai/docs/setup/kubernetes-aks) |
| Azure Container | [Link](https://docs.tooljet.ai/docs/setup/azure-container) |
| Google Cloud Run | [Link](https://docs.tooljet.ai/docs/setup/google-cloud-run) |
| Deploying ToolJet client | [Link](https://docs.tooljet.ai/docs/setup/client) |
| Deploying ToolJet on a Subpath | [Link](https://docs.tooljet.ai/docs/setup/tooljet-subpath/) |
## Marketplace
| Provider | Documentation |
| :------------- | :------------- |
| Digital Ocean | [Link](https://docs.tooljet.ai/docs/setup/digitalocean) |
| Docker | [Link](https://docs.tooljet.ai/docs/setup/docker) |
| AWS EC2 | [Link](https://docs.tooljet.ai/docs/setup/ec2) |
| AWS ECS | [Link](https://docs.tooljet.ai/docs/setup/ecs) |
| OpenShift | [Link](https://docs.tooljet.ai/docs/setup/openshift) |
| Helm | [Link](https://docs.tooljet.ai/docs/setup/helm) |
| AWS EKS (Kubernetes) | [Link](https://docs.tooljet.ai/docs/setup/kubernetes) |
| GCP GKE (Kubernetes) | [Link](https://docs.tooljet.ai/docs/setup/kubernetes-gke) |
| Azure AKS (Kubernetes) | [Link](https://docs.tooljet.ai/docs/setup/kubernetes-aks) |
| Azure Container | [Link](https://docs.tooljet.ai/docs/setup/azure-container) |
| Google Cloud Run | [Link](https://docs.tooljet.ai/docs/setup/google-cloud-run) |
| Deploying ToolJet client | [Link](https://docs.tooljet.ai/docs/setup/client) |
| Deploying ToolJet on a Subpath | [Link](https://docs.tooljet.ai/docs/setup/tooljet-subpath/) |
## Marketplace
ToolJet can now be found on both AWS and Azure Marketplaces, making it simpler than ever to access and deploy our app-building platform.
Find ToolJet on AWS Marketplace [here](https://aws.amazon.com/marketplace/pp/prodview-fxjto27jkpqfg?sr=0-1&ref_=beagle&applicationId=AWSMPContessa) and explore seamless integration on Azure Marketplace [here](https://azuremarketplace.microsoft.com/en-us/marketplace/apps/tooljetsolutioninc1679496832216.tooljet?tab=Overview).
## Community support
For general help using ToolJet, please refer to the official [documentation](https://docs.tooljet.ai/docs/). For additional help, you can use one of these channels to ask a question:
- [Slack](https://tooljet.ai/slack) - Discussions with the community and the team.
@ -115,24 +109,19 @@ For general help using ToolJet, please refer to the official [documentation](htt
- [𝕏 (Twitter)](https://twitter.com/ToolJet) - Get the product updates quickly.
## Roadmap
Check out our [roadmap](https://github.com/orgs/ToolJet/projects/15) to stay updated on recently released features and learn about what's coming next.
## Branching model
We use the git-flow branching model. The base branch is `develop`. If you are looking for a stable version, please use the main branch or tags labeled as v1.x.x.
## Contributing
Kindly read our [Contributing Guide](CONTRIBUTING.md) to familiarize yourself with ToolJet's development process, how to suggest bug fixes and improvements, and the steps for building and testing your changes. <br>
## Contributors
<a href="https://github.com/tooljet/tooljet/graphs/contributors">
<img src="https://contrib.rocks/image?repo=tooljet/tooljet&max=400&columns=20" />
<img src="https://us-central1-tooljet-hub.cloudfunctions.net/github" width="0" height="0" />
</a>
## License
ToolJet © 2023, ToolJet Solutions Inc - Released under the GNU Affero General Public License v3.0.

View file

@ -62,7 +62,7 @@ module.exports = defineConfig({
});
on("task", {
updateId({ dbconfig, sql }) {
dbConnection({ dbconfig, sql }) {
const client = new pg.Pool(dbconfig);
return client.query(sql);
},
@ -76,8 +76,9 @@ module.exports = defineConfig({
experimentalRunAllSpecs: true,
baseUrl: "http://localhost:8082",
specPattern: [
"cypress/e2e/happyPath/appbuilder/commonTestcases/**/*.cy.js",
"cypress/e2e/happyPath/appbuilder/ceTestcases/**/*.cy.js"
// "cypress/e2e/happyPath/appbuilder/commonTestcases/newSuits/**/*.cy.js",
// "cypress/e2e/happyPath/appbuilder/ceTestcases/**/*.cy.js",
"cypress/e2e/happyPath/appbuilder/commonTestcases/newSuits/globalSetingsHappyPath.cy.js"
],
numTestsKeptInMemory: 1,
redirectionLimit: 7,

View file

@ -0,0 +1,116 @@
const { defineConfig } = require("cypress");
const { rmdir } = require("fs");
const fs = require("fs");
const XLSX = require("node-xlsx");
const pg = require("pg");
const path = require("path");
const pdf = require("pdf-parse");
const environments = {
'run-cypress-platform': {
baseUrl: "http://localhost:3000",
configFile: "cypress-platform.config.js"
},
'run-cypress-platform-subpath': {
baseUrl: "http://localhost:3000/apps",
configFile: "cypress-platform.config.js"
},
'run-cypress-platform-proxy': {
baseUrl: "http://localhost:4001",
configFile: "cypress-platform.config.js"
},
'run-cypress-platform-proxy-subpath': {
baseUrl: "http://localhost:4001/apps",
configFile: "cypress-platform.config.js"
}
};
const githubLabel = process.env.GITHUB_LABEL || 'run-cypress-platform';
const environment = environments[githubLabel];
module.exports = defineConfig({
execTimeout: 1800000,
defaultCommandTimeout: 30000,
requestTimeout: 30000,
pageLoadTimeout: 30000,
responseTimeout: 30000,
viewportWidth: 1440,
viewportHeight: 960,
chromeWebSecurity: false,
trashAssetsBeforeRuns: true,
e2e: {
setupNodeEvents (on, config) {
config.baseUrl = environment.baseUrl;
on("task", {
readPdf (pathToPdf) {
return new Promise((resolve) => {
const pdfPath = path.resolve(pathToPdf);
let dataBuffer = fs.readFileSync(pdfPath);
pdf(dataBuffer).then(function ({ text }) {
resolve(text);
});
});
},
});
on("task", {
readXlsx (filePath) {
return new Promise((resolve, reject) => {
try {
let dataBuffer = fs.readFileSync(filePath);
const jsonData = XLSX.parse(dataBuffer);
resolve(jsonData[0]["data"].toString());
} catch (e) {
reject(e);
}
});
},
});
on("task", {
deleteFolder (folderName) {
return new Promise((resolve, reject) => {
rmdir(folderName, { maxRetries: 10, recursive: true }, (err) => {
if (err) {
console.error(err);
return reject(err);
}
resolve(null);
});
});
},
});
on("task", {
dbConnection ({ dbconfig, sql }) {
const client = new pg.Pool(dbconfig);
return client.query(sql);
},
});
return require("./cypress/plugins/index.js")(on, config);
},
downloadsFolder: "cypress/downloads",
experimentalRunAllSpecs: true,
experimentalModfyObstructiveThirdPartyCode: true,
baseUrl: environment.baseUrl,
configFile: environment.configFile,
specPattern: [
"cypress/e2e/happyPath/platform/firstUser/firstUserOnboarding.cy.js",
"cypress/e2e/happyPath/platform/ceTestcases/apps/appSlug.cy.js",
"cypress/e2e/happyPath/platform/ceTestcases/apps/!(*appSlug).cy.js",
"cypress/e2e/happyPath/platform/commonTestcases/userManagment/*.cy.js",
"cypress/e2e/happyPath/platform/eeTestcases/workspace/*.cy.js",
],
numTestsKeptInMemory: 1,
redirectionLimit: 15,
experimentalMemoryManagement: true,
video: false,
videoUploadOnPasses: false,
retries: {
runMode: 2,
openMode: 0,
},
},
});

View file

@ -19,9 +19,9 @@ module.exports = defineConfig({
trashAssetsBeforeRuns: true,
e2e: {
setupNodeEvents(on, config) {
setupNodeEvents (on, config) {
on("task", {
readPdf(pathToPdf) {
readPdf (pathToPdf) {
return new Promise((resolve) => {
const pdfPath = path.resolve(pathToPdf);
let dataBuffer = fs.readFileSync(pdfPath);
@ -33,7 +33,7 @@ module.exports = defineConfig({
});
on("task", {
readXlsx(filePath) {
readXlsx (filePath) {
return new Promise((resolve, reject) => {
try {
let dataBuffer = fs.readFileSync(filePath);
@ -48,7 +48,7 @@ module.exports = defineConfig({
});
on("task", {
deleteFolder(folderName) {
deleteFolder (folderName) {
return new Promise((resolve, reject) => {
rmdir(folderName, { maxRetries: 10, recursive: true }, (err) => {
if (err) {
@ -62,7 +62,7 @@ module.exports = defineConfig({
});
on("task", {
updateId({ dbconfig, sql }) {
dbConnection ({ dbconfig, sql }) {
const client = new pg.Pool(dbconfig);
return client.query(sql);
},
@ -77,7 +77,7 @@ module.exports = defineConfig({
baseUrl: "http://localhost:8082",
specPattern: [
"cypress/e2e/happyPath/marketplace/commonTestcases/**/*.cy.js",
],
]
numTestsKeptInMemory: 1,
redirectionLimit: 7,
experimentalRunAllSpecs: true,

View file

@ -8,7 +8,7 @@ const pdf = require("pdf-parse");
const environments = {
'run-cypress-platform': {
baseUrl: "http://localhost:8082",
baseUrl: "http://localhost:3000",
configFile: "cypress-platform.config.js"
},
'run-cypress-platform-subpath': {
@ -83,7 +83,7 @@ module.exports = defineConfig({
});
on("task", {
updateId ({ dbconfig, sql }) {
dbConnection ({ dbconfig, sql }) {
const client = new pg.Pool(dbconfig);
return client.query(sql);
},
@ -97,8 +97,9 @@ module.exports = defineConfig({
baseUrl: environment.baseUrl,
configFile: environment.configFile,
specPattern: [
"cypress/e2e/happyPath/platform/ceTestcases/userFlow/firstUserOnboarding.cy.js",
"cypress/e2e/happyPath/platform/ceTestcases/!(userFlow)/**/*.cy.js",
"cypress/e2e/happyPath/platform/firstUser/firstUserOnboarding.cy.js",
"cypress/e2e/happyPath/platform/ceTestcases/apps/appSlug.cy.js",
"cypress/e2e/happyPath/platform/ceTestcases/**/!(*appSlug).cy.js",
"cypress/e2e/happyPath/platform/commonTestcases/**/*.cy.js",
],
numTestsKeptInMemory: 1,

View file

@ -19,9 +19,9 @@ module.exports = defineConfig({
trashAssetsBeforeRuns: true,
e2e: {
setupNodeEvents(on, config) {
setupNodeEvents (on, config) {
on("task", {
readPdf(pathToPdf) {
readPdf (pathToPdf) {
return new Promise((resolve) => {
const pdfPath = path.resolve(pathToPdf);
let dataBuffer = fs.readFileSync(pdfPath);
@ -33,7 +33,7 @@ module.exports = defineConfig({
});
on("task", {
readXlsx(filePath) {
readXlsx (filePath) {
return new Promise((resolve, reject) => {
try {
let dataBuffer = fs.readFileSync(filePath);
@ -48,7 +48,7 @@ module.exports = defineConfig({
});
on("task", {
deleteFolder(folderName) {
deleteFolder (folderName) {
return new Promise((resolve, reject) => {
rmdir(folderName, { maxRetries: 10, recursive: true }, (err) => {
if (err) {
@ -62,7 +62,7 @@ module.exports = defineConfig({
});
on("task", {
updateId({ dbconfig, sql }) {
dbConnection ({ dbconfig, sql }) {
const client = new pg.Pool(dbconfig);
return client.query(sql);
},

View file

@ -0,0 +1,198 @@
FROM node:22.15.1 AS builder
# Fix for JS heap limit allocation issue
ENV NODE_OPTIONS="--max-old-space-size=4096"
RUN mkdir -p /app
WORKDIR /app
# Set GitHub token and branch as build arguments
ARG CUSTOM_GITHUB_TOKEN
ARG BRANCH_NAME
# Clone and checkout the frontend repository
RUN git config --global url."https://x-access-token:${CUSTOM_GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"
RUN git config --global http.version HTTP/1.1
RUN git config --global http.postBuffer 524288000
RUN git clone https://github.com/ToolJet/ToolJet.git .
# The branch name needs to be changed the branch with modularisation in CE repo
RUN git checkout ${BRANCH_NAME}
RUN git submodule update --init --recursive
# Checkout the same branch in submodules if it exists, otherwise fallback to main
RUN git submodule foreach " \
if git show-ref --verify --quiet refs/heads/${BRANCH_NAME} || \
git ls-remote --exit-code --heads origin ${BRANCH_NAME}; then \
git checkout ${BRANCH_NAME}; \
else \
echo 'Branch ${BRANCH_NAME} not found in submodule \$name, falling back to main'; \
git checkout main; \
fi"
# Scripts for building
COPY ./package.json ./package.json
# Build plugins
COPY ./plugins/package.json ./plugins/package-lock.json ./plugins/
RUN npm --prefix plugins install
COPY ./plugins/ ./plugins/
RUN NODE_ENV=production npm --prefix plugins run build
RUN npm --prefix plugins prune --production
ENV TOOLJET_EDITION=ee
# Build frontend
COPY ./frontend/package.json ./frontend/package-lock.json ./frontend/
RUN npm --prefix frontend install
COPY ./frontend/ ./frontend/
RUN npm --prefix frontend run build --production
RUN npm --prefix frontend prune --production
ENV NODE_ENV=production
ENV TOOLJET_EDITION=ee
# Build server
COPY ./server/package.json ./server/package-lock.json ./server/
RUN npm --prefix server install
COPY ./server/ ./server/
RUN npm install -g @nestjs/cli
RUN npm install -g copyfiles
RUN npm --prefix server run build
FROM node:22.15.1-bullseye
RUN apt-get update -yq \
&& apt-get install curl wget gnupg zip -yq \
&& apt-get install -yq build-essential \
&& apt -y install redis \
&& apt-get clean -y
# copy postgrest executable
COPY --from=postgrest/postgrest:v12.2.0 /bin/postgrest /bin
ENV NODE_ENV=production
ENV TOOLJET_EDITION=ee
ENV NODE_OPTIONS="--max-old-space-size=4096"
RUN apt-get update && apt-get install -y freetds-dev libaio1 wget supervisor
# Install Instantclient Basic Light Oracle and Dependencies
WORKDIR /opt/oracle
RUN wget https://tooljet-plugins-production.s3.us-east-2.amazonaws.com/marketplace-assets/oracledb/instantclients/instantclient-basiclite-linuxx64.zip && \
wget https://tooljet-plugins-production.s3.us-east-2.amazonaws.com/marketplace-assets/oracledb/instantclients/instantclient-basiclite-linux.x64-11.2.0.4.0.zip && \
unzip instantclient-basiclite-linuxx64.zip && rm -f instantclient-basiclite-linuxx64.zip && \
unzip instantclient-basiclite-linux.x64-11.2.0.4.0.zip && rm -f instantclient-basiclite-linux.x64-11.2.0.4.0.zip && \
cd /opt/oracle/instantclient_21_10 && rm -f *jdbc* *occi* *mysql* *mql1* *ipc1* *jar uidrvci genezi adrci && \
cd /opt/oracle/instantclient_11_2 && rm -f *jdbc* *occi* *mysql* *mql1* *ipc1* *jar uidrvci genezi adrci && \
echo /opt/oracle/instantclient* > /etc/ld.so.conf.d/oracle-instantclient.conf && ldconfig
# Set the Instant Client library paths
ENV LD_LIBRARY_PATH="/opt/oracle/instantclient_11_2:/opt/oracle/instantclient_21_10:${LD_LIBRARY_PATH}"
WORKDIR /
# copy npm scripts
COPY --from=builder /app/package.json ./app/package.json
# copy plugins dependencies
COPY --from=builder /app/plugins/dist ./app/plugins/dist
COPY --from=builder /app/plugins/client.js ./app/plugins/client.js
COPY --from=builder /app/plugins/node_modules ./app/plugins/node_modules
COPY --from=builder /app/plugins/packages/common ./app/plugins/packages/common
COPY --from=builder /app/plugins/package.json ./app/plugins/package.json
# copy frontend build
COPY --from=builder /app/frontend/build ./app/frontend/build
# copy server build
COPY --from=builder /app/server/package.json ./app/server/package.json
COPY --from=builder /app/server/.version ./app/server/.version
COPY --from=builder /app/server/ee/keys ./app/server/ee/keys
COPY --from=builder /app/server/node_modules ./app/server/node_modules
COPY --from=builder /app/server/templates ./app/server/templates
COPY --from=builder /app/server/scripts ./app/server/scripts
COPY --from=builder /app/server/dist ./app/server/dist
WORKDIR /app
# Install PostgreSQL
USER root
RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ bullseye-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list
RUN apt update && apt -y install postgresql-13 postgresql-client-13 supervisor --fix-missing
# Explicitly create PG main directory with correct ownership
RUN mkdir -p /var/lib/postgresql/13/main && \
chown -R postgres:postgres /var/lib/postgresql
RUN mkdir -p /var/log/supervisor /var/run/postgresql && \
chown -R postgres:postgres /var/run/postgresql /var/log/supervisor
# Remove existing data and create directory with proper ownership
RUN rm -rf /var/lib/postgresql/13/main && \
mkdir -p /var/lib/postgresql/13/main && \
chown -R postgres:postgres /var/lib/postgresql
# Initialize PostgreSQL
RUN su - postgres -c "/usr/lib/postgresql/13/bin/initdb -D /var/lib/postgresql/13/main"
# Configure Supervisor to manage PostgREST, ToolJet, and Redis
RUN echo "[supervisord] \n" \
"nodaemon=true \n" \
"user=root \n" \
"\n" \
"[program:redis] \n" \
"command=redis-server /etc/redis/redis.conf \n" \
"user=redis \n" \
"autostart=true \n" \
"autorestart=true \n" \
"stderr_logfile=/var/log/redis/redis-server.log \n" \
"stdout_logfile=/var/log/redis/redis-server.log \n" \
"\n" \
"[program:postgrest] \n" \
"command=/bin/postgrest \n" \
"autostart=true \n" \
"autorestart=true \n" \
"\n" \
"[program:tooljet] \n" \
"user=root \n" \
"command=/bin/bash -c '/app/server/scripts/boot.sh' \n" \
"autostart=true \n" \
"autorestart=true \n" \
"stderr_logfile=/dev/stdout \n" \
"stderr_logfile_maxbytes=0 \n" \
"stdout_logfile=/dev/stdout \n" \
"stdout_logfile_maxbytes=0 \n" | sed 's/ //' > /etc/supervisor/conf.d/supervisord.conf
# ENV defaults
ENV TOOLJET_HOST=http://localhost \
PORT=3000 \
NODE_ENV=production \
LOCKBOX_MASTER_KEY=replace_with_lockbox_master_key \
SECRET_KEY_BASE=replace_with_secret_key_base \
PG_DB=tooljet_production \
PG_USER=postgres \
PG_PASS=postgres \
PG_HOST=localhost \
ENABLE_TOOLJET_DB=true \
TOOLJET_DB_HOST=localhost \
TOOLJET_DB_USER=postgres \
TOOLJET_DB_PASS=postgres \
TOOLJET_DB=tooljet_db \
PGRST_HOST=http://localhost:3001 \
PGRST_SERVER_PORT=3001 \
PGRST_DB_URI=postgres://postgres:postgres@localhost/tooljet_db \
PGRST_JWT_SECRET=r9iMKoe5CRMgvJBBtp4HrqN7QiPpUToj \
PGRST_DB_PRE_CONFIG=postgrest.pre_config \
REDIS_HOST=localhost \
REDIS_PORT=6379 \
REDIS_USER= \
REDIS_PASSWORD= \
ORM_LOGGING=true \
DEPLOYMENT_PLATFORM=docker:local \
HOME=/home/appuser \
TERM=xterm
RUN chmod +x ./server/scripts/preview.sh
# Set the entrypoint
ENTRYPOINT ["./server/scripts/preview.sh"]

View file

@ -66,7 +66,7 @@ module.exports = defineConfig({
});
on("task", {
updateId ({ dbconfig, sql }) {
dbConnection ({ dbconfig, sql }) {
const client = new pg.Pool(dbconfig);
return client.query(sql);
},

View file

@ -1,3 +1,5 @@
const envVar = Cypress.env("environment");
Cypress.Commands.add(
"apiLogin",
(
@ -50,7 +52,7 @@ Cypress.Commands.add("apiCreateGDS", (url, name, kind, options) => {
log: false;
}
expect(response.status).to.equal(201);
Cypress.env(`${name}-id`, response.body.id);
Cypress.env(`${name}`, response.body.id);
Cypress.log({
name: "Create Data Source",
@ -61,6 +63,31 @@ Cypress.Commands.add("apiCreateGDS", (url, name, kind, options) => {
});
});
Cypress.Commands.add("apiFetchDataSourcesId", () => {
cy.getAuthHeaders().then((headers) => {
cy.request({
method: "GET",
url: `${Cypress.env("server_host")}/api/data-sources/${Cypress.env("workspaceId")}/environments/${Cypress.env("environmentId")}/versions/${Cypress.env("editingVersionId")}`,
headers,
}).then((response) => {
expect(response.status).to.equal(200);
const dataSources = response.body?.data_sources || [];
dataSources.forEach((item) => {
Cypress.env(`${item.kind}`, `${item.id}`);
});
Cypress.log({
name: "DS Fetch",
displayName: "Data Sources Fetched",
message: dataSources
.map((ds) => `\nKind: '${ds.kind}', Name: '${ds.id}'`)
.join(","),
});
});
});
});
Cypress.Commands.add("apiCreateApp", (appName = "testApp") => {
cy.window({ log: false }).then((win) => {
win.localStorage.setItem("walkthroughCompleted", "true");
@ -75,14 +102,17 @@ Cypress.Commands.add("apiCreateApp", (appName = "testApp") => {
Cookie: `tj_auth_token = ${cookie.value}`,
},
body: {
created_at: "",
id: "",
is_maintenance_on: false,
is_public: null,
type: "front-end",
name: appName,
is_maintenance_on: false,
organization_id: "",
updated_at: "",
user_id: "",
created_at: "",
updated_at: "",
id: "",
is_public: null,
workflow_enabled: false,
creation_mode: "DEFAULT",
},
}).then((response) => {
{
@ -128,21 +158,17 @@ Cypress.Commands.add(
appId = Cypress.env("appId"),
componentSelector = "[data-cy='empty-editor-text']"
) => {
cy.intercept("GET", "/api/v2/apps/*").as("getAppData");
cy.intercept("GET", "/api/apps/*").as("getAppData");
cy.window({ log: false }).then((win) => {
win.localStorage.setItem("walkthroughCompleted", "true");
});
cy.visit(`/${workspaceId}/apps/${appId}/${slug}`);
cy.wait("@getAppData").then((interception) => {
// Assuming the response body is a JSON object
const responseData = interception.response.body;
// Set the response data as an environment variable
Cypress.env("apiResponseData", responseData);
// You can log it to check if the env var is set correctly
cy.log(Cypress.env("apiResponseData"));
Cypress.env("editingVersionId", responseData.editing_version.id);
Cypress.env("environmentId", responseData.editorEnvironment.id);
});
cy.get(componentSelector, { timeout: 10000 });
}
@ -166,6 +192,7 @@ Cypress.Commands.add("apiCreateWorkspace", (workspaceName, workspaceSlug) => {
{ log: false }
).then((response) => {
expect(response.status).to.equal(201);
return response;
});
});
});
@ -175,7 +202,7 @@ Cypress.Commands.add("apiLogout", () => {
cy.request(
{
method: "GET",
url: `${Cypress.env("server_host")}/api/logout`,
url: `${Cypress.env("server_host")}/api/session/logout`,
headers: {
"Tj-Workspace-Id": Cypress.env("workspaceId"),
Cookie: `tj_auth_token=${cookie.value}`,
@ -190,22 +217,36 @@ Cypress.Commands.add("apiLogout", () => {
Cypress.Commands.add(
"apiUserInvite",
(userName, userEmail, userRole = "end-user") => {
(userName, userEmail, userRole = "end-user", metaData = {}) => {
const requestBody =
envVar === "Enterprise"
? {
email: userEmail,
firstName: userName,
groups: [],
lastName: "",
role: userRole,
userMetadata: metaData,
}
: {
email: userEmail,
firstName: userName,
groups: [],
lastName: "",
role: userRole,
userMetadata: metaData,
};
cy.getCookie("tj_auth_token").then((cookie) => {
cy.request(
{
method: "POST",
url: `${Cypress.env("server_host")}/api/organization_users`,
url: `${Cypress.env("server_host")}/api/organization-users`,
headers: {
"Tj-Workspace-Id": Cypress.env("workspaceId"),
Cookie: `tj_auth_token=${cookie.value}`,
},
body: {
first_name: userName,
email: userEmail,
groups: [],
role: userRole,
},
body: requestBody,
},
{ log: false }
).then((response) => {
@ -221,21 +262,26 @@ Cypress.Commands.add("apiAddQuery", (queryName, query, dataQueryId) => {
"Tj-Workspace-Id": Cypress.env("workspaceId"),
Cookie: `tj_auth_token=${cookie.value}`,
};
cy.request({
method: "PATCH",
url: `${Cypress.env("server_host")}/api/data_queries/${dataQueryId}`,
headers: headers,
body: {
name: queryName,
options: {
mode: "sql",
transformationLanguage: "javascript",
enableTransformation: false,
query: query,
cy.apiGetAppData(Cypress.env("appId")).then((appData) => {
const editingVersionId = appData.editing_version.id;
cy.request({
method: "PATCH",
url: `${Cypress.env("server_host")}/api/data-queries/${dataQueryId}/versions/${editingVersionId}`,
headers: headers,
body: {
name: queryName,
options: {
mode: "sql",
transformationLanguage: "javascript",
enableTransformation: false,
query: query,
},
},
},
}).then((patchResponse) => {
expect(patchResponse.status).to.equal(200);
}).then((patchResponse) => {
expect(patchResponse.status).to.equal(200);
});
});
});
});
@ -243,6 +289,9 @@ Cypress.Commands.add("apiAddQuery", (queryName, query, dataQueryId) => {
Cypress.Commands.add(
"apiAddQueryToApp",
(queryName, options, dsName, dsKind) => {
cy.log(
`${Cypress.env("server_host")}/api/data-queries/data-sources/${Cypress.env(dsKind)}/versions/${Cypress.env("editingVersionId")}`
);
cy.getCookie("tj_auth_token", { log: false }).then((cookie) => {
const authToken = `tj_auth_token=${cookie.value}`;
const workspaceId = Cypress.env("workspaceId");
@ -262,7 +311,7 @@ Cypress.Commands.add(
cy.request({
method: "POST",
url: `${Cypress.env("server_host")}/api/data_queries`,
url: `${Cypress.env("server_host")}/api/data-queries/data-sources/${Cypress.env(dsKind)}/versions/${Cypress.env("editingVersionId")}`,
headers: {
"Content-Type": "application/json",
Cookie: authToken,
@ -315,7 +364,7 @@ Cypress.Commands.add(
cy.request({
method: "GET",
url: `${Cypress.env("server_host")}/api/v2/apps/${appId}`,
url: `${Cypress.env("server_host")}/api/apps/${appId}`,
headers: {
"Tj-Workspace-Id": Cypress.env("workspaceId"),
Cookie: `tj_auth_token=${cookie.value}`,
@ -430,48 +479,54 @@ Cypress.Commands.add("apiMakeAppPublic", (appId = Cypress.env("appId")) => {
});
});
Cypress.Commands.add("apiDeleteGranularPermission", (groupName) => {
Cypress.Commands.add("apiDeleteGranularPermission", (groupName, typesToDelete = []) => {
cy.getAuthHeaders().then((headers) => {
// Fetch group permissions
// Step 1: Get the group by name
cy.request({
method: "GET",
url: `${Cypress.env("server_host")}/api/v2/group_permissions`,
headers: headers,
url: `${Cypress.env("server_host")}/api/v2/group-permissions`,
headers,
log: false,
}).then((response) => {
expect(response.status).to.equal(200);
const group = response.body.groupPermissions.find(
(g) => g.name === groupName
);
const group = response.body.groupPermissions.find((g) => g.name === groupName);
if (!group) throw new Error(`Group with name ${groupName} not found`);
const groupId = group.id;
// Fetch granular permissions for the specific group
// Step 2: Get all granular permissions for the group
cy.request({
method: "GET",
url: `${Cypress.env("server_host")}/api/v2/group_permissions/${groupId}/granular-permissions`,
url: `${Cypress.env("server_host")}/api/v2/group-permissions/${groupId}/granular-permissions`,
headers,
log: false,
}).then((granularResponse) => {
expect(granularResponse.status).to.equal(200);
const granularPermissionId = granularResponse.body[0].id;
const granularPermissions = granularResponse.body;
// Delete the granular permission
cy.request({
method: "DELETE",
url: `${Cypress.env("server_host")}/api/v2/group_permissions/granular-permissions/${granularPermissionId}`,
headers,
log: false,
}).then((deleteResponse) => {
expect(deleteResponse.status).to.equal(200);
// Step 3: Filter if typesToDelete is specified
const permissionsToDelete = typesToDelete.length
? granularPermissions.filter((perm) => typesToDelete.includes(perm.type))
: granularPermissions;
// Step 4: Delete each granular permission
permissionsToDelete.forEach((permission) => {
cy.request({
method: "DELETE",
url: `${Cypress.env("server_host")}/api/v2/group-permissions/granular-permissions/app/${permission.id}`,
headers,
log: false,
}).then((deleteResponse) => {
expect(deleteResponse.status).to.equal(200);
cy.log(`Deleted granular permission: ${permission.name}`);
});
});
});
});
});
});
Cypress.Commands.add(
"apiCreateGranularPermission",
(
@ -483,11 +538,10 @@ Cypress.Commands.add(
resourcesToAdd = []
) => {
cy.getAuthHeaders().then((headers) => {
// Fetch group permissions
cy.request({
method: "GET",
url: `${Cypress.env("server_host")}/api/v2/group_permissions`,
url: `${Cypress.env("server_host")}/api/v2/group-permissions`,
headers: headers,
log: false,
}).then((response) => {
@ -502,7 +556,7 @@ Cypress.Commands.add(
// Create granular permission
cy.request({
method: "POST",
url: `${Cypress.env("server_host")}/api/v2/group_permissions/granular-permissions`,
url: `${Cypress.env("server_host")}/api/v2/group-permissions/granular-permissions`,
headers: headers,
body: {
name,
@ -528,10 +582,9 @@ Cypress.Commands.add(
Cypress.Commands.add("apiReleaseApp", (appName) => {
cy.getAppId(appName).then((appId) => {
cy.getAuthHeaders().then((headers) => {
cy.request({
method: "GET",
url: `${Cypress.env("server_host")}/api/v2/apps/${appId}`,
url: `${Cypress.env("server_host")}/api/apps/${appId}`,
headers,
})
.then((response) => {
@ -539,7 +592,7 @@ Cypress.Commands.add("apiReleaseApp", (appName) => {
const editingVersionId = response.body.editing_version.id;
cy.request({
method: "PUT",
url: `${Cypress.env("server_host")}/api/v2/apps/${appId}/release`,
url: `${Cypress.env("server_host")}/api/apps/${appId}/release`,
headers: headers,
body: {
versionToBeReleased: editingVersionId,
@ -556,7 +609,6 @@ Cypress.Commands.add("apiReleaseApp", (appName) => {
Cypress.Commands.add("apiAddAppSlug", (appName, slug) => {
cy.getAppId(appName).then((appId) => {
cy.getAuthHeaders().then((headers) => {
cy.request({
method: "PUT",
url: `${Cypress.env("server_host")}/api/apps/${appId}`,
@ -576,7 +628,6 @@ Cypress.Commands.add("apiAddAppSlug", (appName, slug) => {
Cypress.Commands.add("apiGetTableIdByName", (tableName) => {
cy.getAuthHeaders().then((headers) => {
cy.request({
method: "GET",
url: `${Cypress.env("server_host")}/api/tooljet-db/organizations/${Cypress.env("workspaceId")}/tables`,
@ -594,7 +645,6 @@ Cypress.Commands.add("apiGetTableIdByName", (tableName) => {
Cypress.Commands.add("apiAddDataToTable", (tableName, data) => {
cy.apiGetTableIdByName(tableName).then((tableId) => {
cy.getAuthHeaders().then((headers) => {
cy.request({
method: "POST",
url: `${Cypress.env("server_host")}/api/tooljet-db/proxy/${tableId}`,
@ -609,10 +659,11 @@ Cypress.Commands.add("apiAddDataToTable", (tableName, data) => {
});
Cypress.Commands.add("apiGetDataSourceIdByName", (dataSourceName) => {
const workspaceId = Cypress.env("workspaceId");
cy.getAuthHeaders().then((headers) => {
cy.request({
method: "GET",
url: `${Cypress.env("server_host")}/api/v2/data_sources`,
url: `${Cypress.env("server_host")}/api/data-sources/${workspaceId}`,
headers: headers,
}).then((response) => {
expect(response.status).to.equal(200);
@ -647,7 +698,7 @@ Cypress.Commands.add(
name: dataSourceName,
options: [
{ key: "connection_type", value: "manual", encrypted: false },
{ key: "host", value: "35.202.183.199" },
{ key: "host", value: "9.234.17.31" },
{ key: "port", value: 5432 },
{ key: "database", value: "student" },
{ key: "username", value: "postgres" },
@ -670,7 +721,7 @@ Cypress.Commands.add(
cy.request({
method: "PUT",
url: `${Cypress.env("server_host")}/api/v2/data_sources/${dataSourceId}?environment_id=${environmentId}`,
url: `${Cypress.env("server_host")}/api/data-sources/${dataSourceId}?environment_id=${environmentId}`,
headers: headers,
body: mergedData,
}).then((updateResponse) => {
@ -683,3 +734,67 @@ Cypress.Commands.add(
}
);
Cypress.Commands.add("apiGetAppData", (appId = Cypress.env("appId")) => {
cy.getAuthHeaders().then((headers) => {
cy.request({
method: "GET",
url: `${Cypress.env("server_host")}/api/apps/${appId}`,
headers: headers,
}).then((response) => {
expect(response.status).to.equal(200);
return response.body;
});
});
});
Cypress.Commands.add("apiDeleteGDS", (name) => {
const dataSourceId = Cypress.env(`${name}`);
cy.getCookie("tj_auth_token").then((cookie) => {
cy.request({
method: "DELETE",
url: `${Cypress.env("server_host")}/api/data-sources/${dataSourceId}`,
headers: {
"Tj-Workspace-Id": Cypress.env("workspaceId"),
Cookie: `tj_auth_token=${cookie.value}`,
},
failOnStatusCode: false,
}).then((response) => {
console.log("Delete response:", response);
expect(response.status, "Delete status code").to.eq(200);
Cypress.log({
name: "Delete Data Source",
displayName: "Data source deleted",
message: `Name: '${name}' | ID: '${dataSourceId}'`,
});
});
});
});
Cypress.Commands.add(
"apiUpdateGDS",
({ name, options, envName = "development" }) => {
cy.getAuthHeaders().then((headers) => {
cy.apiGetEnvironments().then((environments) => {
const environment = environments.find((env) => env.name === envName);
const environmentId = environment.id;
const dataSourceId = Cypress.env(`${name}`);
cy.request({
method: "PUT",
url: `${Cypress.env("server_host")}/api/data-sources/${dataSourceId}?environment_id=${environmentId}`,
headers: headers,
body: {
name: name,
options: options,
},
}).then((response) => {
expect(response.status).to.equal(200);
cy.log(`Datasource "${name}" updated successfully.`);
});
});
});
}
);

View file

@ -6,23 +6,21 @@ import { passwordInputText } from "Texts/passwordInput";
import { importSelectors } from "Selectors/exportImport";
import { importText } from "Texts/exportImport";
import { onboardingSelectors } from "Selectors/onboarding";
import { selectAppCardOption } from "Support/utils/common";
const API_ENDPOINT =
Cypress.env("environment") === "Community"
? "/api/library_apps"
: "/api/library_apps";
Cypress.Commands.add(
"appUILogin",
(email = "dev@tooljet.io", password = "password") => {
const API_ENDPOINT =
Cypress.env("environment") === "Community"
? "/api/library_apps/"
: "/api/library_apps";
cy.visit("/");
cy.wait(1000);
cy.clearAndType(onboardingSelectors.loginEmailInput, email);
cy.clearAndType(onboardingSelectors.loginPasswordInput, password);
cy.get(onboardingSelectors.signInButton).click();
cy.intercept("GET", API_ENDPOINT).as("library_apps");
cy.get(commonSelectors.homePageLogo, { timeout: 10000 });
cy.wait("@library_apps");
cy.wait(2000);
cy.get('[data-cy="main-wrapper"]', { timeout: 10000 }).should("be.visible");
}
);
@ -86,7 +84,20 @@ Cypress.Commands.add(
const dataTransfer = new DataTransfer();
cy.forceClickOnCanvas();
cy.clearAndType(commonSelectors.searchField, widgetName);
cy.get("body")
.then(($body) => {
const isSearchVisible = $body
.find(commonSelectors.searchField)
.is(":visible");
if (!isSearchVisible) {
cy.get('[data-cy="right-sidebar-plus-button"]').click();
}
})
.then(() => {
cy.clearAndType(commonSelectors.searchField, widgetName);
});
cy.get(commonWidgetSelector.widgetBox(widgetName2)).trigger(
"dragstart",
{ dataTransfer },
@ -142,13 +153,11 @@ Cypress.Commands.add(
};
if (Array.isArray(value)) {
cy.wrap(subject)
.last()
.realType(value, {
parseSpecialCharSequences: false,
delay: 0,
force: true,
});
cy.wrap(subject).last().realType(value, {
parseSpecialCharSequences: false,
delay: 0,
force: true,
});
} else {
splitIntoFlatArray(value).forEach((i) => {
cy.wrap(subject)
@ -165,13 +174,15 @@ Cypress.Commands.add(
Cypress.Commands.add("deleteApp", (appName) => {
cy.intercept("DELETE", "/api/apps/*").as("appDeleted");
cy.get(commonSelectors.appCard(appName))
.realHover()
.find(commonSelectors.appCardOptionsButton)
.realHover()
.click();
cy.get(commonSelectors.deleteAppOption).click();
selectAppCardOption(
appName,
commonSelectors.appCardOptions(commonText.deleteAppOption)
);
cy.get(commonSelectors.buttonSelector(commonText.modalYesButton)).click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
commonText.appDeletedToast
);
cy.wait("@appDeleted");
});
@ -305,19 +316,19 @@ Cypress.Commands.add("skipEditorPopover", () => {
});
Cypress.Commands.add("waitForAppLoad", () => {
const API_ENDPOINT =
Cypress.env("environment") === "Community"
? "/api/v2/data_sources"
: "/api/app-environments**";
// const API_ENDPOINT =
// Cypress.env("environment") === "Community"
// ? "/api/v2/data_sources"
// : "/api/app-environments**";
const TIMEOUT = 15000;
// const TIMEOUT = 15000;
cy.intercept("GET", API_ENDPOINT).as("appDs");
cy.wait("@appDs", { timeout: TIMEOUT });
cy.intercept("GET", "/api/data-queries/**").as("appDs");
cy.wait("@appDs", { timeout: 15000 });
});
Cypress.Commands.add("visitTheWorkspace", (workspaceName) => {
cy.task("updateId", {
cy.task("dbConnection", {
dbconfig: Cypress.env("app_db"),
sql: `select id from organizations where name='${workspaceName}';`,
}).then((resp) => {
@ -399,44 +410,37 @@ Cypress.Commands.add("getPosition", (componentName) => {
});
Cypress.Commands.add("defaultWorkspaceLogin", () => {
cy.task("updateId", {
cy.task("dbConnection", {
dbconfig: Cypress.env("app_db"),
sql: `
SELECT id FROM organizations WHERE name = 'My workspace';
`,
SELECT id FROM organizations WHERE name = 'My workspace';`,
}).then((resp) => {
const workspaceId = resp.rows[0].id;
cy.apiLogin("dev@tooljet.io", "password", workspaceId, "/my-workspace");
cy.visit("/");
cy.intercept("GET", "/api/library_apps").as("library_apps");
cy.get(commonSelectors.homePageLogo, { timeout: 10000 });
cy.wait("@library_apps");
cy.apiLogin(
"dev@tooljet.io",
"password",
workspaceId,
"/my-workspace"
).then(() => {
cy.visit("/");
cy.wait(2000);
cy.get(commonSelectors.homePageLogo, { timeout: 10000 });
});
});
});
Cypress.Commands.add(
"visitSlug",
({
actualUrl,
currentUrl = `${Cypress.config("baseUrl")}/error/unknown`,
}) => {
// Ensure actualUrl is provided
if (!actualUrl) {
throw new Error("actualUrl is required for visitSlug command.");
Cypress.Commands.add("visitSlug", ({ actualUrl }) => {
cy.visit(actualUrl);
cy.wait(1000);
cy.url().then((currentUrl) => {
if (currentUrl !== actualUrl) {
cy.visit(actualUrl);
cy.wait(1000);
}
cy.visit(actualUrl);
// Dynamically wait for the correct URL or handle navigation errors
cy.url().then((url) => {
if (url === currentUrl) {
cy.log(`Navigation resulted in unexpected URL: ${url}. Retrying...`);
cy.visit(actualUrl);
}
});
}
);
});
});
Cypress.Commands.add("releaseApp", () => {
if (Cypress.env("environment") !== "Community") {
@ -458,13 +462,13 @@ Cypress.Commands.add("releaseApp", () => {
Cypress.Commands.add("backToApps", () => {
cy.get(commonSelectors.editorPageLogo).click();
cy.get(commonSelectors.backToAppOption).click();
cy.intercept("GET", "/api/library_apps/").as("library_apps");
cy.intercept("GET", API_ENDPOINT).as("library_apps");
cy.get(commonSelectors.homePageLogo, { timeout: 10000 });
cy.wait("@library_apps");
});
Cypress.Commands.add("removeAssignedApps", () => {
cy.task("updateId", {
cy.task("dbConnection", {
dbconfig: Cypress.env("app_db"),
sql: `DELETE FROM app_group_permissions;`,
});
@ -503,7 +507,7 @@ Cypress.Commands.add("skipWalkthrough", () => {
Cypress.Commands.add("appPrivacy", (appName, isPublic) => {
const isPublicValue = isPublic ? "true" : "false";
cy.task("updateId", {
cy.task("dbConnection", {
dbconfig: Cypress.env("app_db"),
sql: `UPDATE apps SET is_public = ${isPublicValue} WHERE name = '${appName}';`,
});
@ -522,23 +526,60 @@ Cypress.Commands.overwrite(
}
);
Cypress.Commands.add("installMarketplacePlugin", (pluginName) => {
const MARKETPLACE_URL = `${Cypress.config("baseUrl")}/integrations/marketplace`;
cy.visit(MARKETPLACE_URL);
cy.wait(1000);
cy.get('[data-cy="-list-item"]').eq(0).click();
cy.wait(1000);
cy.get("body").then(($body) => {
if ($body.find(".plugins-card").length === 0) {
cy.log("No plugins found, proceeding to install...");
installPlugin(pluginName);
} else {
cy.get(".plugins-card").then(($cards) => {
const isInstalled = $cards.toArray().some((card) => {
return (
Cypress.$(card)
.find(".font-weight-medium.text-capitalize")
.text()
.trim() === pluginName
);
});
if (isInstalled) {
cy.log(`${pluginName} is already installed. Skipping installation.`);
cy.get(commonSelectors.globalDataSourceIcon).click();
} else {
installPlugin(pluginName);
cy.get(commonSelectors.globalDataSourceIcon).click();
}
});
}
});
function installPlugin (pluginName) {
cy.get('[data-cy="-list-item"]').eq(1).click();
cy.wait(1000);
cy.contains(".plugins-card", pluginName).within(() => {
cy.get(".marketplace-install").click();
cy.wait(1000);
});
}
});
Cypress.Commands.add("verifyElement", (selector, text, eqValue) => {
const element =
eqValue !== undefined ? cy.get(selector).eq(eqValue) : cy.get(selector);
element.should("be.visible").and("have.text", text);
});
Cypress.Commands.add("loginWithCredentials", (email, password) => {
cy.get(onboardingSelectors.loginEmailInput, { timeout: 20000 }).should(
"be.visible"
);
cy.clearAndType(onboardingSelectors.loginEmailInput, email);
cy.clearAndType(onboardingSelectors.loginPasswordInput, password);
cy.get(onboardingSelectors.signInButton).click();
});
Cypress.Commands.add("getAppId", (appName) => {
cy.task("updateId", {
cy.task("dbConnection", {
dbconfig: Cypress.env("app_db"),
sql: `select id from apps where name='${appName}';`,
}).then((resp) => {
@ -546,3 +587,73 @@ Cypress.Commands.add("getAppId", (appName) => {
return appId;
});
});
Cypress.Commands.add("uninstallMarketplacePlugin", (pluginName) => {
const MARKETPLACE_URL = `${Cypress.config("baseUrl")}/integrations/marketplace`;
cy.visit(MARKETPLACE_URL);
cy.wait(1000);
cy.get('[data-cy="-list-item"]').eq(0).click();
cy.wait(1000);
cy.get(".plugins-card").each(($card) => {
cy.wrap($card)
.find(".font-weight-medium.text-capitalize")
.invoke("text")
.then((text) => {
if (text.trim() === pluginName) {
cy.wrap($card).find(".link-primary").contains("Remove").click();
cy.wait(1000);
cy.get('[data-cy="delete-plugin-title"]').should("be.visible");
cy.get('[data-cy="yes-button"]').click();
cy.wait(2000);
cy.log(`${pluginName} has been successfully uninstalled.`);
} else {
cy.log(`${pluginName} is not installed. Skipping uninstallation.`);
}
});
});
});
Cypress.Commands.add(
"verifyRequiredFieldValidation",
(fieldName, expectedColor) => {
cy.get(commonSelectors.textField(fieldName)).type("some text").clear();
cy.get(commonSelectors.textField(fieldName)).should(
"have.css",
"border-color",
expectedColor
);
cy.get(commonSelectors.labelFieldValidation(fieldName))
.should("be.visible")
.and("have.text", `${fieldName} is required`);
cy.get(commonSelectors.labelFieldAlert(fieldName))
.should("be.visible")
.and("have.text", `${fieldName} is required`);
}
);
Cypress.Commands.add("ifEnv", (expectedEnvs, callback) => {
const actualEnv = Cypress.env("environment");
const envArray = Array.isArray(expectedEnvs) ? expectedEnvs : [expectedEnvs];
if (envArray.includes(actualEnv)) {
callback();
}
});
Cypress.Commands.add("openComponentSidebar", (selector, value) => {
cy.get("body")
.then(($body) => {
const isSearchVisible = $body
.find(commonSelectors.searchField)
.is(":visible");
if (!isSearchVisible) {
cy.get('[data-cy="right-sidebar-plus-button"]').click();
}
})
});

View file

@ -0,0 +1,62 @@
export const pluginSelectors = {
regionField: '[data-cy="region-section"] .react-select__control',
regionFieldValue: '[data-cy="region-section"] .react-select__single-value',
amazonsesAccesKey: '[data-cy="access-key-text-field"]',
operationDropdown: '[data-cy="operation-select-dropdown"]',
sendEmailInputField: '[data-cy="send-mail-to-input-field"]',
ccEmailInputField: '[data-cy="cc-to-input-field"]',
bccEmailInputField: '[data-cy="bcc-to-input-field"]',
sendEmailFromInputField: '[data-cy="send-mail-from-input-field"]',
emailSubjetInputField: '[data-cy="subject-input-field"]',
emailbodyInputField: '[data-cy="body-input-field"]',
amazonAthenaDbName: '[data-cy="database-text-field"]',
};
export const baserowSelectors = {
hostField: '[data-cy="host-select-dropdown"]',
baserowApiKey: '[data-cy="api-token-text-field"]',
table: '[data-cy="table-id-input-field"]',
rowIdinputfield: '[data-cy="row-id-input-field"]',
};
export const appWriteSelectors = {
projectID: '[data-cy="project-id-text-field"]',
collectionId: '[data-cy="collectionid-input-field"]',
documentId: '[data-cy="documentid-input-field"]',
bodyInput: '[data-cy="body-input-field"]',
};
export const twilioSelectors = {
toNumberInputField: '[data-cy="to-number-input-field"]',
bodyInput: '[data-cy="body-input-field"]',
};
export const minioSelectors = {
sslToggle: 'data-cy="ssl-enabled-toggle-input"',
bucketNameInputField: '[data-cy="bucket-input-field"]',
objectNameInputField: '[data-cy="objectname-input-field"]',
contentTypeInputField: '[data-cy="contenttype-input-field"]',
dataInput: '[data-cy="data-input-field"]',
};
export const harperDbSelectors = {
recordsInputField: '[data-cy="records-input-field"]',
hashValueInputField: '[data-cy="hash-values-input-field"]',
attributesInputField: '[data-cy="attributes-input-field"]',
searchValueInputField: '[data-cy="search-value-input-field"]',
searchAttributeInputField: '[data-cy="search-attribute-input-field"]',
conditionInputField: '[data-cy="conditions-input-field"]',
sqlQueryInputField: '[data-cy="sql-query-input-field"]',
schemaInputField: '[data-cy="schema-input-field"]',
TableInputField: '[data-cy="table-input-field"]',
};
export const awsTextractSelectors = {
documentInputField: '[data-cy="document-input-field"]',
bucketNameInputField: '[data-cy="bucket-input-field"]',
keyNameInputField: '[data-cy="key-input-field"]',
};
export const graphQLSelectors = {
urlInputField: '[data-cy="url-text-field"]',
};

View file

@ -5,5 +5,5 @@ export const s3Selector = {
regionLabel: '[data-cy="label-region"]',
customEndpointLabel: '[data-cy="label-custom-endpoint"]',
customEndpointInput: '[data-cy="undefined-text-field"]',
dataSourceNameInput: '[data-cy="data-source-name-input-filed"]',
dataSourceNameInput: '[data-cy="data-source-name-input-field"]',
};

View file

@ -1,12 +1,13 @@
export const cyParamName = (paramName = "") => {
return paramName.toLowerCase().replace(/\s+/g, "-");
return String(paramName).toLowerCase().replace(/\s+/g, "-");
};
export const commonSelectors = {
toastMessage: ".go3958317564",
oldToastMessage: ".go318386747",
appSlugAccept: '[data-cy="app-slug-accepted-label"]',
newToastMessage: '.drawer-container > [style="position: fixed; z-index: 9999; inset: 16px; pointer-events: none;"] > .go4109123758 > .go2072408551 > .go3958317564',
newToastMessage:
'.drawer-container > [style="position: fixed; z-index: 9999; inset: 16px; pointer-events: none;"] > .go4109123758 > .go2072408551 > .go3958317564',
toastCloseButton: '[data-cy="toast-close-button"]',
editButton: "[data-cy=edit-button]",
workspaceConstantNameInput: '[data-cy="name-input-field"]',
@ -17,8 +18,8 @@ export const commonSelectors = {
canvas: "[data-cy=real-canvas]",
appCardOptionsButton: "[data-cy=app-card-menu-icon]",
autoSave: "[data-cy=autosave-indicator]",
nameInputFieldd: "[data-cy=name-input-field]",
valueInputFieldd: '[data-cy=value-input-field]',
inputFieldName: "[data-cy=name-input-field]",
valueInputFieldd: "[data-cy=value-input-field]",
skipButton: ".driver-close-btn",
skipInstallationModal: "[data-cy=skip-button]",
homePageLogo: "[data-cy=home-page-logo]",
@ -176,7 +177,7 @@ export const commonSelectors = {
breadcrumbPageTitle: '[data-cy="breadcrumb-page-title"]',
labelFullNameInput: '[data-cy="name-label"]',
duplicateOption: '[data-cy="duplicate-group-card-option"]',
confirmDuplicateButton: '[data-cy="confim-button"]',
confirmDuplicateButton: '[data-cy="confirm-button"]',
inputFieldFullName: '[data-cy="name-input"]',
labelEmailInput: '[data-cy="email-label"]',
inputFieldEmailAddress: '[data-cy="email-input"]',
@ -259,7 +260,7 @@ export const commonSelectors = {
cloneAppTitle: '[data-cy="clone-app-title"]',
cloneAppButton: '[data-cy="clone-app"]',
appNameErrorLabel: '[data-cy="app-name-error-label"]',
importAppTitle: '[data-cy="import-app-title"]',
importAppTitle: '[data-cy="import-an-app"]',
importAppButton: '[data-cy="import-app"]',
chooseFromTemplateButton: '[data-cy="choose-from-template-button"]',
CreateAppFromTemplateButton: '[data-cy="create-new-app-from-template-title"]',
@ -277,6 +278,17 @@ export const commonSelectors = {
defaultModalTitle: '[data-cy="modal-title"]',
workspaceConstantsIcon: '[data-cy="icon-workspace-constants"]',
confirmationButton: '[data-cy="confirmation-button"]',
textField: (fieldName) => {
return `[data-cy="${cyParamName(fieldName)}-text-field"]`;
},
labelFieldValidation: (fieldName) => {
return `[data-cy="${cyParamName(fieldName)}-is-required-validation-label"]`;
},
labelFieldAlert: (fieldName) => {
return `[data-cy="${cyParamName(fieldName)}-is-required-field-alert-text"]`;
},
pageLogo: '[data-cy="page-logo"]',
};
export const commonWidgetSelector = {
@ -342,7 +354,7 @@ export const commonWidgetSelector = {
buttonCloseEditorSideBar: "[data-cy='inspector-close-icon']",
buttonStylesEditorSideBar: "#inspector-tab-styles",
WidgetNameInputField: "[data-cy=edit-widget-name]",
constantInspectorIcon: '[data-cy="inspector-node-constants"] > .node-key',
constantInspectorIcon: '[data-cy="inspector-constants-expand-button"]',
inspectorIcon: '[data-cy="left-sidebar-inspect-button"]',
tooltipInputField: "[data-cy='tooltip-input-field']",
tooltipLabel: "[id=button-tooltip]",
@ -395,7 +407,7 @@ export const commonWidgetSelector = {
modalCloseButton: '[data-cy="modal-close-button"]',
iframeLinkLabel: '[data-cy="iframe-link-label"]',
ifameLinkCopyButton: '[data-cy="iframe-link-copy-button"]',
appSlugLabel: '[data-cy="input-field-label"]',
appSlugLabel: '[data-cy="unique-app-slug-field-label"]',
appSlugInput: '[data-cy="app-slug-input-field"]',
appSlugInfoLabel: '[data-cy="helper-text"]',
appLinkLabel: '[data-cy="app-link-label"]',

View file

@ -14,7 +14,7 @@ export const dataSourceSelector = {
dataSourceSearchInputField: '[data-cy="home-page-search-bar"]',
postgresDataSource: "[data-cy='data-source-postgresql']",
dataSourceNameInputField: '[data-cy="data-source-name-input-filed"]',
dataSourceNameInputField: '[data-cy="added-ds-search-bar"]',
labelHost: '[data-cy="label-host"]',
labelPort: '[data-cy="label-port"]',
labelSsl: '[data-cy="label-ssl"]',
@ -28,7 +28,7 @@ export const dataSourceSelector = {
buttonTestConnection: '[data-cy="test-connection-button"]',
connectionFailedText: '[data-cy="test-connection-failed-text"]',
buttonSave: '[data-cy="db-connection-save-button"] > .tj-base-btn',
dangerAlertNotSupportSSL: '.go3958317564',
dangerAlertNotSupportSSL: ".go3958317564",
passwordTextField: '[data-cy="password-text-field"]',
textConnectionVerified: '[data-cy="test-connection-verified-text"]',
@ -97,11 +97,52 @@ export const dataSourceSelector = {
eventQuerySelectionField: '[data-cy="query-selection-field"]',
addedDsSearchIcon: '[data-cy="added-ds-search-icon"]',
AddedDsSearchBar: '[data-cy="added-ds-search-bar"]',
dsNameInputField: '[data-cy="data-source-name-input-filed"]',
dsNameInputField: '[data-cy="data-source-name-input-field"]',
unSavedModalTitle: '[data-cy="unsaved-changes-title"]',
eventQuerySelectionField: '[data-cy="query-selection-field"]',
connectionAlertText: '[data-cy="connection-alert-text"]',
requiredIndicator: '[data-cy="required-indicator"]',
informationIcon: '[data-cy="information-icon"]',
deleteDSButton: (datasourceName) => {
return `[data-cy="${cyParamName(datasourceName)}-delete-button"]`
return `[data-cy="${cyParamName(datasourceName)}-delete-button"]`;
},
labelFieldName: (fieldName) => {
return `[data-cy="${cyParamName(fieldName)}-field-label"]`;
},
dataSourceNameButton: (dataSourceName) => {
return `[data-cy="${cyParamName(dataSourceName)}-button"]`;
},
dropdownLabel: (label) => {
return `[data-cy="${cyParamName(label)}-dropdown-label"]`;
},
textField: (fieldName) => {
return `[data-cy="${cyParamName(fieldName)}-text-field"]`;
},
subSection: (header) => {
return `[data-cy="${cyParamName(header)}-section"]`;
},
toggleInput: (toggleName) => {
return `[data-cy="${cyParamName(toggleName)}-toggle-input"]`;
},
button: (buttonName) => {
return `[data-cy="button-${cyParamName(buttonName)}"]`;
},
keyInputField: (header, index) => {
return `[data-cy="${cyParamName(header)}-key-input-field-${cyParamName(index)}"]`;
},
valueInputField: (header, index) => {
return `[data-cy="${cyParamName(header)}-value-input-field-${cyParamName(index)}"]`;
},
deleteButton: (header, index) => {
return `[data-cy="${cyParamName(header)}-delete-button-${cyParamName(index)}"]`;
},
addMoreButton: (header) => {
return `[data-cy="${cyParamName(header)}-add-button"]`;
},
dropdownField: (fieldName) => {
return `[data-cy="${cyParamName(fieldName)}-select-dropdown"]`;
},
labelFieldValidation: (fieldName) => {
return `[data-cy="${cyParamName(fieldName)}-is-required-validation-label"]`;
},
};

View file

@ -0,0 +1,202 @@
import { cyParamName } from "./common";
export const commonEeSelectors = {
instanceSettingIcon: '[data-cy="instance-settings-option"]',
auditLogIcon: '[data-cy="audit-log-option"]',
cancelButton: '[data-cy="cancel-button"]',
saveButton: '[data-cy="save-button"]',
pageTitle: '[data-cy="dashboard-section-header"]',
modalTitle: '[data-cy="modal-title"]',
modalCloseButton: '[data-cy="modal-close-button"]',
saveButton: '[data-cy="save-button"]',
cardTitle: '[data-cy="card-title"]',
AddQueryButton: '[data-cy="show-ds-popover-button"]',
promoteButton: '[data-cy="promote-button"]',
settingsIcon: '[data-cy="icon-settings"]',
gitSyncIcon: '[data-cy="git-sync-icon"]',
confirmButton: '[data-cy="confirm-button"]',
importFromGit: '[data-cy="import-from-git-button"]',
searchBar: '[data-cy="query-manager-search-bar"]',
nameHeader: '[data-cy="name-header"]',
modalMessage: '[data-cy="modal-message"]',
paginationSection: '[data-cy="pagination-section"]',
};
export const ssoEeSelector = {
oidc: '[data-cy="openid-connect-sso-card"]',
statusLabel: '[data-cy="status-label"]',
oidcToggle: '[data-cy="openid-toggle-input"] > .slider',
oidcPageElements: {
oidcToggleLabel: '[data-cy="openid-toggle-label"]',
nameLabel: '[data-cy="name-label"]',
clientIdLabel: '[data-cy="client-id-label"]',
clientSecretLabel: '[data-cy="client-secret-label"]',
encryptedLabel: '[data-cy="encripted-label"]',
WellKnownUrlLabel: '[data-cy="well-known-url-label"]',
// redirectUrlLabel: '[data-cy="redirect-url-label"]',
},
nameInput: '[data-cy="name-input"]',
clientIdInput: '[data-cy="client-id-input"]',
clientSecretInput: '[data-cy="client-secret-input"]',
WellKnownUrlInput: '[data-cy="well-known-url-input"]',
redirectUrl: '[data-cy="redirect-url"]',
copyIcon: '[data-cy="copy-icon]',
oidcSSOText: '[data-cy="oidc-sso-button-text"]',
oidcSSOIcon: '[data-cy="oidc-so-icon"]',
ldapPageElements: {
ldapToggleLabel: '[data-cy="ldap-toggle-label"]',
nameLabel: '[data-cy="name-label"]',
hostLabel: '[data-cy="host-label"]',
portLabel: '[data-cy="port-label"]',
baseDnLabel: '[data-cy="base-dn-label"]',
baseDnHelperText: '[data-cy="base-dn-helper-text"]',
sslLabel: '[data-cy="ssl-label"]',
},
ldapToggle: '[data-cy="ldap-toggle-input"] > .slider',
hostInput: '[data-cy="host-input"]',
portInput: '[data-cy="port-input"]',
baseDnInput: '[data-cy="base-dn-input"]',
sslToggleInput: '[data-cy="ssl-toggle-input"]',
ldapSSOText: '[data-cy="ldap-sso-button-text"]',
userNameInputLabel: '[data-cy="user-name-input-label"]',
passwordInputLabel: '[data-cy="password-label"]',
passwordInputField: '[data-cy="password-input-field"]',
samlModalElements: {
toggleLabel: '[data-cy="saml-toggle-label"]',
NameLabel: '[data-cy="name-label"]',
metaDataLabel: '[data-cy="idp-metadata-label"]',
baseDNHelperText: '[data-cy="base-dn-helper-text"]',
groupAttributeLabel: '[data-cy="group-attribute-label"]',
groupAttributeHelperText: '[data-cy="group-attribute-helper-text"]',
}
};
export const eeGroupsSelector = {
resourceDs: '[data-cy="resource-datasources"]',
dsCreateCheck: '[data-cy="checkbox-create-ds"]',
dsDeleteCheck: '[data-cy="checkbox-delete-ds"]',
datasourceLink: '[data-cy="datasource-link"]',
dsSearch: '[data-cy="datasource-select-search"]',
AddDsButton: '[data-cy="datasource-add-button"]',
dsNameHeader: '[data-cy="datasource-name-header"]',
};
export const instanceSettingsSelector = {
allUsersTab: '[data-cy="all-users-list-item"]',
manageInstanceSettings: '[data-cy="manage-instance-settings-list-item"]',
typeColumnHeader: '[data-cy="users-table-type-column-header"]',
workspaceColumnHeader: '[data-cy="users-table-workspaces-column-header"]',
userName: (userName) => {
return `[data-cy="${cyParamName(userName)}-user-name"]`;
},
userEmail: (userName) => {
return `[data-cy="${cyParamName(userName)}-user-email"]`;
},
userType: (userName) => {
return `[data-cy="${cyParamName(userName)}-user-type"]`;
},
userStatus: (userName) => {
return `[data-cy="${cyParamName(userName)}-user-status"]`;
},
viewButton: (userName) => {
return `[data-cy="${cyParamName(userName)}-user-view-button"]`;
},
editButton: (userName) => {
return `[data-cy="${cyParamName(userName)}-user-edit-button"]`;
},
viewModalNoColumnHeader: '[data-cy="number-column-header"]',
viewModalNameColumnHeader: '[data-cy="name-column-header"]',
viewModalStatusColumnHeader: '[data-cy="status-column-header"]',
archiveAllButton: '[data-cy="archive-all-button"]',
viewModalRow: (workspaceName) => {
return `[data-cy="${cyParamName(workspaceName)}-workspace-row"]>`;
},
workspaceName: (workspaceName) => {
return `[data-cy="${cyParamName(workspaceName)}-workspace-name"]`;
},
userStatusChangeButton: '[data-cy="user-state-change-button"]',
superAdminToggle: '[data-cy="super-admin-form-check-input"]',
superAdminToggleLabel: '[data-cy="super-admin-form-check-label"]',
allowWorkspaceToggle: '[data-cy="form-check-input"]',
allowWorkspaceToggleLabel: '[data-cy="form-check-label"]',
allowWorkspaceHelperText: '[data-cy="instance-settings-help-text"]',
allWorkspaceTab: '[data-cy="all-workspaces-list-item"]',
};
export const multiEnvSelector = {
envContainer: '[data-cy="env-container"]',
currentEnvName: '[data-cy="list-current-env-name"]',
envArrow: '[data-cy="env-arrow"]',
selectedEnvName: '[data-cy="selected-current-env-name"]',
envNameList: '[data-cy="env-name-list"]',
appVersionLabel: '[data-cy="app-version-label"]',
currentVersion: '[data-cy="current-version"]',
createNewVersionButton: '[data-cy="create-new-version-button"]',
fromLabel: '[data-cy="from-label"]',
toLabel: '[data-cy="to-label"]',
currEnvName: '[data-cy="current-env-name"]',
targetEnvName: '[data-cy="target-env-name"]',
stagingLabel: '[data-cy="staging-label"]',
productionLabel: '[data-cy="production-label"]',
};
export const whiteLabellingSelectors = {
whiteLabelList: '[data-cy="white-labelling-list-item"]',
appLogoLabel: '[data-cy="app-logo-label"]',
appLogoInput: '[data-cy="input-field-app-logo"]',
appLogoHelpText: '[data-cy="app-logo-help-text"]',
pageTitleLabel: '[data-cy="page-title-label"]',
pageTitleInput: '[data-cy="input-field-page-title"]',
pageTitleHelpText: '[data-cy="page-title-help-text"]',
favIconLabel: '[data-cy="fav-icon-label"]',
favIconInput: '[data-cy="input-field-fav-icon"]',
favIconHelpText: '[data-cy="fav-icon-help-text"]',
};
export const gitSyncSelector = {
gitCommitInput: '[data-cy="git-commit-input"]',
commitHelperText: '[data-cy="commit-helper-text"]',
gitRepoInput: '[data-cy="git-repo-input"]',
commitMessageInput: '[data-cy="commit-message-input"]',
lastCommitInput: '[data-cy="las-commit-message"]',
lastCommitVersion: '[data-cy="last-commit-version"]',
autherInfo: '[data-cy="auther-info"]',
commitButton: '[data-cy="commit-button"]',
gitSyncToggleInput: '[data-cy="git-sync-toggle-input"]',
gitSyncApphelperText: '[data-cy="sync-app-helper-text"]',
connectRepoButton: '[data-cy="connect-repo-button"]',
toggleMessage: '[data-cy="toggle-message"]',
sshInput: '[data-cy="git-ssh-input"]',
generateSshButton: '[data-cy="generate-ssh-key-button"',
sshInputHelperText: '[data-cy="git-ssh-input-helper-text"]',
configDeleteButton: '[data-cy="button-config-delete"]',
testConnectionButton: '[data-cy="test-connection-button"]',
sshKey: '[data-cy="ssh-key"]',
deployKeyHelperText: '[data-cy="deploy-key-helper-text"]',
gitRepoLink: '[data-cy="git-repo-link"]',
appNameField: '[data-cy="app-name-field"]',
gitRepoInfo: '[data-cy="git-repo-info"]',
pullButton: '[data-cy="pull-button"]'
}
export const workspaceSelector = {
activelink: '[data-cy="active-link"]',
archivedLik: '[data-cy="archived-link"]',
userStatusChange: '[data-cy="button-user-status-change"]',
workspaceStatusChange: '[data-cy="button-ws-status-change"]',
switchWsModalTitle: '[data-cy="switch-modal-title"]',
switchWsModalMessage: '[data-cy="switch-modal-message"]',
workspaceName: (workspaceName) => {
return `[data-cy="${workspaceName}-workspace-name"]`
},
workspaceInput: (workspaceName) => {
return `[data-cy="${workspaceName}-workspace-input"]`
},
}

View file

@ -6,7 +6,7 @@ export const groupsSelector = {
createNewGroupButton: "[data-cy=create-new-group-button]",
tableHeader: "[data-cy=table-header]",
groupName: "[data-cy=group-name]",
addNewGroupModalTitle: '[data-cy="create-new-group-title"]',
addNewGroupModalTitle: '[data-cy="add-new-group-title"]',
groupNameInput: "[data-cy=group-name-input]",
cancelButton: "[data-cy=cancel-button]",
workspaceVarCreateLabel: '[data-cy="workspace-variable-create-label"]',
@ -40,7 +40,7 @@ export const groupsSelector = {
resourceLabel: '[data-cy="resource-label"]',
allAppsRadio: '[data-cy="all-apps-radio"]',
allAppsLabel: '[data-cy="all-apps-label"]',
allAppsHelperText: '[data-cy="all-apps-info-text"]',
allAppsHelperText: '[data-cy="this-will-select-all-apps-in-the-workspace-including-any-new-apps-created-info-text"]',
customradio: '[data-cy="custom-radio"]',
customLabel: '[data-cy="custom-label"]',
customHelperText: '[data-cy="custom-info-text"]',
@ -133,7 +133,7 @@ export const groupsSelector = {
usersCheckInput: '[data-cy="users-check-input"]',
permissionCheckInput: '[data-cy="permissions-check-input"]',
appsCheckInput: '[data-cy="apps-check-input"]',
confimButton: '[data-cy="confim-button"]',
confimButton: '[data-cy="confirm-button"]',
duplicatedGroupLink: (groupName) => {
return `[data-cy="${cyParamName(groupName)}_copy-list-item"]`
},

View file

@ -1,7 +1,7 @@
export const multipageSelector = {
sidebarPageButton: '[data-cy="left-sidebar-page-button"]',
pagesLabel: '[data-cy="label-pages"]',
addPageIcon: '[title="Add Page"]',
addPageIcon: '[data-cy="add-page-button"]',
searchPageIcon: '[title="Search"]',
pagesPinIcon: '[title="Pin"]',

View file

@ -54,8 +54,8 @@ export const onboardingSelectors = {
basicPlanTitle: '[data-cy="basic-plan-title"]',
planPrice: '[data-cy="plan-price"]',
pricePeriod: '[data-cy="price-period"]',
flexibleTitle: '[data-cy="flexible-title"]',
businessTitle: '[data-cy="business-title"]',
flexibleTitle: '[data-cy="pro-title"]',
businessTitle: '[data-cy="team-title"]',
enterpriseTitle: '[data-cy="enterprise-title"]',
customPricingHeader: '[data-cy="custom-pricing-header"]',
noCreditCardBanner: '[data-cy="no-credit-card-banner"]',

View file

@ -12,7 +12,7 @@ export const postgreSqlSelector = {
dataSourceSearchInputField: '[data-cy="home-page-search-bar"]',
postgresDataSource: "[data-cy='data-source-postgresql']",
dataSourceNameInputField: '[data-cy="data-source-name-input-filed"]',
dataSourceNameInputField: '[data-cy="data-source-name-input-field"]',
labelHost: '[data-cy="label-host"]',
labelPort: '[data-cy="label-port"]',
labelSsl: '[data-cy="label-ssl"]',
@ -87,4 +87,14 @@ export const postgreSqlSelector = {
recordsInputField: '[data-cy="records-input-field"]',
eventQuerySelectionField: '[data-cy="query-selection-field"]',
sslToggleInput: '[data-cy="ssl-enabled-toggle-input"]',
labelEncryptedText: '[data-cy="encrypted-text"]',
};
export const airTableSelector = {
operationSelectDropdown: '[data-cy="operation-select-dropdown"]',
baseIdInputField: '[data-cy="base-id-input-field"]',
tableNameInputField: '[data-cy="table-name-input-field"]',
recordIdInputField: '[data-cy="record-id-input-field"]',
bodyInputField: '[data-cy="body-input-field"]',
};

View file

@ -0,0 +1,44 @@
export const cyParamName = (paramName = "") => {
return String(paramName)
.toLowerCase()
.replace(/\(s\)/g, "")
.replace(/\s+/g, "-");
};
export const restAPISelector = {
accordionHeader: (header) => {
return `[data-cy="widget-accordion-${cyParamName(header)}"]`;
},
subHeaderLabel: (header) => {
return `[data-cy="label-${cyParamName(header)}"]`;
},
subSection: (header) => {
return `[data-cy="${cyParamName(header)}-section"]`;
},
keyInputField: (header, index) => {
return `[data-cy="${cyParamName(header)}-key-input-field-${cyParamName(index)}"]`;
},
valueInputField: (header, index) => {
return `[data-cy="${cyParamName(header)}-value-input-field-${cyParamName(index)}"]`;
},
deleteButton: (header, index) => {
return `[data-cy="${cyParamName(header)}-delete-button-${cyParamName(index)}"]`;
},
addMoreButton: (header) => {
return `[data-cy="${cyParamName(header)}-add-button"]`;
},
dropdownLabel: (label) => {
return `[data-cy="${cyParamName(label)}-dropdown-label"]`;
},
inputField: (fieldName) => {
return `[data-cy="${cyParamName(fieldName)}-input-field"]`;
},
button: (buttonName) => {
return `[data-cy="button-${cyParamName(buttonName)}"]`;
},
authenticationAllUsersToggleSwitch:
'[data-cy="authentication-required-for-all-users-toggle-switch"]',
retryNetworkToggleSwitch: '[data-cy="retry-network-errors-toggle-input"]',
retryNetworkToggleText: '[data-cy="retry-network-errors-toggle-text"]',
retryNetworkToggleSubtext: '[data-cy="retry-network-errors-toggle-subtext"]',
readDocumentationLinkText: '[data-cy="link-read-documentation"]',
};

View file

@ -0,0 +1,7 @@
export const airtableText = {
airtable: "Airtable",
cypressairtable: "cypress-Airtable",
ApiKey: "Personal access token",
apikeyPlaceholder: "**************",
invalidAccessToken: "Authentication failed: Invalid personal access token",
};

View file

@ -0,0 +1,8 @@
export const amazonAthenaText = {
AmazonAthena: "Amazon Athena",
cypressAmazonAthena: "cypress-Amazon Athena",
labelAccesskey: "Access key",
labelSecretKey: "Secret key",
placeholderEnteraAccessKey: "Enter access key",
placeholderSecretKey:"**************",
};

View file

@ -0,0 +1,8 @@
export const amazonSesText = {
AmazonSES: "Amazon SES",
cypressAmazonSES: "cypress-Amazon SES",
labelAccesskey: "Access key",
labelSecretKey: "Secret key",
placeholderAccessKey: "Enter access key",
placeholderSecretKey:"**************",
};

View file

@ -0,0 +1,12 @@
export const appwriteText = {
appwrite: "Appwrite",
cypressAppwrite: "cypress-Appwrite",
host: "Host",
ProjectID: "Project ID",
DatabaseID: "Database ID",
SecretKey: "Secret Key",
SecretKeyPlaceholder: "**************",
hostPlaceholder: "Appwrite database host/endpoint",
projectIdPlaceholder: "Appwrite project id",
databaseIdPlaceholder: "Appwrite Database id",
};

View file

@ -0,0 +1,8 @@
export const awsLambdaText = {
awsLambda: "AWS Lambda",
cypressawsLambda: "cypress-aws-lambda",
labelAccesskey: "Access key",
labelSecretKey: "Secret key",
placeholderAccessKey: "Enter access key",
placeholderSecretKey: "**************",
};

View file

@ -0,0 +1,12 @@
export const awsTextractText = {
awsTextract: "AWS Textract",
cypressawsLambda: "cypress-aws-textract",
labelAccesskey: "Access key",
labelSecretKey: "Secret key",
placeholderAccessKey: "Enter access key",
placeholderSecretKey: "**************",
documentName:
"JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PCAvVHlwZSAvQ2F0YWxvZyAvUGFnZXMgMiAwIFIgPj4KZW5kb2JqCjIgMCBvYmoKPDwgL1R5cGUgL1BhZ2VzIC9LaWRzIFszIDAgUl0gL0NvdW50IDEgPj4KZW5kb2JqCjMgMCBvYmoKPDwgL1R5cGUgL1BhZ2UgL1BhcmVudCAyIDAgUiAvUmVzb3VyY2VzIDw8IC9Gb250IDw8IC9GMSA0IDAgUiA+PiA+PiAvQ29udGVudHMgNSAwIFIgPj4KZW5kb2JqCjQgMCBvYmoKPDwgL1R5cGUgL0ZvbnQgL1N1YnR5cGUgL1R5cGUxIC9CYXNlRm9udCAvSGVsdmV0aWNhLUJvbGQgPj4KZW5kb2JqCjUgMCBvYmoKPDwgL0xlbmd0aCAxMjUgPj4Kc3RyZWFtCkJUIC9GMSAxMiBUZiAxMDAgNzAwIFRkICgoSGVsbG8sIEFtYXpvbiBUZXh0cmFjdCEpIFRqIEVUCmVuZHN0cmVhbQplbmRvYmoKeHJlZgowIDYKMDAwMDAwMDAwMCA2NTUzNSBmIAowMDAwMDAwMDExIDAwMDAwIG4gCjAwMDAwMDAwNTQgMDAwMDAgbgAKMDAwMDAwMDEwMyAwMDAwMCBuIAowMDAwMDAwMTcyIDAwMDAwIG4gCnRyYWlsZXIKPDwgL1NpemUgNiAvUm9vdCAxIDAgUiA+PgpzdGFydHhyZWYKMjIzCiUlRU9G",
bucketName: "reimbursement-receipt-files",
keyName: "reimbursement_receipt_1718364944018.png",
};

View file

@ -0,0 +1,6 @@
export const baseRowText = {
baserow: "baserow",
cypressBaseRow: "cypress-baserow",
lableApiToken: "API token",
placeholderApiToken:"**************",
};

View file

@ -173,7 +173,7 @@ export const commonText = {
// iframeLinkLabel: "Get embeddable link for this application",
// ifameLinkCopyButton: "copy",
},
groupInputFieldLabel: "Select Group",
groupInputFieldLabel: "Select groups",
documentationLink: "Read Documentation",
constantsNameError:
"Constant name should start with a letter or underscore and can only contain letters, numbers and underscores",
@ -181,7 +181,7 @@ export const commonText = {
"Value should be less than 10000 characters and cannot be empty",
createApp: "Create app",
appName: "App Name",
appName: "App name",
enterAppName: "Enter app name",
appNameInfoLabel: "App name must be unique and max 50 characters",
renameApp: "Rename app",

View file

@ -40,7 +40,7 @@ export const dashboardText = {
appClonedToast: "App cloned successfully!",
darkModeText: "Dark Mode",
lightModeText: "Light Mode",
dashboardAppsHeaderLabel: " All apps",
dashboardAppsHeaderLabel: "All apps",
moveAppText: (appName) => {
return `Move "${appName}" to`;

View file

@ -13,7 +13,7 @@ export const dataSourceText = {
? "Databases (20)"
: "Databases (18)";
},
allApis: "APIs (20)",
allApis: "APIs (21)",
allCloudStorage: "Cloud Storages (4)",
pluginsLabelAndCount: "Plugins (0)",
@ -80,4 +80,11 @@ export const dataSourceText = {
labelNoEventhandler: "No event handlers",
toastDSSaved: "Data Source Saved",
unSavedModalTitle: "Unsaved Changes",
sslCertificateLabel: "SSL Certificate",
caCertificateOption: "CA certificate",
clientCertificateOption: "Client certificate",
clientKeyLabel: "Client Key",
clientCertLabel: "Client Cert",
caCertLabel: "CA Cert",
};

View file

@ -0,0 +1,75 @@
export const commonEeText = {
cancelButton: "Cancel",
saveButton: "Save changes",
closeButton: "Close",
defaultWorkspace: "My workspace",
};
export const ssoEeText = {
statusLabel: "Disabled",
enabledLabel: "Enabled",
disabledLabel: "Disabled",
oidcPageElements: {
oidcToggleLabel: "OpenID Connect",
nameLabel: "Name",
clientIdLabel: "Client ID",
clientSecretLabel: "Client secretEncrypted",
encryptedLabel: "Encrypted",
WellKnownUrlLabel: "Well known URL",
// redirectUrlLabel: "Redirect URL",
},
oidcEnabledToast: "Enabled OpenId SSO",
oidcDisabledToast: "Disabled OpenId SSO",
oidcUpdatedToast: "updated SSO configurations",
testName: "Tooljet OIDC",
testclientId: "24567098-mklj8t20za1smb2if.apps.googleusercontent.com",
testclientSecret: "2345-client-id-.apps.googleusercontent.com",
testWellknownUrl: "google.com",
oidcSSOText: "Sign in with Tooljet OIDC",
ldapPageElements: {
ldapToggleLabel: "LDAP",
nameLabel: "Name",
hostLabel: "Host name",
portLabel: "Port",
baseDnLabel: "Base DN",
baseDnHelperText: "Location without UID or CN",
sslLabel: "SSL",
},
ldapSSOText: "Sign in with Tooljet LDAP Auth",
userNameInputLabel: "Username",
samlModalElements: {
toggleLabel: "SAML",
NameLabel: "Name",
metaDataLabel: "Identity provider metadata",
baseDNHelperText:
"Ensure the Identity provider metadata is in XML format. You can download it from your IdP's site",
groupAttributeLabel: "Group attribute",
groupAttributeHelperText:
"Define attribute for user-to-group mapping based on the IdP",
},
};
export const eeGroupsText = {
resourceDs: "Datasources",
AddDsButton: "Add",
dsNameHeader: "Datasource name",
};
export const instanceSettingsText = {
pageTitle: "Settings",
allUsersTab: "All users",
manageInstanceSettings: "Manage instance settings",
typeColumnHeader: "Type",
workspaceColumnHeader: "Workspaces",
superAdminType: "instance",
viewModalTitle: "Workspaces of The Developer",
archiveAllButton: "Archive All",
archiveState: "Archive",
editModalTitle: "Edit user details",
superAdminToggleLabel: "Super admin",
allowWorkspaceToggleLabel: "Allow personal workspace",
allowWorkspaceHelperText:
"This feature will enable users to create their own workspace",
saveButton: "Save",
untitledWorkspace: "Untitled workspace",
};

View file

@ -1,7 +1,7 @@
export const appVersionText = {
createNewVersion: "Create new version",
createVersion: "Create Version",
versionNameLabel: "Version Name",
versionNameLabel: "Version name",
createVersionFromLabel: "Create version from",
emptyToastMessage: "Version name should not be empty",
createdToastMessage: "Version Created",

View file

@ -0,0 +1,6 @@
export const GraphQLText = {
GraphQL: "GraphQL",
cypressGraphQL: "cypress-GraphQL",
urlInputLabel: "URL",
urlInputPlaceholder: "https://api.example.com/v1/graphql",
};

View file

@ -0,0 +1,21 @@
export const harperDbText = {
harperDb: "HarperDB",
cypressHarperDB: "cypressHarperDB",
hostLabel: "Host",
hostInputPlaceholder: "Enter host",
portLabel: "Port",
portPlaceholder: "Enter port",
userNameLabel: "Username",
passwordlabel: "Password",
userNamePlaceholder: "Enter username",
passwordPlaceholder: "**************",
recordsValue: `[{id: 10, name: 'QA', age: 24}]`,
hashValue: "[10]",
attributesValue: "['name']",
searchAttributeValue: "name",
searchValue: "QA",
condtionValue: `[{'search_attribute': 'name', 'search_type': 'between', 'search_value': [1, 5]}, {'search_attribute': 'name', 'search_type': 'equals', 'search_value': 'QA'}]`,
sqlValue: "SELECT * FROM test_schema.test_table",
schemaValue: "test_schema",
tableValue: "test_table",
};

View file

@ -1,10 +1,10 @@
export const groupsText = {
pageTitle: "User Groups",
createNewGroupButton: "Create new group",
createNewGroupButton: "Add new group",
tableHeader: "Name",
allUsers: "All users",
admin: "Admin",
cardTitle: "Create new group",
cardTitle: "Add new group",
cancelButton: "Cancel",
createGroupButton: "Create Group",
groupNameExistToast: "Group name already exist",
@ -52,7 +52,7 @@ export const groupsText = {
editGroupNameButton: "Rename",
deleteGroupButton: "Delete group",
editPermissionModalTitle: "Edit app permissions",
addPermissionModalTitle: "Add app permissions",
addPermissionModalTitle: "Add apps permissions",
appCreateHelperText: 'Create apps in this workspace',
appDeleteHelperText: 'Delete any app in this workspace',
appEditLabelText: 'Edit',
@ -63,7 +63,7 @@ export const groupsText = {
appHideLabel: "Hide from dashboard",
appHideLabelPermissionModal: "Hide from dashbaord",
groupChipText: 'All apps',
adminAccessHelperText: " Admin has edit access to all apps. These are not editableread documentation to know more !",
adminAccessHelperText: " Admin has all permissions. This is not editableread documentation to know more !",
enduserAccessHelperText: " End-user can only have permission to view appsread documentation to know more !",
nameTableHeader: 'Name',
permissionTableHeader: 'Permission',
@ -78,26 +78,26 @@ export const groupsText = {
allAppsLabel: 'All apps',
allAppsHelperText: 'This will select all apps in the workspace including any new apps created',
customLabel: 'Custom',
customHelperText: 'Select specific applications you want to add to the group',
customHelperText: 'Select specific apps you want to add to the group',
updateButtonText: 'Update',
addButtonText: 'Add',
userRole: 'User role',
warningText: "Users must be always be part of one default group. This will define the user count in your plan.",
continueButtonText: "Continue",
roleUpdateToastMessage: "Role updated successfully",
endUserToBuilderMessage: "Updating the user's details will change their role from end-user to builder. Are you sure you want to continue?",
endUserToAdminMessage: "Updating the user's details will change their role from end-user to admin. Are you sure you want to continue?",
builderToEnduserMessage: "This will also remove the user from any custom groups with builder-like permissions.Are you sure you want to continue?",
endUserToBuilderMessage: "Changing the user role from end-user to builder will grant access the user access to all resources.Are you sure you want to continue?",
endUserToAdminMessage: "Changing the user role from end-user to admin will grant the user access to all resources and settings.Are you sure you want to continue?",
builderToEnduserMessage: "Changing the user role from builder to end-user will revoke their access to edit all resources.Are you sure you want to continue?",
builderToAdminMessage: "Changing user role from builder to admin will grant access to all resources and settings.Are you sure you want to continue?",
adminToBuilderMessage: "Changing your user default group from admin to builder will revoke your access to settings.Are you sure you want to continue?",
adminToEnduserMessage: "Changing your user group from admin to end-user will revoke your access to settings.Are you sure you want to continue?",
adminToEnduserMessage: "Changing the user role from admin to end-user will revoke their access to edit all resources and settings.Are you sure you want to continue?",
modalHeader: "Can not remove last active admin",
modalMessage: "Cannot change role of last present admin, please add another admin and change the role",
userAddedToast: "Users added to the group",
changeUserRoleHeader: " Change in user role",
changeUserRoleMessage: "Granting this permission to the user group will result in a role change for the following user(s) from end-users to builders. Are you sure you want to continue?",
cantCreatePermissionModalHeader: "Cannot create permissions",
cantCreatePermissionModalMessage: "Cannot assign builder level permission to end users",
cantCreatePermissionModalMessage: "End-users can only be granted permission to view apps. If you wish to add this permission, kindly change the following users role from end-user to builder",
deletePermissionToast: "Deleted permission successfully",
createPermissionToast: "Permission created successfully!",
userEmptyPageTitle: "No users added yet",

View file

@ -59,4 +59,9 @@ export const ssoText = {
alertText: "Danger zone",
disablePasswordHelperText:
"Disable password login only if your SSO is configured otherwise you will get locked out",
disablePasswordHelperText:
"Disable password login only if your SSO is configured otherwise you will get locked out",
toggleUpdateToast: (toggle) => {
return `Saved ${toggle} SSO configurations`
}
};

View file

@ -7,7 +7,7 @@ export const usersText = {
usersFilterLabel: "Showing",
},
usersPageTitle: "users",
breadcrumbUsersPageTitle: " Users",
breadcrumbUsersPageTitle: "Users",
adminUserName: "The Developer",
adminUserEmail: "dev@tooljet.io",
adminUserState: "Archive",
@ -57,7 +57,7 @@ export const usersText = {
buttonUploadCsvFile: "Upload CSV file",
helperTextBulkUpload:
"Download the ToolJet template to add user details or format your file in the same as the template. ToolJet wont be able to recognise files in any other format. ",
"Download the template to add user details or format your file in the same way as the template. Files in any other format may not be recognized. ",
helperTextSelectFile: "Select a CSV file to upload",
helperTextDropFile: "Or drag and drop it here",
};

View file

@ -0,0 +1,14 @@
export const minioText = {
minio: "Minio",
cypressMinio: "cypressMinio",
hostLabel: "Host",
hostInputPlaceholder: "Enter host",
portLabel: "Port",
portPlaceholder: "Enter port",
labelAccesskey: "Access key",
labelSecretKey: "Secret key",
placeholderAccessKey: "Enter access key",
placeholderSecretKey: "**************",
bucketName: `my-second-bucket`,
objectName: `mybucket`,
};

View file

@ -23,8 +23,8 @@ export const onboardingText = {
endUserPriceText: "$10",
comparePlansText: "Compare plans",
basicPlanText: "Basic Plan",
flexibleText: "Flexible",
businessText: "Business",
flexibleText: "Pro",
businessText: "Team",
enterpriseText: "Enterprise",
customPricingText: "Custom pricing",
noCreditCardText: "No credit card required!",

View file

@ -4,8 +4,8 @@ export const postgreSqlText = {
allDataSources: () => {
return Cypress.env("marketplace_action")
? "All data sources (44)"
: "All data sources (42)";
? "All data sources (45)"
: "All data sources (43)";
},
commonlyUsed: "Commonly used (5)",
allDatabase: () => {
@ -13,17 +13,21 @@ export const postgreSqlText = {
? "Databases (20)"
: "Databases (18)";
},
allApis: "APIs (20)",
allApis: "APIs (21)",
allCloudStorage: "Cloud Storages (4)",
postgreSQL: "PostgreSQL",
labelConnectionType: "Connection type",
manualConnectionOption: "Manual connection",
connectionStringOption: "Connection string",
labelHost: "Host",
labelPort: "Port",
labelSSL: "SSL",
labelDbName: "Database name",
labelUserName: "Username",
labelPassword: "Password",
label: "Encrypted",
labelEncrypted: "Encrypted",
labelConnectionOptions: "Connection options",
sslCertificate: "SSL certificate",
whiteListIpText:
"Please white-list our IP address if the data source is not publicly accessible",
@ -74,6 +78,8 @@ export const postgreSqlText = {
guiOptionBulkUpdate: "Bulk update using primary key",
buttonTextTestConnection: "Test connection",
editButtonText: "Edit",
unableAcquireConnectionAlertText: "Unable to acquire a connection",
tabAdvanced: "Advanced",
labelNoEventhandler: "No event handlers",

View file

@ -2,8 +2,7 @@ export const redisText = {
redis: "Redis",
cypressRedis: "cypress-redis",
errorMaxRetries:
'Reached the max retries per request limit (which is 1). Refer to "maxRetriesPerRequest" option for details.',
errorPort: "Port should be >= 0 and < 65536. Received type number (108299).",
errorInvalidUserOrPassword: "WRONGPASS invalid username-password pair",
errorMaxRetries: "Connection could not be established",
errorPort: "Connection could not be established",
errorInvalidUserOrPassword: "Connection could not be established",
};

View file

@ -0,0 +1,58 @@
export const restAPIText = {
restAPI: "REST API",
credentialsText: "CREDENTIALS",
baseUrlLabel: "Base URL",
headersLabel: "Headers",
urlParametesLabel: "URL parameters",
bodyLabel: "Body",
cookiesLabel: "Cookies",
authenticationText: "AUTHENTICATION",
authenticationTypeLabel: "Authentication type",
noneText: "None",
editButtonText: "Edit",
basicAuth: {
basicText: "Basic",
usernameLabel: "Username",
passwordLabel: "Password",
},
bearerAuth: {
bearerText: "Bearer",
tokenLabel: "Token",
},
oAuthText: "OAuth 2.0",
grantTypeLabel: "Grant type",
authorizationCode: {
authorizationCodeLabel: "Authorization code",
addAccessTokenLabel: "Add access token to",
headerPrefixLabel: "Header prefix",
requestHeader: "Request header",
accessTokenURLLabel: "Access token URL",
accessTokenURLCustomHeadersLabel: "Access token URL custom headers",
clientIDLabel: "Client ID",
clientSecretLabel: "Client secret",
scopeLabel: "Scope(s)",
customQueryParametersLabel: "Custom query parameters",
authorizationURLLabel: "Authorization URL",
customAuthenticationParametersLabel: "Custom authentication parameters",
clientAuthentication: "Client authentication",
sendBasicAuthheaderOption: "Send as basic auth header",
sendClientCredentialsBodyOption: "Send client credentials in body",
authenticationRequiredUsersToggle: "Authentication required for all users",
},
clientCredentials: {
clientCredentialsLabel: "Client credentials",
accessTokenURLLabel: "Access token URL",
accessTokenURLCustomHeadersLabel: "Access token URL custom headers",
clientIDLabel: "Client ID",
clientSecretLabel: "Client secret",
scopeLabel: "Scope(s)",
audiencelabel: "Audience",
},
authenticationHeader: "Authentication",
secureSocketsLayerText: "SECURE SOCKETS LAYER",
generalSettingsText: "GENERAL SETTINGS",
retryNetworkErrorsToggleLabel: "Retry on network errors",
retryToggleHelperText:
"By default, ToolJet tries to hit API endpoint 3 times before declaring query failed as server did not respond",
};

View file

@ -0,0 +1,11 @@
export const twilioText = {
twilio: "Twilio",
cypresstwilio: "cypress-Twilio",
authTokenLabel: "Auth Token",
authTokenPlaceholder: "**************",
accountSidLabel: "Account SID",
accountSidPlaceholder: "Account SID for Twilio",
messagingSIDLabel: "Messaging Service SID",
messagingSIDPalceholder: "Messaging Service SID for Twilio",
messageText: "Sending test message to check twilio",
};

View file

@ -19,9 +19,13 @@ export const deleteVersionText = {
export const onlydeleteVersionText = {
deleteModalText: (text) => {
return `Are you sure you want to delete this version - ${cyParamName(
return `Deleting a version will permanently remove it from all environments.Are you sure you want to delete this version - ${cyParamName(
text
)}?`;
// `Are you sure you want to delete this version - ${cyParamName(
// text
// )}?`;
},
deleteToastMessage: (version) => {
return `Cannot delete only version of app`;

View file

@ -4,7 +4,7 @@ export const workspaceConstantsText = {
secretsConstantInfo: "To resolve a secret workspace constant use {{secrets.access_token}}Read documentation",
emptyStateHeader: "No Workspace constants yet",
emptyStateText:
"Use workspace constants seamlessly in both the app builder and data source connections across ToolJet.",
"Use workspace constants seamlessly within both the app builder and data source connections across the platform.",
addNewConstantButton: "+ Create new constant",
addConstatntText: "Add new constant in production ",
constantCreatedToast: (type) => { return `${type} constant created successfully!` },

View file

@ -0,0 +1,29 @@
import { fake } from "Fixtures/fake";
import { addAndVerifyOnSingleLine } from "Support/utils/editor/codehinter";
import { commonSelectors, commonWidgetSelector } from "Selectors/common";
import {
openEditorSidebar,
} from "Support/utils/commonWidget";
describe("Editor- CodeHinter", () => {
let currentVersion = "";
let newVersion = [];
let versionFrom = "";
beforeEach(() => {
cy.apiLogin();
cy.apiCreateApp(`${fake.companyName}-inspector-App`);
cy.apiOpenApp();
});
it.only("should verify singleLine: non dynamic values", () => {
cy.dragAndDropWidget("Text", 500, 500);
addAndVerifyOnSingleLine(`{{globals.currentUser.email}} {{globals.currentUser.firstName}} {{globals.currentUser.lastName}} {{globals.currentUser.id}} {{globals.currentUser.avatarId}} {{globals.currentUser.groups[0]}} {{globals.currentUser.groups[1]}} {{globals.currentUser.groups[2]}} {{globals.currentUser.role}} {{globals.currentUser.ssoUserInfo}} {{globals.environment.id}} {{globals.environment.name}} {{globals.mode.value}} {{globals.theme.name}} {{globals.urlparams}} {{page.handle}} {{page.id}} {{page.name}}`)
cy.get('[data-cy=draggable-widget-text1]:eq(0)').invoke('text').then((text => { cy.log(text) }))
});
it("should verify singleLine: dynamic values", () => {
});
it("should verify multiLine: non dynamic values", () => {
});
it("should verify multiLine: dynamic values", () => {
});
});

View file

@ -0,0 +1,235 @@
import { fake } from "Fixtures/fake";
import { addAndVerifyOnSingleLine } from "Support/utils/editor/codehinter";
import { commonSelectors, commonWidgetSelector } from "Selectors/common";
import {
openEditorSidebar,
} from "Support/utils/commonWidget";
describe.only('Tooljet Resolution Cases', () => {
beforeEach(() => {
cy.apiLogin();
cy.apiCreateApp(`${fake.companyName}-inspector-App`);
cy.openApp();
});
it.only('Basic Component and Query Value Access', () => {
cy.dragAndDropWidget("Text Input", 100, 200);
cy.dragAndDropWidget("Text", 100, 100);
addAndVerifyOnSingleLine('{{components.textinput1.value}}');
cy.get(commonWidgetSelector.draggableWidget("textinput1")).type("Hello World");
cy.get(commonWidgetSelector.draggableWidget("text1")).should('have.text', 'Hello World');
cy.pause()
// Example 2
// cy.dragAndDropWidget('Table', 100, 300);
// addAndVerifyOnSingleLine('{{queries.user.data}}', 'data');
// // Example 3
// cy.dragAndDropWidget('Text', 200, 100);
// addAndVerifyOnSingleLine('{{queries.name.data.hello}}');
// // Example 4
// cy.dragAndDropWidget('Text', 300, 100);
// addAndVerifyOnSingleLine('{{queries.products[components.dropdown1.value]?.details.price}}');
// Example 5
cy.dragAndDropWidget('Text', 400, 100);
addAndVerifyOnSingleLine('{{globals.currentUser.email}}');
cy.get(commonWidgetSelector.draggableWidget("text2")).should('have.text', 'dev@tooljet.io');
// Example 6
cy.dragAndDropWidget('Text', 500, 100);
addAndVerifyOnSingleLine('{{page.variables.pageTitle}}');
// Example 7
cy.dragAndDropWidget('variables.userId');
addAndVerifyOnSingleLine('{{variables.userId}}');
// Example 8
cy.dragAndDropWidget('queries.localeHelper.data.PRFieldHint');
addAndVerifyOnSingleLine('{{queries.localeHelper.data.PRFieldHint}}');
// Example 9
cy.dragAndDropWidget('queries.8256e53e-061f-4108-8ab5-d9a0db607e8f.data.countryFieldHint');
addAndVerifyOnSingleLine('{{queries.8256e53e-061f-4108-8ab5-d9a0db607e8f.data.countryFieldHint}}');
// Example 10
cy.dragAndDropWidget('page.otherProperty.someValue');
addAndVerifyOnSingleLine('{{page.otherProperty.someValue}}');
});
it('Dynamic Access Using Brackets', () => {
// Example 1
cy.dragAndDropWidget('components[components.text1.data].value');
addAndVerifyOnSingleLine('{{components[components.text1.data].value}}');
// Example 2
cy.dragAndDropWidget('queries[ ${components.dropdown1.value}].data.users');
addAndVerifyOnSingleLine('{{queries[ ${components.dropdown1.value}].data.users}}');
// Example 3
cy.dragAndDropWidget('queries["components.dropdown.value"]?.data');
addAndVerifyOnSingleLine('{{queries["components.dropdown.value"]?.data}}');
// Example 4
cy.dragAndDropWidget('components[queries.products.data].value');
addAndVerifyOnSingleLine('{{components[queries.products.data].value}}');
// Example 5
cy.dragAndDropWidget('queries[queries.user.data.fieldKey]?.data');
addAndVerifyOnSingleLine('{{queries[queries.user.data.fieldKey]?.data}}');
});
it('Logical Operators and Conditionals', () => {
// Example 1
cy.dragAndDropWidget('components.text1.value || queries.user.data');
addAndVerifyOnSingleLine('{{components.text1.value || queries.user.data}}');
// Example 2
cy.dragAndDropWidget('queries.currency.data?.currency || globals.defaultCurrency');
addAndVerifyOnSingleLine('{{queries.currency.data?.currency || globals.defaultCurrency}}');
// Example 3
cy.dragAndDropWidget('components.text1.value ? components.text1.value + " - active" : "Inactive"');
addAndVerifyOnSingleLine('{{components.text1.value ? components.text1.value + " - active" : "Inactive"}}');
// Example 4
cy.dragAndDropWidget('(components.numberinput1.value || 0).toFixed(2).toString().padStart(8, "0")');
addAndVerifyOnSingleLine('{{(components.numberinput1.value || 0).toFixed(2).toString().padStart(8, "0")}}');
});
it('String Manipulation', () => {
// Example 1
cy.dragAndDropWidget('components.text1.value.toUpperCase()');
addAndVerifyOnSingleLine('{{components.text1.value.toUpperCase()}}');
// Example 2
cy.dragAndDropWidget('variables.userId.substring(0, 5)');
addAndVerifyOnSingleLine('{{variables.userId.substring(0, 5)}}');
// Example 3
cy.dragAndDropWidget('Hello {{components.text1.value}}');
addAndVerifyOnSingleLine('Hello {{components.text1.value}}');
// Example 4
cy.dragAndDropWidget('Hello {{components.text1.value + "!"}}');
addAndVerifyOnSingleLine('Hello {{components.text1.value + "!"}}');
// Example 5
cy.dragAndDropWidget('components.text1.data?.toString() || "default"');
addAndVerifyOnSingleLine('{{components.text1.data?.toString() || "default"}}');
// Example 6
cy.dragAndDropWidget('components.text1.value + " " + components.text2.value');
addAndVerifyOnSingleLine('{{components.text1.value + " " + components.text2.value}}');
// Example 7
cy.dragAndDropWidget('"Real time Range 1 : <b>" + components.rangeslider2.value[0] + "</b>"');
addAndVerifyOnSingleLine('{{"Real time Range 1 : <b>" + components.rangeslider2.value[0] + "</b>"}}');
});
it('Arrays and Iterations', () => {
// Example 1
cy.dragAndDropWidget('queries.orders.data.map(order => order.id).join(", ")');
addAndVerifyOnSingleLine('{{queries.orders.data.map(order => order.id).join(", ")}}');
// Example 2
cy.dragAndDropWidget('Array.from({length: queries?.tooljetdbGetProducts?.data?.filter(product => product.id == components.dropdown1.value)[0]?.quantity ?? 0}, (_, i) => i + 1)');
addAndVerifyOnSingleLine('{{Array.from({length: queries?.tooljetdbGetProducts?.data?.filter(product => product.id == components.dropdown1.value)[0]?.quantity ?? 0}, (_, i) => i + 1)}}');
// Example 3
cy.dragAndDropWidget('queries.user?.data?.filter(item => item.id === components.selected.value)');
addAndVerifyOnSingleLine('{{queries.user?.data?.filter(item => item.id === components.selected.value)}}');
// Example 4
cy.dragAndDropWidget('queries.products.data.find(p => p.id === variables.productId)?.name || "Unknown"');
addAndVerifyOnSingleLine('{{queries.products.data.find(p => p.id === variables.productId)?.name || "Unknown"}}');
// Example 5
cy.dragAndDropWidget('queries.data.items.filter(item => item.active).length');
addAndVerifyOnSingleLine('{{queries.data.items.filter(item => item.active).length}}');
});
it('Numeric Operations', () => {
// Example 1
cy.dragAndDropWidget('10 * (components.pagination1.currentPageIndex - 1)');
addAndVerifyOnSingleLine('{{10 * (components.pagination1.currentPageIndex - 1)}}');
// Example 2
cy.dragAndDropWidget('components?.pagination1?.currentPageIndex + 1');
addAndVerifyOnSingleLine('{{components?.pagination1?.currentPageIndex + 1}}');
});
it('Nested Property Access', () => {
// Example 1
cy.dragAndDropWidget('queries.user[components.text1.data].extra.field');
addAndVerifyOnSingleLine('{{queries.user[components.text1.data].extra.field}}');
// Example 2
cy.dragAndDropWidget('queries.user[components.button1.data].extra.field');
addAndVerifyOnSingleLine('{{queries.user[components.button1.data].extra.field}}');
// Example 3
cy.dragAndDropWidget('queries.user.data[0]');
addAndVerifyOnSingleLine('{{queries.user.data[0]}}');
// Example 4
cy.dragAndDropWidget('components.text1.data');
addAndVerifyOnSingleLine('{{components.text1.data}}');
});
it('Complex Template Strings', () => {
// Example 1
cy.dragAndDropWidget('Hello {{components.text1.value}} {{variables.userId}} {{globals.apiKey}}');
addAndVerifyOnSingleLine('Hello {{components.text1.value}} {{variables.userId}} {{globals.apiKey}}');
// Example 2
cy.dragAndDropWidget('page.variables.pageTitle');
addAndVerifyOnSingleLine('{{page.variables.pageTitle}}');
// Example 3
cy.dragAndDropWidget('components.text1.value + variables.userId + globals.apiKey + page.variables.pageTitle');
addAndVerifyOnSingleLine('{{components.text1.value + variables.userId + globals.apiKey + page.variables.pageTitle}}');
});
it('Nullable/Optional Chaining', () => {
// Example 1
cy.dragAndDropWidget('components?.text1?.value');
addAndVerifyOnSingleLine('{{components?.text1?.value}}');
// Example 2
cy.dragAndDropWidget('components?.text1["value"]');
addAndVerifyOnSingleLine('{{components?.text1["value"]}}');
// Example 3
cy.dragAndDropWidget('queries["user"]?.data');
addAndVerifyOnSingleLine('{{queries["user"]?.data}}');
// Example 4
cy.dragAndDropWidget('queries?.tooljetdbGetProducts?.data?.filter');
addAndVerifyOnSingleLine('{{queries?.tooljetdbGetProducts?.data?.filter}}');
});
it('Need to be Verified', () => {
// Example 1
cy.dragAndDropWidget('components[queries.user.data[0]].value');
addAndVerifyOnSingleLine('{{components[queries.user.data[0]].value}}');
// Example 2
cy.dragAndDropWidget('queries.products.data.find(p => p.id === variables.productId)?.name || "Unknown"');
addAndVerifyOnSingleLine('{{queries.products.data.find(p => p.id === variables.productId)?.name || "Unknown"}}');
// Example 3
cy.dragAndDropWidget('queries[ ${components.dropdown1.value}_${components.dropdown2.value}]?.data');
addAndVerifyOnSingleLine('{{queries[ ${components.dropdown1.value}_${components.dropdown2.value}]?.data}}');
// Example 4
cy.dragAndDropWidget('Array.from({length: queries?.tooljetdbGetProducts?.data?.filter(product => product.id == components.dropdown1.value)[0]?.quantity ?? 0}, (_, i) => i + 1)');
addAndVerifyOnSingleLine('{{Array.from({length: queries?.tooljetdbGetProducts?.data?.filter(product => product.id == components.dropdown1.value)[0]?.quantity ?? 0}, (_, i) => i + 1)}}');
// Example 5
cy.dragAndDropWidget('queries["components.dropdown.value"]?.data');
addAndVerifyOnSingleLine('{{queries["components.dropdown.value"]?.data}}');
});
});

View file

@ -32,7 +32,7 @@ import {
addSupportCSAData,
} from "Support/utils/events";
describe("Editor- Test Button widget", () => {
describe("Editor- Test Button widget ", () => {
beforeEach(() => {
cy.apiLogin();
cy.apiCreateApp(`${fake.companyName}-button-App`);

View file

@ -0,0 +1,429 @@
import { multiselectSelector } from "Selectors/multiselect";
import { multiselectText } from "Texts/multiselect";
import {
commonText,
commonWidgetText,
codeMirrorInputLabel,
} from "Texts/common";
import { commonSelectors, commonWidgetSelector } from "Selectors/common";
import { fake } from "Fixtures/fake";
import {
verifyMultiselectHeader,
selectFromMultiSelect,
verifyMultiselectStatus,
verifyMultiselectOptions,
} from "Support/utils/multiselectWidget";
import {
openAccordion,
verifyAndModifyParameter,
openEditorSidebar,
verifyAndModifyToggleFx,
addDefaultEventHandler,
addAndVerifyTooltip,
editAndVerifyWidgetName,
verifyMultipleComponentValuesFromInspector,
selectColourFromColourPicker,
fillBoxShadowParams,
verifyBoxShadowCss,
verifyAndModifyStylePickerFx,
addTextWidgetToVerifyValue,
verifyTooltip,
verifyWidgetText,
} from "Support/utils/commonWidget";
import {
selectCSA,
selectEvent,
addSupportCSAData,
} from "Support/utils/events";
describe("Multiselect widget", () => {
beforeEach(() => {
cy.apiLogin();
cy.apiCreateApp(`${fake.companyName}-Multiselect-App`);
cy.openApp();
cy.dragAndDropWidget(multiselectText.multiselect);
});
afterEach(() => {
cy.apiDeleteApp();
});
it("should verify the properties of the widget", () => {
const data = {};
data.widgetName = fake.widgetName;
data.label = fake.widgetName;
data.customMessage = fake.randomSentence;
data.alertMessage = fake.randomSentence;
data.randomLabels = multiselectSelector.textArrayOfLength(3);
openEditorSidebar(multiselectText.defaultWidgetName);
editAndVerifyWidgetName(data.widgetName);
openAccordion(commonWidgetText.accordionProperties, [
"Events",
"Properties",
"General",
]);
verifyAndModifyParameter(commonWidgetText.parameterLabel, data.label);
cy.get(commonWidgetSelector.buttonCloseEditorSideBar).click({
force: true,
});
cy.get(multiselectSelector.multiselectLabel(data.widgetName)).should(
"have.text",
data.label
);
openEditorSidebar(data.widgetName);
verifyAndModifyParameter(
commonWidgetText.labelDefaultValue,
codeMirrorInputLabel("[1,2,3]")
);
cy.get(commonWidgetSelector.buttonCloseEditorSideBar).click({
force: true,
});
verifyMultiselectHeader(
data.widgetName,
multiselectText.labelAllItemsSelected
);
verifyMultipleComponentValuesFromInspector(data.widgetName, [1, 2, 3]);
openEditorSidebar(data.widgetName);
verifyAndModifyParameter(
commonWidgetText.labelDefaultValue,
codeMirrorInputLabel("[1,2]")
);
verifyMultipleComponentValuesFromInspector(data.widgetName, [1, 2]);
verifyMultiselectHeader(data.widgetName, "one, two");
verifyMultiselectStatus(data.widgetName);
verifyMultiselectOptions(data.widgetName);
selectFromMultiSelect(data.widgetName, ["", "", "true"]);
verifyMultiselectStatus(data.widgetName, ["", "", ""]);
verifyMultiselectHeader(
data.widgetName,
multiselectText.labelAllItemsSelected
);
verifyMultipleComponentValuesFromInspector(data.widgetName, [1, 2, 3]);
openEditorSidebar(data.widgetName);
verifyAndModifyParameter(
commonWidgetText.parameterOptionvalues,
codeMirrorInputLabel(`[${data.randomLabels}]`)
);
selectFromMultiSelect(data.widgetName, ["true", "true", "true"]);
verifyMultipleComponentValuesFromInspector(
data.widgetName,
data.randomLabels
);
openEditorSidebar(data.widgetName);
data.randomLabels = multiselectSelector.textArrayOfLength(3);
verifyAndModifyParameter(
commonWidgetText.parameterOptionLabels,
codeMirrorInputLabel(`[${data.randomLabels}]`)
);
verifyMultiselectOptions(data.widgetName, data.randomLabels);
openEditorSidebar(data.widgetName);
verifyAndModifyToggleFx(multiselectText.enableSelectAllOptions);
cy.get(commonWidgetSelector.draggableWidget(data.widgetName))
.find(multiselectSelector.multiselectHeader)
.click();
cy.get(multiselectSelector.dropdownAllItems)
.first()
.should("have.text", multiselectText.dropdwonOptionSelectAll)
.realClick();
verifyMultiselectHeader(
data.widgetName,
multiselectText.labelAllItemsSelected
);
openEditorSidebar(data.widgetName);
openAccordion(commonWidgetText.accordionEvents);
cy.get(commonWidgetSelector.noEventHandlerMessage).should(
"have.text",
multiselectText.noEventsMessage
);
addDefaultEventHandler(data.alertMessage);
cy.get(commonWidgetSelector.buttonCloseEditorSideBar).click({
force: true,
});
selectFromMultiSelect(data.widgetName, ["", "", "true"]);
cy.verifyToastMessage(commonSelectors.toastMessage, data.alertMessage);
openEditorSidebar(data.widgetName);
openAccordion(commonWidgetText.accordionGenaral);
addAndVerifyTooltip(
commonWidgetSelector.draggableWidget(data.widgetName),
fake.randomSentence
);
openEditorSidebar(data.widgetName);
openAccordion(commonWidgetText.accordionLayout);
verifyAndModifyToggleFx(
commonWidgetText.parameterShowOnDesktop,
commonWidgetText.codeMirrorLabelTrue
);
cy.get(commonWidgetSelector.draggableWidget(data.widgetName)).should(
"not.exist"
);
// verifyAndModifyToggleFx(
// commonWidgetText.parameterShowOnMobile,
// commonWidgetText.codeMirrorLabelFalse
// );
// cy.get(commonWidgetSelector.changeLayoutButton).click();
// cy.get(commonWidgetSelector.draggableWidget(data.widgetName)).should(
// "exist"
// );
});
it("should verify the styles of the widget", () => {
const data = {};
data.colour = fake.randomRgba;
data.boxShadowParam = fake.boxShadowParam;
openEditorSidebar(multiselectText.defaultWidgetName);
cy.get(commonWidgetSelector.buttonStylesEditorSideBar).click();
verifyAndModifyToggleFx(
commonWidgetText.parameterVisibility,
commonWidgetText.codeMirrorLabelTrue
);
cy.get(
commonWidgetSelector.draggableWidget(multiselectText.defaultWidgetName)
).should("not.be.visible");
cy.get(
commonWidgetSelector.parameterTogglebutton(
commonWidgetText.parameterVisibility
)
).click();
verifyAndModifyToggleFx(
commonWidgetText.parameterDisable,
commonWidgetText.codeMirrorLabelFalse
);
cy.waitForAutoSave();
cy.get(
commonWidgetSelector.draggableWidget(multiselectText.defaultWidgetName)
)
.find(multiselectSelector.dropdownContainer)
.should("have.attr", "aria-disabled", "true");
verifyAndModifyParameter(
commonWidgetText.parameterBorderRadius,
commonWidgetText.borderRadiusInput
);
cy.get(commonWidgetSelector.buttonCloseEditorSideBar).click({
force: true,
});
cy.get(
commonWidgetSelector.draggableWidget(multiselectText.defaultWidgetName)
)
.children(".h-100")
.should("have.css", "border-radius", "20px");
openEditorSidebar(multiselectText.defaultWidgetName);
cy.get(commonWidgetSelector.buttonStylesEditorSideBar).click();
openAccordion(commonWidgetText.accordionGenaral, [], 1);
verifyAndModifyStylePickerFx(
commonWidgetText.parameterBoxShadow,
commonWidgetText.boxShadowDefaultValue,
commonWidgetText.boxShadowFxValue,
0,
"0px 0px 0px 0px "
);
cy.get(
commonWidgetSelector.parameterFxButton(
commonWidgetText.parameterBoxShadow
)
).click();
cy.get(
commonWidgetSelector.stylePicker(commonWidgetText.parameterBoxShadow)
).click();
fillBoxShadowParams(
commonWidgetSelector.boxShadowDefaultParam,
data.boxShadowParam
);
selectColourFromColourPicker(commonWidgetText.boxShadowColor, data.colour);
verifyBoxShadowCss(
`${commonWidgetSelector.draggableWidget(
multiselectText.defaultWidgetName
)}>.col`,
data.colour,
data.boxShadowParam,
"child"
);
});
it("should verify widget in preview", () => {
const data = {};
data.widgetName = fake.widgetName;
data.label = fake.widgetName;
data.customMessage = fake.randomSentence;
data.alertMessage = fake.randomSentence;
data.colour = fake.randomRgba;
data.boxShadowParam = fake.boxShadowParam;
data.randomLabels = multiselectSelector.textArrayOfLength(3);
data.randomValues = multiselectSelector.textArrayOfLength(3);
openEditorSidebar(multiselectText.defaultWidgetName);
editAndVerifyWidgetName(data.widgetName);
verifyAndModifyParameter(commonWidgetText.parameterLabel, data.label);
verifyAndModifyParameter(
commonWidgetText.labelDefaultValue,
codeMirrorInputLabel(`[${data.randomValues[0]}]`)
);
verifyAndModifyToggleFx(multiselectText.enableSelectAllOptions);
verifyAndModifyParameter(
commonWidgetText.parameterOptionvalues,
codeMirrorInputLabel(`[${data.randomValues}]`)
);
openAccordion(commonWidgetText.accordionEvents);
addDefaultEventHandler(data.alertMessage);
openAccordion(commonWidgetText.accordionGenaral);
addAndVerifyTooltip(
commonWidgetSelector.draggableWidget(data.widgetName),
data.customMessage
);
openEditorSidebar(data.widgetName);
cy.get(commonWidgetSelector.buttonStylesEditorSideBar).click();
openAccordion(commonWidgetText.accordionGenaral, [], 1);
cy.get(
commonWidgetSelector.stylePicker(commonWidgetText.parameterBoxShadow)
).click();
fillBoxShadowParams(
commonWidgetSelector.boxShadowDefaultParam,
data.boxShadowParam
);
selectColourFromColourPicker(commonWidgetText.boxShadowColor, data.colour);
verifyAndModifyParameter(
commonWidgetText.parameterBorderRadius,
commonWidgetText.borderRadiusInput
);
addTextWidgetToVerifyValue(`components.${data.widgetName}.values`);
cy.openInCurrentTab(commonWidgetSelector.previewButton);
cy.get(multiselectSelector.multiselectLabel(data.widgetName)).should(
"have.text",
`${data.label}`
);
verifyMultiselectOptions(data.widgetName, [
"Select All",
"one",
"two",
"three",
]);
verifyWidgetText(
commonWidgetText.text1,
`${data.randomValues[0].replaceAll('"', "")}`
);
selectFromMultiSelect(data.widgetName, ["", "", "true"]);
cy.verifyToastMessage(commonSelectors.toastMessage, data.alertMessage);
verifyWidgetText(
commonWidgetText.text1,
`${data.randomValues.slice(0, 2)}`.replaceAll('"', "")
);
selectFromMultiSelect(data.widgetName, ["true"]);
verifyWidgetText(
commonWidgetText.text1,
`${data.randomValues}`.replaceAll('"', "")
);
verifyMultiselectHeader(
data.widgetName,
multiselectText.labelAllItemsSelected
);
verifyTooltip(
commonWidgetSelector.draggableWidget(data.widgetName),
data.customMessage
);
cy.get(commonWidgetSelector.draggableWidget(data.widgetName))
.children(".h-100")
.should("have.css", "border-radius", "20px");
verifyBoxShadowCss(
`${commonWidgetSelector.draggableWidget(data.widgetName)}>.col`,
data.colour,
data.boxShadowParam,
"child"
);
});
it("should verify CSA", () => {
cy.get('[data-cy="real-canvas"]').click("topRight", { force: true });
cy.dragAndDropWidget("Number input", 600, 50);
selectEvent("On change", "Control Component");
selectCSA("multiselect1", "Select Option", "1000");
cy.get('[data-cy="action-label"]').click({ force: true });
cy.wait(2000);
addSupportCSAData("Option", "{{components.numberinput1.value");
// cy.get('[data-cy="-input-field"]')
// .eq(1)
// .type(`{selectAll}{backspace}1000{enter}`);
cy.get('[data-cy="real-canvas"]').click("topRight", { force: true });
cy.dragAndDropWidget("Number input", 600, 150);
selectEvent("On change", "Control Component");
selectCSA("multiselect1", "Deselect Option", "1000");
cy.wait(2000);
cy.get('[data-cy="action-label"]').click({ force: true });
cy.wait(2000);
addSupportCSAData("Option", "{{components.numberinput2.value");
// cy.get('[data-cy="-input-field"]')
// .eq(1)
// .type(`{selectAll}{backspace}1000{enter}`);
cy.get('[data-cy="real-canvas"]').click("topRight", { force: true });
cy.dragAndDropWidget("Button", 600, 250);
selectEvent("On click", "Control Component");
selectCSA("Multiselect1", "Clear selections");
cy.get('[data-cy="real-canvas"]').click("topRight", { force: true });
cy.waitForAutoSave();
cy.reload();
cy.wait(3000);
verifyMultipleComponentValuesFromInspector("multiselect1", [2, 3]);
cy.get(commonWidgetSelector.draggableWidget("numberinput1"))
.clear()
.type("1");
cy.forceClickOnCanvas();
cy.wait(1000);
verifyMultiselectHeader(
"multiselect1",
multiselectText.labelAllItemsSelected
);
cy.get(commonWidgetSelector.draggableWidget("numberinput2"))
.clear()
.type("3");
cy.forceClickOnCanvas();
cy.wait(1000);
verifyMultipleComponentValuesFromInspector("multiselect1", [2, 1]);
cy.get(commonWidgetSelector.draggableWidget("button1")).click();
verifyMultiselectHeader("multiselect1", "Select...");
});
});

View file

@ -0,0 +1,367 @@
import { fake } from "Fixtures/fake";
import { commonSelectors, commonWidgetSelector } from "Selectors/common";
import {
addDefaultEventHandler,
checkPaddingOfContainer,
closeAccordions,
editAndVerifyWidgetName,
openAccordion,
openEditorSidebar,
randomNumber,
selectColourFromColourPicker,
verifyAndModifyParameter,
verifyBoxShadowCss,
verifyComponentValueFromInspector,
verifyContainerElements,
verifyLayout,
verifyStylesGeneralAccordion,
verifyTooltip,
verifyWidgetColorCss,
} from "Support/utils/commonWidget";
import {
addAllInputFieldColors,
addAndVerifyAdditionalActions,
addCustomWidthOfLabel,
addValidations,
verifyAlignment,
verifyCustomWidthOfLabel,
verifyInputFieldColors,
verifyLabelStyleElements,
} from "Support/utils/editor/inputFieldUtils";
import {
addCSA,
randomString,
verifyCSA,
} from "Support/utils/editor/textInput";
import { commonWidgetText } from "Texts/common";
import { textInputText } from "Texts/textInput";
describe("Text Input", () => {
beforeEach(() => {
cy.apiLogin();
cy.apiCreateApp(`${fake.companyName}-Textinput-App`);
cy.openApp();
cy.dragAndDropWidget("Text Input", 500, 500);
});
afterEach(() => {
cy.apiDeleteApp();
});
it("should verify the properties of the text input widget", () => {
const data = {};
data.widgetName = fake.widgetName;
data.tooltipText = fake.randomSentence;
data.minimumLength = randomNumber(1, 4);
data.maximumLength = randomNumber(8, 10);
data.customText = randomString(12);
openEditorSidebar(textInputText.defaultWidgetName);
closeAccordions([
"Data",
"Validation",
"Additional Actions",
"Devices",
"Events",
]);
editAndVerifyWidgetName(data.widgetName, [
"Data",
"Validation",
"Additional Actions",
"Devices",
"Events",
]);
openAccordion("Data", [
"Data",
"Validation",
"Additional Actions",
"Devices",
"Events",
]);
verifyAndModifyParameter(
commonWidgetText.labelDefaultValue,
data.customText
);
cy.forceClickOnCanvas();
cy.get(
commonWidgetSelector.draggableWidget(data.widgetName)
).verifyVisibleElement("have.value", data.customText);
verifyComponentValueFromInspector(data.widgetName, data.customText);
cy.forceClickOnCanvas();
cy.get(commonWidgetSelector.draggableWidget(data.widgetName)).clear();
data.customText = fake.randomSentence;
openEditorSidebar(data.widgetName);
openAccordion("Data", [
"Data",
"Validation",
"Additional Actions",
"Devices",
"Events",
]);
verifyAndModifyParameter(
commonWidgetText.labelPlaceHolder,
data.customText
);
cy.forceClickOnCanvas();
cy.get(commonWidgetSelector.draggableWidget(data.widgetName))
.invoke("attr", "placeholder")
.should("contain", data.customText);
openEditorSidebar(data.widgetName);
openAccordion(commonWidgetText.accordionEvents, ["Validation", "Devices"]);
addDefaultEventHandler(data.customText);
cy.wait(1000);
cy.get(commonWidgetSelector.eventSelection).type("On Enter Pressed{Enter}");
cy.wait("@events");
cy.clearAndType(
commonWidgetSelector.draggableWidget(data.widgetName),
`${data.customText}{Enter}`
);
cy.verifyToastMessage(commonSelectors.toastMessage, data.customText);
cy.forceClickOnCanvas();
cy.get(commonWidgetSelector.draggableWidget(data.widgetName)).clear();
addValidations(data.widgetName, data);
cy.clearAndType(
commonWidgetSelector.draggableWidget(data.widgetName),
data.customText
);
cy.forceClickOnCanvas();
cy.get(
commonWidgetSelector.validationFeedbackMessage(data.widgetName)
).verifyVisibleElement("have.text", commonWidgetText.regexValidationError);
cy.get(commonWidgetSelector.draggableWidget(data.widgetName)).clear();
cy.get(
commonWidgetSelector.parameterInputField(commonWidgetText.labelRegex)
).clearCodeMirror();
cy.forceClickOnCanvas();
cy.get(
commonWidgetSelector.validationFeedbackMessage(data.widgetName)
).verifyVisibleElement(
"have.text",
commonWidgetText.minLengthValidationError(data.minimumLength)
);
cy.get(commonWidgetSelector.draggableWidget(data.widgetName)).clear();
cy.get(
commonWidgetSelector.parameterInputField(commonWidgetText.labelMinLength)
).clearAndTypeOnCodeMirror("0");
cy.forceClickOnCanvas();
cy.clearAndType(
commonWidgetSelector.draggableWidget(data.widgetName),
data.customText.toUpperCase().replaceAll(" ", "").replaceAll(".", "")
);
cy.get(
commonWidgetSelector.validationFeedbackMessage(data.widgetName)
).verifyVisibleElement(
"have.text",
commonWidgetText.maxLengthValidationError(data.maximumLength)
);
cy.forceClickOnCanvas();
cy.get(commonWidgetSelector.draggableWidget(data.widgetName)).clear();
cy.get(
commonWidgetSelector.validationFeedbackMessage(data.widgetName)
).verifyVisibleElement("have.text", data.customText);
cy.forceClickOnCanvas();
openEditorSidebar(data.widgetName);
cy.get(
commonWidgetSelector.accordion(commonWidgetText.accordionValidation)
).click();
addAndVerifyAdditionalActions(data.widgetName, data.tooltipText);
openEditorSidebar(data.widgetName);
cy.get(
commonWidgetSelector.accordion(commonWidgetText.accordionValidation)
).click();
verifyLayout(data.widgetName, "Devices");
cy.get(commonWidgetSelector.changeLayoutToDesktopButton).click();
cy.get(
commonWidgetSelector.parameterTogglebutton(
commonWidgetText.parameterShowOnDesktop
)
).click();
openEditorSidebar(data.widgetName);
openAccordion("Validation", [
"Data",
"Validation",
"Additional Actions",
"Devices",
"Events",
]);
cy.get(
commonWidgetSelector.parameterInputField(commonWidgetText.labelMinLength)
).clearAndTypeOnCodeMirror("5");
cy.forceClickOnCanvas();
cy.waitForAutoSave();
openEditorSidebar(data.widgetName);
cy.get(commonWidgetSelector.widgetDocumentationLink).should(
"have.text",
textInputText.textInputDocumentationLink
);
cy.openInCurrentTab(commonWidgetSelector.previewButton);
cy.get(commonWidgetSelector.draggableWidget(data.widgetName))
.invoke("attr", "placeholder")
.should("contain", data.customText);
cy.clearAndType(
commonWidgetSelector.draggableWidget(data.widgetName),
`${data.customText}{Enter}`
);
cy.verifyToastMessage(commonSelectors.toastMessage, data.customText);
cy.forceClickOnCanvas();
cy.get(commonWidgetSelector.draggableWidget(data.widgetName)).clear();
cy.clearAndType(
commonWidgetSelector.draggableWidget(data.widgetName),
data.customText
);
cy.forceClickOnCanvas();
// cy.get(
// commonWidgetSelector.validationFeedbackMessage(data.widgetName)
// ).verifyVisibleElement("have.text", commonWidgetText.regexValidationError);
cy.get(commonWidgetSelector.draggableWidget(data.widgetName)).clear();
cy.forceClickOnCanvas();
cy.get(
commonWidgetSelector.validationFeedbackMessage(data.widgetName)
).verifyVisibleElement(
"have.text",
commonWidgetText.minLengthValidationError("5")
);
cy.clearAndType(
commonWidgetSelector.draggableWidget(data.widgetName),
data.customText.toUpperCase().replaceAll(" ", "").replaceAll(".", "")
);
cy.get(
commonWidgetSelector.validationFeedbackMessage(data.widgetName)
).verifyVisibleElement(
"have.text",
commonWidgetText.maxLengthValidationError(data.maximumLength)
);
cy.forceClickOnCanvas();
verifyTooltip(
commonWidgetSelector.draggableWidget(data.widgetName),
data.tooltipText
);
});
it("should verify the styles of the text input widget", () => {
const data = {};
data.appName = `${fake.companyName}-App`;
data.colourHex = fake.randomRgbaHex;
data.boxShadowColor = fake.randomRgba;
data.boxShadowParam = fake.boxShadowParam;
data.bgColor = fake.randomRgba;
data.borderColor = fake.randomRgba;
data.textColor = fake.randomRgba;
data.errorTextColor = fake.randomRgba;
data.iconColor = fake.randomRgba;
data.labelColor = fake.randomRgba;
data.widgetName = textInputText.defaultWidgetName;
openEditorSidebar(textInputText.defaultWidgetName);
cy.get(commonWidgetSelector.buttonStylesEditorSideBar).click();
addAllInputFieldColors(data);
cy.clearAndType('[data-cy="border-radius-input"]', "20");
cy.get('[data-cy="icon-visibility-button"]').click();
cy.forceClickOnCanvas();
cy.get(
commonWidgetSelector.draggableWidget(textInputText.defaultWidgetName)
).should("have.css", "border-radius", "20px");
verifyInputFieldColors("textinput1", data);
verifyStylesGeneralAccordion(
textInputText.defaultWidgetName,
data.boxShadowParam,
data.colourHex,
data.boxShadowColor,
4
);
openEditorSidebar(textInputText.defaultWidgetName);
cy.get(commonWidgetSelector.buttonStylesEditorSideBar).click();
verifyContainerElements();
checkPaddingOfContainer(textInputText.defaultWidgetName, 1);
cy.get('[data-cy="togglr-button-none"]').click();
checkPaddingOfContainer(textInputText.defaultWidgetName, 0);
verifyLabelStyleElements();
verifyAlignment(textInputText.defaultWidgetName, "sideLeft");
cy.get('[data-cy="togglr-button-top"]').click();
verifyAlignment(textInputText.defaultWidgetName, "topLeft");
cy.get('[data-cy="togglr-button-right"]').click();
verifyAlignment(textInputText.defaultWidgetName, "topRight");
cy.get('[data-cy="togglr-button-side"]').click();
verifyAlignment(textInputText.defaultWidgetName, "sideRight");
cy.get('[data-cy="togglr-button-left"]').click();
verifyAlignment(textInputText.defaultWidgetName, "sideLeft");
addCustomWidthOfLabel("50");
verifyCustomWidthOfLabel(textInputText.defaultWidgetName, "35");
selectColourFromColourPicker(
"Text",
data.labelColor,
0,
commonWidgetSelector.colourPickerParent,
"0"
);
verifyWidgetColorCss(
`[data-cy="label-${textInputText.defaultWidgetName}"]>label`,
"color",
data.labelColor,
true
);
cy.openInCurrentTab(commonWidgetSelector.previewButton);
verifyWidgetColorCss(
`[data-cy="label-${textInputText.defaultWidgetName}"]>label`,
"color",
data.labelColor,
true
);
verifyAlignment(textInputText.defaultWidgetName, "sideLeft");
verifyCustomWidthOfLabel(textInputText.defaultWidgetName, "35");
verifyInputFieldColors("textinput1", data);
verifyBoxShadowCss(
textInputText.defaultWidgetName,
data.boxShadowColor,
data.boxShadowParam
);
cy.get(
commonWidgetSelector.draggableWidget(textInputText.defaultWidgetName)
).should("have.css", "border-radius", "20px");
});
it.skip("should verify the app preview", () => { });
it("should verify CSA", () => {
const data = {};
data.customText = randomString(12);
data.widgetName = textInputText.defaultWidgetName;
addCSA(data);
verifyCSA(data);
cy.openInCurrentTab(commonWidgetSelector.previewButton);
verifyCSA(data);
});
});

View file

@ -0,0 +1,46 @@
import { fake } from "Fixtures/fake";
import { commonWidgetSelector } from "Selectors/common";
describe("Editor title", () => {
const data = {};
beforeEach(() => {
data.appName = fake.companyName;
cy.apiLogin();
cy.apiCreateApp(data.appName);
cy.visit("/");
});
afterEach(() => {
cy.apiDeleteApp();
});
it.skip("should verify titles", () => {
cy.url().should("include", "/tooljets-workspace");
cy.title().should("eq", "Dashboard | ToolJet");
// cy.title().should("eq", "ToolJet");
cy.log(data.appName);
cy.openApp();
cy.url().should("include", Cypress.env("appId"));
cy.title().should("eq", `${data.appName} | ToolJet`);
cy.openInCurrentTab(commonWidgetSelector.previewButton);
cy.url().should("include", `/applications/${Cypress.env("appId")}`);
// cy.title().should("eq", `${data.appName} | ToolJet`);
cy.title().should("eq", `Preview - ${data.appName} | ToolJet`);
cy.go("back");
cy.releaseApp();
cy.url().then((url) => {
const appId = url.split("/").filter(Boolean).pop();
cy.log(appId);
cy.visit(`/applications/${appId}`);
});
cy.url().should("include", `/applications/${Cypress.env("appId")}`);
cy.title().should("eq", `${data.appName} | ToolJet`);
// cy.title().should("eq", `${data.appName}`);
});
});

View file

@ -0,0 +1,164 @@
import { fake } from "Fixtures/fake";
import { commonSelectors, commonWidgetSelector } from "Selectors/common";
import {
addCSA,
verifyCSA
} from "Support/utils/editor/textInput";
import { addMultiEventsWithAlert } from "Support/utils/events";
import { openAndVerifyNode, openNode, verifyfunctions, verifyNodes, verifyNodeData } from "Support/utils/inspector";
describe('Button Component Tests', () => {
const functions = [
{
"key": "setText",
"type": "Function"
},
{
"key": "click",
"type": "Function"
},
{
"key": "disable",
"type": "Function"
},
{
"key": "visibility",
"type": "Function"
},
{
"key": "setVisibility",
"type": "Function"
},
{
"key": "setDisable",
"type": "Function"
},
{
"key": "loading",
"type": "Function"
},
{
"key": "setLoading",
"type": "Function"
}
]
const exposedValues = [{
"key": "buttonText",
"type": "String",
"value": "\"Button\""
},
{
"key": "isVisible",
"type": "Boolean",
"value": "true"
},
{
"key": "isDisabled",
"type": "Boolean",
"value": "false"
},
{
"key": "isLoading",
"type": "Boolean",
"value": "false"
},
// {
// "key": "id",
// "type": "String",
// "value": "\"d9f805c-a8d9-4c5a-ad09-badd6c2216ba\""
// }
]
beforeEach(() => {
cy.apiLogin();
cy.apiCreateApp(`${fake.companyName}-Button-App`);
cy.openApp();
cy.dragAndDropWidget("Button", 500, 500);
cy.get('[data-cy="query-manager-toggle-button"]').click();
});
it('should verify all the exposed values on inspector', () => {
cy.get(commonWidgetSelector.sidebarinspector).click();
cy.get(".tooltip-inner").invoke("hide");
openNode("components");
openAndVerifyNode("button1", exposedValues, verifyNodeData);
verifyNodes(functions, verifyNodeData);
//id is pending
});
it('should verify all the events from the button', () => {
const events = [
{ event: "On hover", message: "On hover Event" },
{ event: "On Click", message: "On Click Event" },
];
addMultiEventsWithAlert(events);
const textInputSelector = '[data-cy="draggable-widget-button1"]';
const verifyTextInputEvents = (selector) => {
cy.get(selector).realHover()
cy.verifyToastMessage(commonSelectors.toastMessage, 'On hover Event', false);
cy.get(selector).click();
cy.verifyToastMessage(commonSelectors.toastMessage, 'On Click Event', false);
};
verifyTextInputEvents(textInputSelector);
});
it.skip('should verify all the CSA from button', () => {
addMultiEventsWithAlert([
{ event: "On hover", message: "On hover Event" },
{ event: "On Click", message: "On Click Event" },
]);
const actions = [
{ event: "On click", action: "Set visibility", valueToggle: "{{false}}" }, //b2
{ event: "On click", action: "Visibility(deprecated)", valueToggle: "{{true}}" },//b3
{ event: "On click", action: "Disable(deprecated)", valueToggle: "{{true}}" },//b4
{ event: "On click", action: "Set disable", valueToggle: "{{false}}" },//b5
{ event: "On click", action: "Set text", value: "New Button Text" },//b6
{ event: "On click", action: "Click" },//b7
{ event: "On click", action: "Set loading", valueToggle: "{{true}}" },//b8
{ event: "On click", action: "Loading(deprecated)", valueToggle: "{{false}}" },//b9
];
addCSA("button1", actions);
let component = "button1";
cy.get(commonWidgetSelector.draggableWidget("button2")).click();
cy.get(commonWidgetSelector.draggableWidget(component)).should("not.be.visible");
cy.get(commonWidgetSelector.draggableWidget("button3")).click();
cy.get(commonWidgetSelector.draggableWidget(component)).should("be.visible");
cy.get(commonWidgetSelector.draggableWidget("button4")).click();
cy.get(commonWidgetSelector.draggableWidget(component)).parent().should("have.attr", "disabled");
cy.get(commonWidgetSelector.draggableWidget("button5")).click();
cy.get(commonWidgetSelector.draggableWidget(component)).parent().should("not.have.attr", "disabled");
cy.get(commonWidgetSelector.draggableWidget("button6")).click();
cy.get(commonWidgetSelector.draggableWidget(component)).should("have.text", "New Button Text");
cy.get(commonWidgetSelector.draggableWidget("button7")).click();
cy.verifyToastMessage(commonSelectors.toastMessage, 'On Click Event', false);
cy.get(commonWidgetSelector.draggableWidget("button8")).click();
cy.get(commonWidgetSelector.draggableWidget(component))
.parent()
.within(() => {
cy.get(".tj-widget-loader").should("be.visible");
});
cy.get(commonWidgetSelector.draggableWidget("button9")).click();
cy.notVisible(".tj-widget-loader");
});
// afterEach(() => {
// cy.apiDeleteApp();
// });
});

View file

@ -0,0 +1,178 @@
import { fake } from "Fixtures/fake";
import { commonSelectors, commonWidgetSelector } from "Selectors/common";
import {
addCSA,
verifyCSA
} from "Support/utils/editor/textInput";
import { addMultiEventsWithAlert } from "Support/utils/events";
import { openAndVerifyNode, openNode, verifyfunctions, verifyNodes, verifyNodeData } from "Support/utils/inspector";
describe('Checkbox Component Tests', () => {
const functions = [
{
"key": "setValue",
"type": "Function"
},
{
"key": "toggle",
"type": "Function"
},
{
"key": "setChecked",
"type": "Function"
},
{
"key": "setVisibility",
"type": "Function"
},
{
"key": "setDisable",
"type": "Function"
},
{
"key": "setLoading",
"type": "Function"
}
]
const exposedValues = [{
"key": "label",
"type": "String",
"value": "\"Label\""
},
{
"key": "isVisible",
"type": "Boolean",
"value": "true"
},
{
"key": "isDisabled",
"type": "Boolean",
"value": "false"
},
{
"key": "isMandatory",
"type": "Boolean",
"value": "false"
},
{
"key": "value",
"type": "Boolean",
"value": "false"
},
{
"key": "isLoading",
"type": "Boolean",
"value": "false"
},
{
"key": "isValid",
"type": "Boolean",
"value": "true"
},
// {
// "key": "id",
// "type": "String",
// "value": "\"d9f805c-a8d9-4c5a-ad09-badd6c2216ba\""
// }
]
beforeEach(() => {
cy.apiLogin();
cy.apiCreateApp(`${fake.companyName}-Checkbox-App`);
cy.openApp();
cy.dragAndDropWidget("Checkbox", 500, 500);
cy.get('[data-cy="query-manager-toggle-button"]').click();
});
it('should verify all the exposed values on inspector', () => {
cy.get(commonWidgetSelector.sidebarinspector).click();
cy.get(".tooltip-inner").invoke("hide");
openNode("components");
openAndVerifyNode("checkbox1", exposedValues, verifyNodeData);
verifyNodes(functions, verifyNodeData);
//id is pending
});
it.skip('should verify all the events from the Checkbox', () => {
const events = [
{ event: "On Change", message: "On Change Event" },
];
addMultiEventsWithAlert(events, false);
const textInputSelector = '[data-cy="draggable-widget-checkbox1"]';
const verifyTextInputEvents = (selector) => {
cy.forceClickOnCanvas();
cy.get(selector).find('input').click({ force: true });
cy.verifyToastMessage(commonSelectors.toastMessage, 'On Change Event', false);
// cy.get(selector).click();
// cy.verifyToastMessage(commonSelectors.toastMessage, 'On Click Event', false);
};
verifyTextInputEvents(textInputSelector);
});
it.skip('should verify all the CSA from Checkbox', () => {
const events = [
{ event: "On Change", message: "On Change Event" },
];
addMultiEventsWithAlert(events, false);
const actions = [
{ event: "On click", action: "Set visibility", valueToggle: "{{false}}" }, //b2
{ event: "On click", action: "Set visibility", valueToggle: "{{true}}" },//b3
{ event: "On click", action: "Set disable", valueToggle: "{{true}}" },//b4
{ event: "On click", action: "Set disable", valueToggle: "{{false}}" },//b5
{ event: "On click", action: "Set checked", value: "true" },//b6
{ event: "On click", action: "Toggle" },//b7
{ event: "On click", action: "Set loading", valueToggle: "{{true}}" },//b8
{ event: "On click", action: "Set loading", valueToggle: "{{false}}" },//b9
];
addCSA("checkbox1", actions);
let component = "checkbox1";
cy.get(commonWidgetSelector.draggableWidget("button1")).click();
cy.get(commonWidgetSelector.draggableWidget(component)).should("not.be.visible");
cy.get(commonWidgetSelector.draggableWidget("button2")).click();
cy.get(commonWidgetSelector.draggableWidget(component)).should("be.visible");
cy.get(commonWidgetSelector.draggableWidget("button3")).click();
cy.get(commonWidgetSelector.draggableWidget(component)).should("have.attr", "data-disabled", 'true');
cy.get(commonWidgetSelector.draggableWidget("button4")).click();
cy.get(commonWidgetSelector.draggableWidget(component)).should("have.attr", "data-disabled", 'false');
// cy.get(commonWidgetSelector.draggableWidget("button5")).click();
// cy.get(commonWidgetSelector.draggableWidget(component)).should("have.text", "New Button Text");
cy.get(commonWidgetSelector.draggableWidget("button5")).click();
cy.get(commonWidgetSelector.draggableWidget(component)).find('input').should('be.checked')
// cy.verifyToastMessage(commonSelectors.toastMessage, 'On Change Event', false);
cy.get(commonWidgetSelector.draggableWidget("button6")).click();
cy.verifyToastMessage(commonSelectors.toastMessage, 'On Change Event', false);
cy.get(commonWidgetSelector.draggableWidget("button7")).click();
cy.get(commonWidgetSelector.draggableWidget(component))
.parent()
.within(() => {
cy.get(".tj-widget-loader").should("be.visible");
});
cy.get(commonWidgetSelector.draggableWidget("button8")).click();
cy.notVisible(".tj-widget-loader");
});
// afterEach(() => {
// cy.apiDeleteApp();
// });
});

View file

@ -0,0 +1,192 @@
import { fake } from "Fixtures/fake";
import { commonSelectors, commonWidgetSelector } from "Selectors/common";
import {
addCSA,
verifyCSA
} from "Support/utils/editor/textInput";
import { addMultiEventsWithAlert } from "Support/utils/events";
import { openAndVerifyNode, openNode, verifyfunctions, verifyNodes, verifyNodeData } from "Support/utils/inspector";
describe('Dropdown Component Tests', () => {
const functions = [
{
"key": "clear",
"type": "Function"
},
{
"key": "selectOption",
"type": "Function"
}, ,
{
"key": "setVisibility",
"type": "Function"
},
{
"key": "setDisable",
"type": "Function"
},
{
"key": "setLoading",
"type": "Function"
},
{
"key": "selectedOption",
"type": "Object"
},
{
"key": "options",
"type": "Array"
},
]
const exposedValues = [{
"key": "searchText",
"type": "String",
"value": "\"\""
},
{
"key": "label",
"type": "String",
"value": "\"Select\""
},
{
"key": "isVisible",
"type": "Boolean",
"value": "true"
},
{
"key": "isDisabled",
"type": "Boolean",
"value": "false"
},
{
"key": "isMandatory",
"type": "Boolean",
"value": "false"
},
{
"key": "isLoading",
"type": "Boolean",
"value": "false"
},
{
"key": "isValid",
"type": "Boolean",
"value": "true"
},
{
"key": "value",
"type": "String",
"value": "2"
}
// {
// "key": "id",
// "type": "String",
// "value": "\"d9f805c-a8d9-4c5a-ad09-badd6c2216ba\""
// }
]
beforeEach(() => {
cy.apiLogin();
cy.apiCreateApp(`${fake.companyName}-Dropdown-App`);
cy.openApp();
cy.dragAndDropWidget("Dropdown", 50, 50);
cy.get('[data-cy="query-manager-toggle-button"]').click();
});
it('should verify all the exposed values on inspector', () => {
cy.get(commonWidgetSelector.sidebarinspector).click();
cy.get(".tooltip-inner").invoke("hide");
openNode("components");
openAndVerifyNode("dropdown1", exposedValues, verifyNodeData);
verifyNodes(functions, verifyfunctions);
//id is pending
});
it('should verify all the events from the dropdown', () => {
const events = [
{ event: "On Focus", message: "On Focus Event" },
{ event: "On Blur", message: "On Blur Event" },
{ event: "On select", message: "On select Event" },
{ event: "On search text changes", message: "On search Event" }
];
addMultiEventsWithAlert(events, false);
const textInputSelector = '[data-cy="draggable-widget-dropdown1"]';
const verifyTextInputEvents = (selector) => {
cy.get(selector).click();
cy.verifyToastMessage(commonSelectors.toastMessage, 'On Focus Event', false);
// cy.get(selector).type('r');
// cy.verifyToastMessage(commonSelectors.toastMessage, 'On Change Event', false);
// cy.get(selector).type('{enter}');
// cy.verifyToastMessage(commonSelectors.toastMessage, 'On Enter Event', false);
cy.forceClickOnCanvas();
cy.verifyToastMessage(commonSelectors.toastMessage, 'On Blur Event', false);
};
verifyTextInputEvents(textInputSelector);
});
it('should verify all the CSA from dropdown', () => {
const events = [
{ event: "On Change", message: "On Change Event" },
];
addMultiEventsWithAlert(events, false);
const actions = [
{ event: "On click", action: "Set visibility", valueToggle: "{{false}}" }, //b2
{ event: "On click", action: "Set visibility", valueToggle: "{{true}}" },//b3
{ event: "On click", action: "Set disable", valueToggle: "{{true}}" },//b4
{ event: "On click", action: "Set disable", valueToggle: "{{false}}" },//b5
{ event: "On click", action: "Set value", value: "true" },//b6
{ event: "On click", action: "Toggle" },//b7
{ event: "On click", action: "Set loading", valueToggle: "{{true}}" },//b8
{ event: "On click", action: "Set loading", valueToggle: "{{false}}" },//b9
];
addCSA("dropdown1", actions);
let component = "dropdown1";
cy.get(commonWidgetSelector.draggableWidget("button1")).click();
cy.get(commonWidgetSelector.draggableWidget(component)).should("not.be.visible");
cy.get(commonWidgetSelector.draggableWidget("button2")).click();
cy.get(commonWidgetSelector.draggableWidget(component)).should("be.visible");
cy.get(commonWidgetSelector.draggableWidget("button3")).click();
cy.get(commonWidgetSelector.draggableWidget(component)).should("have.attr", "data-disabled", 'true');
cy.get(commonWidgetSelector.draggableWidget("button4")).click();
cy.get(commonWidgetSelector.draggableWidget(component)).should("have.attr", "data-disabled", 'false');
cy.get(commonWidgetSelector.draggableWidget("button5")).click();
cy.get(commonWidgetSelector.draggableWidget(component)).should("have.text", "New Button Text");
cy.get(commonWidgetSelector.draggableWidget("button6")).click();
cy.verifyToastMessage(commonSelectors.toastMessage, 'On Click Event', false);
cy.get(commonWidgetSelector.draggableWidget("button7")).click();
cy.get(commonWidgetSelector.draggableWidget(component))
.parent()
.within(() => {
cy.get(".tj-widget-loader").should("be.visible");
});
cy.get(commonWidgetSelector.draggableWidget("button9")).click();
cy.notVisible(".tj-widget-loader");
});
// afterEach(() => {
// cy.apiDeleteApp();
// });
});

View file

@ -0,0 +1,145 @@
import { fake } from "Fixtures/fake";
import { commonSelectors, commonWidgetSelector } from "Selectors/common";
import { multipageSelector } from "Selectors/multipage";
import {
randomString
} from "Support/utils/editor/textInput";
import {
addInputOnQueryField,
query,
selectQueryFromLandingPage
} from "Support/utils/queries";
import { deleteDownloadsFolder } from "Support/utils/common";
import {
resizeQueryPanel
} from "Support/utils/dataSource";
import { openNode, verifyNodeData } from "Support/utils/inspector";
import {
addNewPage
} from "Support/utils/multipage";
describe("Global Actions", () => {
beforeEach(() => {
cy.apiLogin();
cy.apiCreateApp(`${fake.companyName}-gloabalActions-App`);
cy.openApp();
cy.viewport(1800, 1800);
cy.dragAndDropWidget("Button");
resizeQueryPanel("80");
deleteDownloadsFolder();
});
it("should verify actions", () => {
const data = {};
data.customText = randomString(12);
selectQueryFromLandingPage("runjs", "JavaScript");
addInputOnQueryField(
"runjs",
`setTimeout(() => {
actions.setVariable('var', 'test');
actions.setPageVariable('pageVar', 'pageTest');
}, [0]) `
);
query("run");
cy.get(commonWidgetSelector.sidebarinspector).click();
cy.get(".tooltip-inner").invoke("hide");
verifyNodeData("variables", "Object", "1 entry ");
openNode("variables", 0);
verifyNodeData("var", "String", `"test"`);
openNode("page");
openNode("variables", 1);
verifyNodeData("pageVar", "String", `"pageTest"`);
addInputOnQueryField(
"runjs",
`setTimeout(() => {
actions.unSetVariable('var');
actions.unsetPageVariable('pageVar');
}, [0]) `
);
query("run");
cy.get(commonWidgetSelector.sidebarinspector).click();
cy.get(".tooltip-inner").invoke("hide");
verifyNodeData("variables", "Object", "0 entry ");
openNode("page");
openNode("variables", 1);
verifyNodeData("variables", "Object", "0 entry ", 1);
addInputOnQueryField(
"runjs",
"actions.showAlert('success', 'alert from runjs');"
);
query("run");
cy.verifyToastMessage(commonSelectors.toastMessage, "alert from runjs");
cy.get(multipageSelector.sidebarPageButton).click();
addNewPage("test_page");
cy.url().should("contain", "/test-page");
addInputOnQueryField("runjs", "actions.switchPage('home');");
query("run");
cy.url().should("contain", "/home");
cy.get('[data-cy="real-canvas"]').click("topRight", { force: true });
cy.dragAndDropWidget("Modal", 200, 300);
cy.waitForAutoSave();
addInputOnQueryField("runjs", "actions.showModal('modal1');");
query("run");
cy.get('.text-widget-section > div').should("be.visible");
addInputOnQueryField("runjs", "actions.closeModal('modal1');");
query("run");
cy.wait(200);
cy.notVisible('[data-cy="modal-title"]');
addInputOnQueryField(
"runjs",
"actions.copyToClipboard('data from runjs');"
);
query("run");
cy.window().then((win) => {
win.navigator.clipboard.readText().then((text) => {
expect(text).to.eq("data from runjs");
});
});
addInputOnQueryField(
"runjs",
"actions.setLocalStorage('localStorage','data from runjs');"
);
query("run");
cy.wait(500)
cy.getAllLocalStorage().then((result) => {
expect(result[Cypress.config().baseUrl].localStorage).to.deep.equal(
"data from runjs"
);
});
addInputOnQueryField(
"runjs",
"actions.generateFile('runjscsv', 'csv', [{ name: 'John', email: 'john@tooljet.com' }])"
);
query("run");
cy.readFile("cypress/downloads/runjscsv.csv", "utf-8")
.should("contain", "name,email")
.and("contain", "John,john@tooljet.com");
// addInputOnQueryField(
// "runjs",
// "actions.goToApp('111234')"
// );
// query("run");
addInputOnQueryField("runjs", "actions.logout()");
query("run");
cy.get('[data-cy="sign-in-header"]').should("be.visible");
});
});

View file

@ -0,0 +1,195 @@
import { fake } from "Fixtures/fake";
import { commonSelectors, commonWidgetSelector } from "Selectors/common";
import {
addCSA,
verifyCSA
} from "Support/utils/editor/textInput";
import { addMultiEventsWithAlert } from "Support/utils/events";
import { openAndVerifyNode, openNode, verifyfunctions, verifyNodes, verifyNodeData } from "Support/utils/inspector";
describe('Multiselect Component Tests', () => {
const functions = [
{
"key": "clear",
"type": "Function"
},
{
"key": "selectOption",
"type": "Function"
}, {
"key": "deselectOptions",
"type": "Function"
},
{
"key": "setVisibility",
"type": "Function"
},
{
"key": "setDisable",
"type": "Function"
},
{
"key": "setLoading",
"type": "Function"
},
{
"key": "selectedOption",
"type": "Object"
},
{
"key": "options",
"type": "Array"
},
]
const exposedValues = [{
"key": "searchText",
"type": "String",
"value": "\"\""
},
{
"key": "label",
"type": "String",
"value": "\"Select\""
},
{
"key": "isVisible",
"type": "Boolean",
"value": "true"
},
{
"key": "isDisabled",
"type": "Boolean",
"value": "false"
},
{
"key": "isMandatory",
"type": "Boolean",
"value": "false"
},
{
"key": "isLoading",
"type": "Boolean",
"value": "false"
},
{
"key": "isValid",
"type": "Boolean",
"value": "true"
},
{
"key": "value",
"type": "String",
"value": "2"
}
// {
// "key": "id",
// "type": "String",
// "value": "\"d9f805c-a8d9-4c5a-ad09-badd6c2216ba\""
// }
]
beforeEach(() => {
cy.apiLogin();
cy.apiCreateApp(`${fake.companyName}-Multiselect-App`);
cy.openApp();
cy.dragAndDropWidget("Multiselect", 50, 50);
cy.get('[data-cy="query-manager-toggle-button"]').click();
});
it('should verify all the exposed values on inspector', () => {
cy.get(commonWidgetSelector.sidebarinspector).click();
cy.get(".tooltip-inner").invoke("hide");
openNode("components");
openAndVerifyNode("multiselect1", exposedValues, verifyNodeData);
verifyNodes(functions, verifyfunctions);
//id is pending
});
it('should verify all the events from the Multiselect', () => {
const events = [
{ event: "On Focus", message: "On Focus Event" },
{ event: "On Blur", message: "On Blur Event" },
{ event: "On select", message: "On select Event" },
{ event: "On search text changes", message: "On search Event" }
];
addMultiEventsWithAlert(events, false);
const textInputSelector = '[data-cy="draggable-widget-dropdown1"]';
const verifyTextInputEvents = (selector) => {
cy.get(selector).click();
cy.verifyToastMessage(commonSelectors.toastMessage, 'On Focus Event', false);
// cy.get(selector).type('r');
// cy.verifyToastMessage(commonSelectors.toastMessage, 'On Change Event', false);
// cy.get(selector).type('{enter}');
// cy.verifyToastMessage(commonSelectors.toastMessage, 'On Enter Event', false);
cy.forceClickOnCanvas();
cy.verifyToastMessage(commonSelectors.toastMessage, 'On Blur Event', false);
};
verifyTextInputEvents(textInputSelector);
});
it.only('should verify all the CSA from multiselect', () => {
const events = [
{ event: "On Change", message: "On Change Event" },
];
addMultiEventsWithAlert(events, false);
const actions = [
{ event: "On click", action: "Set visibility", valueToggle: "{{false}}" }, //b2
{ event: "On click", action: "Set visibility", valueToggle: "{{true}}" },//b3
{ event: "On click", action: "Set disable", valueToggle: "{{true}}" },//b4
{ event: "On click", action: "Set disable", valueToggle: "{{false}}" },//b5
{ event: "On click", action: "Set value", value: "true" },//b6
{ event: "On click", action: "Toggle" },//b7
{ event: "On click", action: "Set loading", valueToggle: "{{true}}" },//b8
{ event: "On click", action: "Set loading", valueToggle: "{{false}}" },//b9
];
addCSA("multiselect1", actions);
let component = "multiselect1";
cy.get(commonWidgetSelector.draggableWidget("button1")).click();
cy.get(commonWidgetSelector.draggableWidget(component)).should("not.be.visible");
cy.get(commonWidgetSelector.draggableWidget("button2")).click();
cy.get(commonWidgetSelector.draggableWidget(component)).should("be.visible");
cy.get(commonWidgetSelector.draggableWidget("button3")).click();
cy.get(commonWidgetSelector.draggableWidget(component)).should("have.attr", "data-disabled", 'true');
cy.get(commonWidgetSelector.draggableWidget("button4")).click();
cy.get(commonWidgetSelector.draggableWidget(component)).should("have.attr", "data-disabled", 'false');
cy.get(commonWidgetSelector.draggableWidget("button5")).click();
cy.get(commonWidgetSelector.draggableWidget(component)).should("have.text", "New Button Text");
cy.get(commonWidgetSelector.draggableWidget("button6")).click();
cy.verifyToastMessage(commonSelectors.toastMessage, 'On Click Event', false);
cy.get(commonWidgetSelector.draggableWidget("button7")).click();
cy.get(commonWidgetSelector.draggableWidget(component))
.parent()
.within(() => {
cy.get(".tj-widget-loader").should("be.visible");
});
cy.get(commonWidgetSelector.draggableWidget("button9")).click();
cy.notVisible(".tj-widget-loader");
});
// afterEach(() => {
// cy.apiDeleteApp();
// });
});

View file

@ -0,0 +1,152 @@
import { fake } from "Fixtures/fake";
import { commonSelectors, commonWidgetSelector } from "Selectors/common";
import {
addCSA,
verifyCSA
} from "Support/utils/editor/textInput";
import { addMultiEventsWithAlert } from "Support/utils/events";
import { openAndVerifyNode, openNode, verifyfunctions, verifyNodes, verifyNodeData } from "Support/utils/inspector";
describe('Number Input Component Tests', () => {
const functions = [
{
"key": "setText",
"type": "Function"
},
{
"key": "clear",
"type": "Function"
},
{
"key": "setFocus",
"type": "Function"
},
{
"key": "setBlur",
"type": "Function"
},
{
"key": "setVisibility",
"type": "Function"
},
{
"key": "setDisable",
"type": "Function"
},
{
"key": "setLoading",
"type": "Function"
}
]
const exposedValues = [{
"key": "value",
"type": "Number",
"value": "0"
},
{
"key": "isMandatory",
"type": "Boolean",
"value": "false"
},
{
"key": "isVisible",
"type": "Boolean",
"value": "true"
},
{
"key": "isDisabled",
"type": "Boolean",
"value": "false"
},
{
"key": "isLoading",
"type": "Boolean",
"value": "false"
},
{
"key": "label",
"type": "String",
"value": "\"Label\""
},
{
"key": "isValid",
"type": "Boolean",
"value": "true"
},
// {
// "key": "id",
// "type": "String",
// "value": "\"d9f805c-a8d9-4c5a-ad09-badd6c2216ba\""
// }
]
beforeEach(() => {
cy.apiLogin();
cy.apiCreateApp(`${fake.companyName}-Numberinput-App`);
cy.openApp();
cy.dragAndDropWidget("Number Input", 500, 500);
cy.get('[data-cy="query-manager-toggle-button"]').click();
});
it('should verify all the exposed values on inspector', () => {
cy.get(commonWidgetSelector.sidebarinspector).click();
cy.get(".tooltip-inner").invoke("hide");
openNode("components");
openAndVerifyNode("numberinput1", exposedValues, verifyNodeData);
verifyNodes(functions, verifyNodeData);
//id is pending
});
it.skip('should verify all the events from the number input', () => {
const events = [
{ event: "On Focus", message: "On Focus Event" },
{ event: "On Blur", message: "On Blur Event" },
{ event: "On Change", message: "On Change Event" },
{ event: "On Enter", message: "On Enter Event" }
];
addMultiEventsWithAlert(events);
const inputSelector = '[data-cy="draggable-widget-numberinput1"]';
const inputEvents = (selector) => {
cy.get(selector).click();
cy.verifyToastMessage(commonSelectors.toastMessage, 'On Focus Event', false);
cy.get(selector).type('1');
cy.verifyToastMessage(commonSelectors.toastMessage, 'On Change Event', false);
cy.get(selector).type('{enter}');
cy.verifyToastMessage(commonSelectors.toastMessage, 'On Enter Event', false);
cy.forceClickOnCanvas();
cy.verifyToastMessage(commonSelectors.toastMessage, 'On Blur Event', false);
};
inputEvents(inputSelector);
});
it.skip('should verify all the CSA from number input', () => {
const actions = [
{ event: "On click", action: "Set visibility", valueToggle: "{{false}}" }, //b1
{ event: "On click", action: "Set visibility", valueToggle: "{{true}}" },//b2
{ event: "On click", action: "Set disable", valueToggle: "{{true}}" },//b3
{ event: "On click", action: "Set disable", valueToggle: "{{false}}" },//b4
{ event: "On click", action: "Set text", value: "1199999" },//b5
{ event: "On click", action: "Clear" },//b6
{ event: "On click", action: "Set focus" },//b7
{ event: "On click", action: "Set blur" },//b8
{ event: "On click", action: "Set loading", valueToggle: "{{true}}" },//b9
];
addCSA("numberinput1", actions);
verifyCSA('numberinput1');
});
// afterEach(() => {
// cy.apiDeleteApp();
// });
});

View file

@ -0,0 +1,152 @@
import { fake } from "Fixtures/fake";
import { commonSelectors, commonWidgetSelector } from "Selectors/common";
import {
addCSA,
verifyCSA
} from "Support/utils/editor/textInput";
import { addMultiEventsWithAlert } from "Support/utils/events";
import { openAndVerifyNode, openNode, verifyfunctions, verifyNodes, verifyNodeData } from "Support/utils/inspector";
describe('Password Input Component Tests', () => {
const functions = [
{
"key": "setText",
"type": "Function"
},
{
"key": "clear",
"type": "Function"
},
{
"key": "setFocus",
"type": "Function"
},
{
"key": "setBlur",
"type": "Function"
},
{
"key": "setVisibility",
"type": "Function"
},
{
"key": "setDisable",
"type": "Function"
},
{
"key": "setLoading",
"type": "Function"
}
]
const exposedValues = [{
"key": "value",
"type": "String",
"value": "\"\""
},
{
"key": "isMandatory",
"type": "Boolean",
"value": "false"
},
{
"key": "isVisible",
"type": "Boolean",
"value": "true"
},
{
"key": "isDisabled",
"type": "Boolean",
"value": "false"
},
{
"key": "isLoading",
"type": "Boolean",
"value": "false"
},
{
"key": "label",
"type": "String",
"value": "\"Label\""
},
{
"key": "isValid",
"type": "Boolean",
"value": "true"
},
// {
// "key": "id",
// "type": "String",
// "value": "\"d9f805c-a8d9-4c5a-ad09-badd6c2216ba\""
// }
]
beforeEach(() => {
cy.apiLogin();
cy.apiCreateApp(`${fake.companyName}-Passwordinput-App`);
cy.openApp();
cy.dragAndDropWidget("Password Input", 50, 50);
cy.get('[data-cy="query-manager-toggle-button"]').click();
});
it('should verify all the exposed values on inspector', () => {
cy.get(commonWidgetSelector.sidebarinspector).click();
cy.get(".tooltip-inner").invoke("hide");
openNode("components");
openAndVerifyNode("passwordinput1", exposedValues, verifyNodeData);
verifyNodes(functions, verifyfunctions);
//id is pending
});
it.skip('should verify all the events from the password input', () => {
const events = [
{ event: "On Focus", message: "On Focus Event" },
{ event: "On Blur", message: "On Blur Event" },
{ event: "On Change", message: "On Change Event" },
{ event: "On Enter", message: "On Enter Event" }
];
addMultiEventsWithAlert(events);
const inputSelector = '[data-cy="draggable-widget-passwordinput1"]';
const inputEvents = (selector) => {
cy.get(selector).click();
cy.verifyToastMessage(commonSelectors.toastMessage, 'On Focus Event', false);
cy.get(selector).type('r');
cy.verifyToastMessage(commonSelectors.toastMessage, 'On Change Event', false);
cy.get(selector).type('{enter}');
cy.verifyToastMessage(commonSelectors.toastMessage, 'On Enter Event', false);
cy.forceClickOnCanvas();
cy.verifyToastMessage(commonSelectors.toastMessage, 'On Blur Event', false);
};
inputEvents(inputSelector);
});
it('should verify all the CSA from password input', () => {
const actions = [
{ event: "On click", action: "Set visibility", valueToggle: "{{false}}" }, //b1
{ event: "On click", action: "Set visibility", valueToggle: "{{true}}" },//b2
{ event: "On click", action: "Set disable", valueToggle: "{{true}}" },//b3
{ event: "On click", action: "Set disable", valueToggle: "{{false}}" },//b4
{ event: "On click", action: "Set text", value: "1199999" },//b5
{ event: "On click", action: "Clear" },//b6
{ event: "On click", action: "Set focus" },//b7
{ event: "On click", action: "Set blur" },//b8
{ event: "On click", action: "Set loading", valueToggle: "{{true}}" },//b9
];
addCSA("passwordinput1", actions);
verifyCSA('passwordinput1');
});
// afterEach(() => {
// cy.apiDeleteApp();
// });
});

View file

@ -0,0 +1,160 @@
import { fake } from "Fixtures/fake";
import { commonSelectors, commonWidgetSelector } from "Selectors/common";
import {
addCSA,
verifyCSA
} from "Support/utils/editor/textInput";
import { addMultiEventsWithAlert } from "Support/utils/events";
import { openAndVerifyNode, openNode, verifyfunctions, verifyNodes, verifyNodeData } from "Support/utils/inspector";
describe('Text Input Component Tests', () => {
const functions = [
{
"key": "setText",
"type": "Function"
},
{
"key": "clear",
"type": "Function"
},
{
"key": "setFocus",
"type": "Function"
},
{
"key": "setBlur",
"type": "Function"
},
// {
// "key": "disable",
// "type": "Function"
// },
// {
// "key": "visibility",
// "type": "Function"
// },
{
"key": "setVisibility",
"type": "Function"
},
{
"key": "setDisable",
"type": "Function"
},
{
"key": "setLoading",
"type": "Function"
}
]
const exposedValues = [{
"key": "value",
"type": "String",
"value": "\"\""
},
{
"key": "isMandatory",
"type": "Boolean",
"value": "false"
},
{
"key": "isVisible",
"type": "Boolean",
"value": "true"
},
{
"key": "isDisabled",
"type": "Boolean",
"value": "false"
},
{
"key": "isLoading",
"type": "Boolean",
"value": "false"
},
{
"key": "label",
"type": "String",
"value": "\"Label\""
},
{
"key": "isValid",
"type": "Boolean",
"value": "true"
},
// {
// "key": "id",
// "type": "String",
// "value": "\"d9f805c-a8d9-4c5a-ad09-badd6c2216ba\""
// }
]
beforeEach(() => {
cy.apiLogin();
cy.apiCreateApp(`${fake.companyName}-Textinput-App`);
cy.openApp();
cy.dragAndDropWidget("Text Input", 500, 500);
cy.get('[data-cy="query-manager-toggle-button"]').click();
});
it('should verify all the exposed values on inspector', () => {
cy.get(commonWidgetSelector.sidebarinspector).click();
cy.get(".tooltip-inner").invoke("hide");
openNode("components");
openAndVerifyNode("textinput1", exposedValues, verifyNodeData);
verifyNodes(functions, verifyNodeData);
//id is pending
});
it.skip('should verify all the events from the text input', () => {
const events = [
{ event: "On Focus", message: "On Focus Event" },
{ event: "On Blur", message: "On Blur Event" },
{ event: "On Change", message: "On Change Event" },
{ event: "On Enter", message: "On Enter Event" }
];
addMultiEventsWithAlert(events);
const textInputSelector = '[data-cy="draggable-widget-textinput1"]';
const verifyTextInputEvents = (selector) => {
cy.get(selector).click();
cy.verifyToastMessage(commonSelectors.toastMessage, 'On Focus Event', false);
cy.get(selector).type('r');
cy.verifyToastMessage(commonSelectors.toastMessage, 'On Change Event', false);
cy.get(selector).type('{enter}');
cy.verifyToastMessage(commonSelectors.toastMessage, 'On Enter Event', false);
cy.forceClickOnCanvas();
cy.verifyToastMessage(commonSelectors.toastMessage, 'On Blur Event', false);
};
verifyTextInputEvents(textInputSelector);
});
it.skip('should verify all the CSA from text input', () => {
const actions = [
{ event: "On click", action: "Set visibility", valueToggle: "{{false}}" }, //b1
{ event: "On click", action: "Visibility", valueToggle: "{{true}}" },//b2
{ event: "On click", action: "Disable", valueToggle: "{{true}}" },//b3
{ event: "On click", action: "Set disable", valueToggle: "{{false}}" },//b4
{ event: "On click", action: "Set text", value: "1199999" },//b5
{ event: "On click", action: "Clear" },//b6
{ event: "On click", action: "Set focus" },//b7
{ event: "On click", action: "Set blur" },//b8
{ event: "On click", action: "Set loading", valueToggle: "{{true}}" },//b9
];
addCSA("textinput1", actions);
verifyCSA('textinput1');
});
// afterEach(() => {
// cy.apiDeleteApp();
// });
});

View file

@ -0,0 +1,172 @@
import { fake } from "Fixtures/fake";
import { commonSelectors, commonWidgetSelector } from "Selectors/common";
import {
addCSA,
verifyCSA
} from "Support/utils/editor/textInput";
import { addMultiEventsWithAlert } from "Support/utils/events";
import { openAndVerifyNode, openNode, verifyfunctions, verifyNodes, verifyNodeData } from "Support/utils/inspector";
describe('ToggleSwitch Component Tests', () => {
const functions = [
{
"key": "setValue",
"type": "Function"
},
{
"key": "toggle",
"type": "Function"
}, ,
{
"key": "setVisibility",
"type": "Function"
},
{
"key": "setDisable",
"type": "Function"
},
{
"key": "setLoading",
"type": "Function"
}
]
const exposedValues = [{
"key": "label",
"type": "String",
"value": "\"Label\""
},
{
"key": "isVisible",
"type": "Boolean",
"value": "true"
},
{
"key": "isDisabled",
"type": "Boolean",
"value": "false"
},
{
"key": "isMandatory",
"type": "Boolean",
"value": "false"
},
{
"key": "value",
"type": "Boolean",
"value": "false"
},
{
"key": "isLoading",
"type": "Boolean",
"value": "false"
},
{
"key": "isValid",
"type": "Boolean",
"value": "true"
},
// {
// "key": "id",
// "type": "String",
// "value": "\"d9f805c-a8d9-4c5a-ad09-badd6c2216ba\""
// }
]
beforeEach(() => {
cy.apiLogin();
cy.apiCreateApp(`${fake.companyName}-Toggle-App`);
cy.openApp();
cy.dragAndDropWidget("Toggle Switch", 50, 50);
cy.get('[data-cy="query-manager-toggle-button"]').click();
});
it('should verify all the exposed values on inspector', () => {
cy.get(commonWidgetSelector.sidebarinspector).click();
cy.get(".tooltip-inner").invoke("hide");
openNode("components");
openAndVerifyNode("toggleswitch1", exposedValues, verifyNodeData);
verifyNodes(functions, verifyfunctions);
//id is pending
});
it('should verify all the events from the Toggle', () => {
const events = [
{ event: "On Change", message: "On Change Event" },
];
addMultiEventsWithAlert(events, false);
const textInputSelector = '[data-cy="draggable-widget-toggleswitch1"]';
const verifyTextInputEvents = (selector) => {
cy.forceClickOnCanvas();
cy.get(selector).find('input').click({ force: true });
cy.verifyToastMessage(commonSelectors.toastMessage, 'On Change Event', false);
// cy.get(selector).click();
// cy.verifyToastMessage(commonSelectors.toastMessage, 'On Click Event', false);
};
verifyTextInputEvents(textInputSelector);
});
it.only('should verify all the CSA from toggle', () => {
const events = [
{ event: "On Change", message: "On Change Event" },
];
addMultiEventsWithAlert(events, false);
const actions = [
{ event: "On click", action: "Set visibility", valueToggle: "{{false}}" }, //b2
{ event: "On click", action: "Set visibility", valueToggle: "{{true}}" },//b3
{ event: "On click", action: "Set disable", valueToggle: "{{true}}" },//b4
{ event: "On click", action: "Set disable", valueToggle: "{{false}}" },//b5
{ event: "On click", action: "Set value", value: "true" },//b6
{ event: "On click", action: "Toggle" },//b7
{ event: "On click", action: "Set loading", valueToggle: "{{true}}" },//b8
{ event: "On click", action: "Set loading", valueToggle: "{{false}}" },//b9
];
addCSA("toggleswitch1", actions);
let component = "toggleswitch1";
cy.get(commonWidgetSelector.draggableWidget("button1")).click();
cy.get(commonWidgetSelector.draggableWidget(component)).should("not.be.visible");
cy.get(commonWidgetSelector.draggableWidget("button2")).click();
cy.wait(500);
cy.forceClickOnCanvas();
cy.get(commonWidgetSelector.draggableWidget(component)).should("be.visible");
cy.get(commonWidgetSelector.draggableWidget("button3")).click();
cy.get(commonWidgetSelector.draggableWidget(component)).should("have.attr", "data-disabled", 'true');
cy.get(commonWidgetSelector.draggableWidget("button4")).click();
cy.get(commonWidgetSelector.draggableWidget(component)).should("have.attr", "data-disabled", 'false');
cy.get(commonWidgetSelector.draggableWidget("button5")).click();
cy.get(commonWidgetSelector.draggableWidget(component)).should("have.text", "New Button Text");
cy.get(commonWidgetSelector.draggableWidget("button6")).click();
cy.verifyToastMessage(commonSelectors.toastMessage, 'On Click Event', false);
cy.get(commonWidgetSelector.draggableWidget("button7")).click();
cy.get(commonWidgetSelector.draggableWidget(component))
.parent()
.within(() => {
cy.get(".tj-widget-loader").should("be.visible");
});
cy.get(commonWidgetSelector.draggableWidget("button9")).click();
cy.notVisible(".tj-widget-loader");
});
// afterEach(() => {
// cy.apiDeleteApp();
// });
});

View file

@ -0,0 +1,111 @@
import { fake } from "Fixtures/fake";
import { tableSelector } from "Selectors/table";
import {
verifyMultipleComponentValuesFromInspector,
verifyComponentValueFromInspector,
openEditorSidebar,
openAccordion,
verifyBoxShadowCss,
selectColourFromColourPicker,
verifyWidgetColorCss,
} from "Support/utils/commonWidget";
// import { verifyNodeData, openNode, verifyNodeData } from "Support/utils/inspector";
import { commonSelectors, commonWidgetSelector } from "Selectors/common";
import {
commonText,
commonWidgetText,
codeMirrorInputLabel,
} from "Texts/common";
describe("Editor- Global Settings", () => {
const data = {};
beforeEach(() => {
data.appName = `${fake.companyName}-App`;
cy.apiLogin();
cy.apiCreateApp(data.appName);
cy.openApp();
});
it("should verify global settings", () => {
data.backgroundColor = fake.randomRgba;
cy.get("[data-cy='left-sidebar-settings-button']").click();
cy.get('[data-cy="label-global settings"]').verifyVisibleElement(
"have.text",
"Global settings"
);
// cy.get(
// '[data-cy="label-hide-header-for-launched-apps"]'
// ).verifyVisibleElement("have.text", "Hide header for launched apps");
// cy.get('[data-cy="label-maintenance-mode"]').verifyVisibleElement(
// "have.text",
// "Maintenance mode"
// );
cy.hideTooltip();
cy.get('[data-cy="label-max-canvas-width"]').verifyVisibleElement(
"have.text",
"Max width of canvas"
);
cy.get('[data-cy="label-bg-canvas"]').verifyVisibleElement(
"have.text",
"Canvas background"
);
// cy.get('[data-cy="canvas-bg-colour-picker"]').click();
selectColourFromColourPicker(
"canvas-bg-color",
data.backgroundColor,
0,
".canvas-codehinter-container"
);
verifyWidgetColorCss(
'[data-cy="real-canvas"]',
"background-color",
data.backgroundColor,
true
);
cy.openInCurrentTab(commonWidgetSelector.previewButton);
cy.get(".navbar").should("be.visible");
cy.go("back");
cy.wait(5000);
cy.get("[data-cy='left-sidebar-settings-button']").click();
cy.get('[data-cy="toggle-hide-header-for-launched-apps"]').realClick();
cy.wait(700);
cy.forceClickOnCanvas();
cy.wait(1000);
cy.waitForAutoSave();
cy.wait(1000);
cy.openInCurrentTab(commonWidgetSelector.previewButton);
cy.wait(5000);
cy.notVisible(".navbar");
cy.go("back");
cy.wait(5000);
cy.get("[data-cy='left-sidebar-settings-button']").click();
cy.get('[data-cy="toggle-maintenance-mode"]').realClick();
cy.get('[data-cy="modal-confirm-button"]').click();
// cy.verifyToastMessage(
// commonSelectors.toastMessage,
// "Application is on maintenance.",
// false
// );
cy.forceClickOnCanvas();
cy.wait(500);
cy.waitForAutoSave();
// Fix this after the release. 2.9.0
cy.get('[data-cy="button-release"]').click();
cy.get('[data-cy="yes-button"]').click();
cy.get('[data-cy="editor-page-logo"]').click();
cy.get('[data-cy="back-to-app-option"]').click();
cy.get(`[data-cy="${data.appName.toLowerCase()}-card"]`)
.realHover().within(() => {
cy.get('[data-cy="launch-button"]').should('have.text', 'Maintenance')
.invoke("attr", "class")
.should("contains", "disabled-btn");
})
cy.apiDeleteApp();
});
});

View file

@ -0,0 +1,164 @@
import { fake } from "Fixtures/fake";
import { commonWidgetSelector } from "Selectors/common";
import { multipageSelector } from "Selectors/multipage";
import { addSupportCSAData, selectEvent } from "Support/utils/events";
import { createNewVersion } from "Support/utils/exportImport";
import { deleteComponentFromInspector, openNode, verifyNodeData, verifyNodes, openAndVerifyNode } from "Support/utils/inspector";
import { addNewPage } from "Support/utils/multipage";
import { navigateToCreateNewVersionModal } from "Support/utils/version";
import testData from "Fixtures/inspectorItems.json";
describe("Editor- Inspector", () => {
let currentVersion = "";
let newVersion = [];
let versionFrom = "";
beforeEach(() => {
cy.apiLogin();
cy.apiCreateApp(`${fake.companyName}-inspector-App`);
cy.openApp("?key=value");
cy.viewport(1800, 1800);
});
it.skip("should verify the values of inspector", () => {
cy.get(commonWidgetSelector.sidebarinspector).click();
cy.get(".tooltip-inner").invoke("hide");
openAndVerifyNode("globals", testData.globalsNodes, verifyNodeData);
openAndVerifyNode("currentUser", testData.currentUserNodes, verifyNodeData);
openAndVerifyNode("theme", testData.themeNodes, verifyNodeData);
openAndVerifyNode("mode", testData.modeNodes, verifyNodeData);
openAndVerifyNode("urlparams", testData.urlparamsNode, verifyNodeData);
if (Cypress.env("environment") !== "Community") {
const ssoUserInfoNode = '[data-cy="inspector-node-ssouserinfo"]';
const inspectorNodeId = '[data-cy="inspector-node-id"]';
cy.get(`${ssoUserInfoNode} > .node-key`).should("have.text", "ssoUserInfo");
cy.get(`${ssoUserInfoNode} > .mx-2`).should("have.text", "undefined");
openNode("theme");
openNode("environment");
verifyNodeData("name", "String", `"development"`);
cy.get(`${inspectorNodeId} > .node-key`).should("have.text", "id");
}
cy.apiDeleteApp();
});
it.skip("should verify dynamic items", () => {
cy.get(commonWidgetSelector.sidebarinspector).click();
cy.get(".tooltip-inner").invoke("hide");
cy.get(multipageSelector.sidebarPageButton).click();
addNewPage("test_page");
cy.dragAndDropWidget("Button", 100, 100);
selectEvent("On click", "Switch page");
cy.get('[data-cy="switch-page-label-and-input"] > .select-search').click().type("home{enter}");
cy.get('[data-cy="button-add-query-param"]').click();
cy.wait(3000);
cy.get("body").then(($body) => {
if ($body.find('[data-cy="event-query-param-key-input-field"]').length == 0) {
cy.get('[data-cy="button-add-query-param"]').click();
}
});
addSupportCSAData("event-query-param-key", "key");
addSupportCSAData("event-query-param-value", "value");
cy.get('[data-cy="switch-page-label-and-input"] > .select-search').click().type("home{enter}");
cy.get('[data-cy="real-canvas"]').click("topRight", { force: true });
cy.dragAndDropWidget("Button", 500, 300);
selectEvent("On click", "Set variable");
addSupportCSAData("event-key", "globalVar");
cy.wait(500)
addSupportCSAData("variable", "globalVar");
cy.wait(500)
cy.forceClickOnCanvas();
cy.waitForAutoSave();
cy.get(commonWidgetSelector.draggableWidget("button2")).click();
cy.get('[data-cy="real-canvas"]').click("topRight", { force: true });
cy.dragAndDropWidget("Button", 500, 400);
selectEvent("On click", "Set page variable");
addSupportCSAData("key", "pageVar");
addSupportCSAData("variable", "pageVar");
cy.forceClickOnCanvas();
cy.waitForAutoSave();
cy.get(commonWidgetSelector.draggableWidget("button3")).click();
cy.get(commonWidgetSelector.sidebarinspector).click();
openAndVerifyNode("variables", testData.variablesNodes, verifyNodeData);
cy.forceClickOnCanvas()
cy.wait(500)
cy.get(commonWidgetSelector.sidebarinspector).click();
cy.get(".tooltip-inner").invoke("hide");
// openNode("page");
openAndVerifyNode("page", testData.testPageNodes, verifyNodeData);
openNode("variables", 1);
verifyNodeData("pageVar", "String", `"pageVar"`);
openAndVerifyNode("components", testData.componentsNodes, verifyNodeData);
cy.get('[data-cy="real-canvas"]').click("topRight", { force: true });
cy.get(commonWidgetSelector.draggableWidget("button1")).click();
cy.get(commonWidgetSelector.sidebarinspector).click();
openAndVerifyNode("page", testData.pageNodes, verifyNodeData);
openNode("globals");
openNode("urlparams");
verifyNodeData("key", "String", `"value"`);
cy.get(`[data-cy="inspector-node-key"] > .mx-1`)
.realHover()
.parent()
.find('[data-cy="copy-path-to-clipboard"]')
.realClick();
cy.realPress("Escape");
cy.window().then((win) => {
win.navigator.clipboard.readText().then((text) => {
expect(text).to.eq("{{globals.urlparams.key}}");
});
});
cy.get(`[data-cy="inspector-node-key"] > .mx-1`)
.realHover()
.parent()
.find('[data-cy="copy-value-to-clicpboard"]')
.realClick();
cy.realPress("Escape");
cy.window().then((win) => {
win.navigator.clipboard.readText().then((text) => {
expect(text).to.eq(`"value"`);
});
});
cy.dragAndDropWidget("Button", 500, 300);
cy.get(commonWidgetSelector.sidebarinspector).click();
openNode("components");
cy.get(`[data-cy="inspector-node-button1"] > .mx-1`).eq(0).realHover();
cy.get('[style="height: 13px; width: 13px;"] > img').last().click();
cy.notVisible(commonWidgetSelector.draggableWidget("button1"));
cy.apiDeleteApp();
});
it.skip("should verify deletion of component from inspector", () => {
cy.dragAndDropWidget("button", 500, 500);
cy.get(commonWidgetSelector.sidebarinspector).click();
deleteComponentFromInspector("button1");
cy.verifyToastMessage(`[class=go3958317564]`, "Component deleted! (ctrl + Z to undo)");
navigateToCreateNewVersionModal((currentVersion = "v1"));
createNewVersion((newVersion = ["v2"]), (versionFrom = "v1"));
cy.notVisible(commonWidgetSelector.draggableWidget("button1"));
cy.apiDeleteApp();
});
});

View file

@ -0,0 +1,194 @@
import { fake } from "Fixtures/fake";
import { commonSelectors, commonWidgetSelector } from "Selectors/common";
import { openEditorSidebar } from "Support/utils/commonWidget";
import { selectEvent } from "Support/utils/events";
import { randomString } from "Support/utils/editor/textInput";
import { buttonText } from "Texts/button";
import { addSuccessNotification, chainQuery } from "Support/utils/queries";
import { resizeQueryPanel } from "Support/utils/dataSource";
describe("Chaining of queries", () => {
beforeEach(() => {
cy.apiLogin();
cy.apiCreateApp(`${fake.companyName}-chaining-App`);
cy.openApp();
cy.apiFetchDataSourcesId()
cy.viewport(1800, 1800);
cy.dragAndDropWidget("Button");
resizeQueryPanel("80");
});
it("should verify the chainig of runjs, restapi, runpy, tooljetdb and postgres", () => {
const data = {};
let dsName = fake.companyName;
data.customText = randomString(12);
cy.apiAddQueryToApp(
"runjs",
{ code: "return true", hasParamSupport: true, parameters: [] },
null,
"runjs"
);
cy.apiAddQueryToApp(
"runpy",
{ code: "True", hasParamSupport: true, parameters: [] },
null,
"runpy"
);
cy.apiAddQueryToApp(
"restapi",
{
method: "get",
url: "https://gorest.co.in/public/v2/users",
url_params: [["", ""]],
},
null,
"restapi"
);
cy.apiAddQueryToApp(
"tjdb",
{
operation: "",
transformationLanguage: "javascript",
enableTransformation: false,
},
null,
"tooljetdb"
);
cy.apiCreateGDS(
`http://localhost:3000/api/data-sources`,
`cypress-${dsName}-qc-postgresql`,
"postgresql",
[
{ key: "host", value: Cypress.env("pg_host") },
{ key: "port", value: 5432 },
{ key: "database", value: Cypress.env("pg_user") },
{ key: "username", value: Cypress.env("pg_user") },
{ key: "password", value: Cypress.env("pg_password"), encrypted: true },
{ key: "ssl_enabled", value: false, encrypted: false },
{ key: "ssl_certificate", value: "none", encrypted: false },
{ key: "connection_type", value: "manual", encrypted: false }
]
);
cy.log("Data source created");
cy.apiAddQueryToApp(
"psql",
{
mode: "sql",
transformationLanguage: "javascript",
enableTransformation: false,
query: `SELECT * FROM pg_stat_activity;`,
},
`cypress-${dsName}-qc-postgresql`,
"postgresql"
);
cy.reload();
resizeQueryPanel("80");
chainQuery("psql", "runjs");
addSuccessNotification("psql");
chainQuery("runjs", "runpy");
addSuccessNotification("runjs");
chainQuery("runpy", "restapi");
addSuccessNotification("runpy");
chainQuery("restapi", "tjdb");
addSuccessNotification("restapi");
cy.get(`[data-cy="list-query-tjdb"]`).click();
cy.get('[data-cy="query-tab-settings"]').click();
selectEvent("Query Failure", "Show Alert");
cy.get('[data-cy="debounce-input-field"]')
.click()
.type(`{selectAll}{backspace}2000{enter}`);
cy.wait(1000)
cy.get('[data-cy="query-tab-setup"]').click();
cy.wait(1500);
openEditorSidebar(buttonText.defaultWidgetName);
selectEvent("On Click", "Run Query", 0, `[data-cy="add-event-handler"]`, 0);
cy.wait(500);
cy.get('[data-cy="query-selection-field"]')
.click()
.find("input")
.type(`{selectAll}{backspace}psql{enter}`);
cy.forceClickOnCanvas();
cy.wait(2500)
cy.get(commonWidgetSelector.draggableWidget("button1")).click();
cy.verifyToastMessage(commonSelectors.toastMessage, "psql");
cy.verifyToastMessage(commonSelectors.toastMessage, "runjs");
cy.verifyToastMessage(commonSelectors.toastMessage, "runpy");
cy.wait(500);
cy.verifyToastMessage(commonSelectors.toastMessage, "restapi");
// cy.verifyToastMessage(commonSelectors.toastMessage, "Hello World");
});
it("should verify query duplication", () => {
const data = {};
let dsName = fake.companyName;
data.customText = randomString(12);
cy.apiAddQueryToApp(
"runjs",
{ code: "return true", hasParamSupport: true, parameters: [] },
null,
"runjs"
);
cy.apiAddQueryToApp(
"runpy",
{ code: "True", hasParamSupport: true, parameters: [] },
null,
"runpy"
);
cy.reload();
resizeQueryPanel("80");
addSuccessNotification("runpy");
chainQuery("runjs", "runpy");
addSuccessNotification("runjs");
cy.wait(1500);
openEditorSidebar(buttonText.defaultWidgetName);
selectEvent("On Click", "Run Query", 0, `[data-cy="add-event-handler"]`, 0);
cy.wait(500);
cy.get('[data-cy="query-selection-field"]')
.click()
.find("input")
.type(`{selectAll}{backspace}runjs{enter}`);
cy.forceClickOnCanvas();
cy.wait(2500)
cy.get(commonWidgetSelector.draggableWidget("button1")).click();
cy.verifyToastMessage(commonSelectors.toastMessage, "runjs");
cy.verifyToastMessage(commonSelectors.toastMessage, "runpy");
cy.get('[data-cy="list-query-runjs"]')
.trigger("mouseover")
.parent()
.parent()
.find('[data-cy="copy-icon"]')
.eq(0)
.invoke("show")
.click({ force: true });
cy.get('[data-cy="list-query-runjs_copy"]').verifyVisibleElement(
"have.text",
"runjs_copy "
);
cy.get('[data-cy="query-tab-settings"]').click();
cy.get('[data-cy="notification-on-success-toggle-switch"]').should(
"have.value",
"on"
);
cy.get('[data-cy="success-message-input-field"]').should(
"contain.text",
"runjs"
);
cy.get(".query-definition-pane-wrapper").within(() => {
cy.get('[data-cy="event-handler-card"]').eq(0).click();
cy.wait(500);
});
cy.get(
`[data-cy="action-selection"] > .select-search > .react-select__control > .react-select__value-container > `
).should("have.text", "Run query");
cy.get('[data-cy="query-selection-field"]').should("have.text", "runpy");
});
});

View file

@ -0,0 +1,190 @@
import { fake } from "Fixtures/fake";
import { commonSelectors, commonWidgetSelector } from "Selectors/common";
import {
openEditorSidebar
} from "Support/utils/commonWidget";
import {
randomString
} from "Support/utils/editor/textInput";
import {
selectEvent
} from "Support/utils/events";
import {
addInputOnQueryField,
changeQueryToggles,
query,
renameQueryFromEditor,
selectQueryFromLandingPage
} from "Support/utils/queries";
import { deleteDownloadsFolder } from "Support/utils/common";
import {
resizeQueryPanel,
verifypreview
} from "Support/utils/dataSource";
import { openNode, verifyNodeData } from "Support/utils/inspector";
describe("RunJS", () => {
beforeEach(() => {
cy.apiLogin();
cy.apiCreateApp(`${fake.companyName}-runjs-App`);
cy.openApp();
cy.viewport(1800, 1800);
cy.dragAndDropWidget("Button");
resizeQueryPanel("80");
deleteDownloadsFolder();
});
it("should verify basic runjs", () => {
const data = {};
data.customText = randomString(12);
selectQueryFromLandingPage("runjs", "JavaScript");
addInputOnQueryField("runjs", "return true");
query("run");
verifypreview("raw", "true");
query("run");
cy.get(commonWidgetSelector.sidebarinspector).click();
cy.get(".tooltip-inner").invoke("hide");
openNode("queries");
openNode("runjs1");
verifyNodeData("data", "Boolean", "true");
verifyNodeData("rawData", "Boolean", "true");
cy.apiDeleteApp();
});
it.skip("should verify global and page data", () => {
const data = {};
data.customText = randomString(12);
selectQueryFromLandingPage("runjs", "JavaScript");
addInputOnQueryField("runjs", "return [page.handle,page.name]");
query("run");
verifypreview("raw", `["home","Home"]`);
addInputOnQueryField("runjs", "return globals.theme");
query("run");
verifypreview("raw", `{"name":"light"}`);
// addInputOnQueryField("runjs", "return globals.currentUser");
// query("preview");
// verifypreview(
// "raw",
// `{"email":"dev@tooljet.io","firstName":"The","lastName":"Developer","groups":["all_users","admin"]}`
// );
addInputOnQueryField("runjs", "return globals.currentUser.email");
query("preview");
verifypreview("raw", `dev@tooljet.io`);
addInputOnQueryField("runjs", "return globals.currentUser.email");
query("preview");
verifypreview("raw", `dev@tooljet.io`);
addInputOnQueryField("runjs", "return globals.currentUser.firstName");
query("preview");
verifypreview("raw", `The`);
addInputOnQueryField("runjs", "return globals.currentUser.lastName");
query("preview");
verifypreview("raw", `Developer`);
addInputOnQueryField("runjs", "return globals.currentUser.groups");
query("preview");
verifypreview("raw", `["all_users","admin"]`);
if (Cypress.env("environment") != "Community") {
addInputOnQueryField("runjs", "return globals.environment.name");
query("preview");
verifypreview("raw", `development`);
addInputOnQueryField(
"runjs",
"return globals.currentUser.ssoUserInfo == undefined"
);
query("preview");
verifypreview("raw", `true`);
}
addInputOnQueryField("runjs", "return globals.mode");
query("preview");
verifypreview("raw", `{"value":"edit"}`);
addInputOnQueryField("runjs", "return constants");
query("preview");
verifypreview("raw", `{}`);
cy.apiDeleteApp();
});
it("should verify action by button", () => {
const data = {};
data.customText = randomString(12);
selectQueryFromLandingPage("runjs", "JavaScript");
addInputOnQueryField(
"runjs",
"actions.showAlert('success', 'alert from runjs');"
);
query("run");
openEditorSidebar("button1");
selectEvent("On Click", "Run query");
cy.get('[data-cy="query-selection-field"]').type("runjs1{enter}");
cy.get(commonWidgetSelector.draggableWidget("button1")).click();
cy.verifyToastMessage(commonSelectors.toastMessage, "alert from runjs");
renameQueryFromEditor("newrunjs");
cy.waitForAutoSave();
cy.get('[data-cy="event-handler"]').click();
cy.get('[data-cy="query-selection-field"]').should("have.text", "newrunjs");
cy.get(commonWidgetSelector.draggableWidget("button1")).click();
cy.verifyToastMessage(commonSelectors.toastMessage, "alert from runjs");
cy.apiDeleteApp();
});
it("should verify runjs toggle options", () => {
cy.intercept("PATCH", "api/data_queries/**").as("editQuery");
const data = {};
data.customText = randomString(12);
selectQueryFromLandingPage("runjs", "JavaScript");
addInputOnQueryField(
"runjs",
"actions.showAlert('success', 'alert from runjs');"
);
cy.get('[data-cy="query-tab-settings"]').click();
changeQueryToggles("run-on-app-load");
// cy.wait(`@editQuery`);
cy.waitForAutoSave();
cy.waitForAutoSave();
cy.reload();
cy.verifyToastMessage(
commonSelectors.toastMessage,
"alert from runjs",
false
);
cy.get('[data-cy="query-tab-settings"]').click();
changeQueryToggles("confirmation-before-run");
// cy.wait(`@editQuery`);
cy.waitForAutoSave();
cy.reload();
cy.get('[data-cy="modal-message"]').verifyVisibleElement(
"have.text",
"Do you want to run this query - runjs1?"
);
cy.get('[data-cy="modal-confirm-button"]').realClick();
cy.verifyToastMessage(commonSelectors.toastMessage, "alert from runjs");
resizeQueryPanel("80");
cy.get('[data-cy="query-tab-settings"]').click();
changeQueryToggles("notification-on-success");
cy.get('[data-cy="success-message-input-field"]').clearAndTypeOnCodeMirror(
"Success alert"
);
cy.get('[data-cy="query-tab-setup"]').click();
cy.get('[data-cy="runjs-input-field"]').realClick();
cy.wait(1000);
cy.waitForAutoSave();
cy.reload();
cy.get('[data-cy="modal-confirm-button"]').realClick();
cy.verifyToastMessage(commonSelectors.toastMessage, "Success alert");
cy.verifyToastMessage(commonSelectors.toastMessage, "alert from runjs");
cy.apiDeleteApp();
});
});

View file

@ -0,0 +1,319 @@
import { fake } from "Fixtures/fake";
import { commonSelectors, commonWidgetSelector } from "Selectors/common";
import { multipageSelector } from "Selectors/multipage";
import {
openEditorSidebar
} from "Support/utils/commonWidget";
import {
randomString
} from "Support/utils/editor/textInput";
import {
selectEvent
} from "Support/utils/events";
import {
addInputOnQueryField,
changeQueryToggles,
query,
renameQueryFromEditor,
selectQueryFromLandingPage,
waitForQueryAction,
} from "Support/utils/queries";
import {
resizeQueryPanel,
verifypreview
} from "Support/utils/dataSource";
import { openNode, verifyNodeData } from "Support/utils/inspector";
import {
addNewPage
} from "Support/utils/multipage";
describe("runpy", () => {
beforeEach(() => {
cy.apiLogin();
cy.apiCreateApp(`${fake.companyName}-runpy-App`);
cy.openApp();
cy.viewport(1800, 1800);
cy.dragAndDropWidget("Button");
resizeQueryPanel("80");
cy.intercept("PATCH", "api/data_queries/**").as("editQuery");
});
it("should verify basic runpy", () => {
const data = {};
data.customText = randomString(12);
selectQueryFromLandingPage("runpy", "Python");
addInputOnQueryField("runpy", "True");
cy.waitForAutoSave();
query("preview");
verifypreview("raw", "true");
query("run");
cy.get(commonWidgetSelector.sidebarinspector).click();
cy.get(".tooltip-inner").invoke("hide");
openNode("queries");
openNode("runpy1");
verifyNodeData("data", "Boolean", "true");
verifyNodeData("rawData", "Boolean", "true");
cy.apiDeleteApp();
});
it.skip("should verify actions", () => {
const data = {};
data.customText = randomString(12);
selectQueryFromLandingPage("runpy", "Python");
addInputOnQueryField(
"runpy",
`actions.setVariable('var', 'test')
actions.setPageVariable('pageVar', 'pageTest')`
);
cy.waitForAutoSave();
query("run");
cy.get(commonWidgetSelector.sidebarinspector).click();
cy.get(".tooltip-inner").invoke("hide");
verifyNodeData("variables", "Object", "1 entry ");
openNode("variables", 0);
verifyNodeData("var", "String", `"test"`);
openNode("page");
openNode("variables", 1);
verifyNodeData("pageVar", "String", `"pageTest"`);
addInputOnQueryField(
"runpy",
`actions.unSetVariable('var')
actions.unsetPageVariable('pageVar')`
);
query("run");
cy.get(commonWidgetSelector.sidebarinspector).click();
cy.get(".tooltip-inner").invoke("hide");
verifyNodeData("variables", "Object", "0 entry ");
openNode("page");
openNode("variables", 1);
verifyNodeData("variables", "Object", "0 entry ", 1);
addInputOnQueryField(
"runpy",
"actions.showAlert('success', 'alert from runpy')"
);
query("run");
cy.verifyToastMessage(
commonSelectors.toastMessage,
"alert from runpy",
false
);
cy.get(multipageSelector.sidebarPageButton).click();
addNewPage("test_page");
cy.url().should("contain", "/test-page");
addInputOnQueryField("runpy", "actions.switchPage('home')");
query("run");
cy.url().should("contain", "/home");
cy.get('[data-cy="real-canvas"]').click("topRight", { force: true });
cy.dragAndDropWidget("Modal", 300, 300);
cy.waitForAutoSave();
addInputOnQueryField("runpy", "actions.showModal('modal1')");
query("run");
cy.get('.text-widget-section > div').should("be.visible");
cy.get('[data-cy="runpy-input-field"]').click({ force: true });
addInputOnQueryField("runpy", "actions.closeModal('modal1')");
// cy.wait(`@editQuery`);
cy.waitForAutoSave();
query("run");
waitForQueryAction("run");
cy.notVisible('[data-cy="modal-title"]');
addInputOnQueryField("runpy", "actions.copyToClipboard('data from runpy')");
// cy.wait(`@editQuery`);
cy.waitForAutoSave();
query("run");
waitForQueryAction("run");
cy.window().then((win) => {
win.navigator.clipboard.readText().then((text) => {
expect(text).to.eq("data from runpy");
});
});
addInputOnQueryField(
"runpy",
"actions.setLocalStorage('localStorage','data from runpy')"
);
// cy.wait(`@editQuery`);
cy.waitForAutoSave();
query("run");
waitForQueryAction("run");
cy.getAllLocalStorage().then((result) => {
expect(result[Cypress.config().baseUrl].localStorage).to.deep.equal(
"data from runpy"
);
});
// addInputOnQueryField( //Need fix asap
// "runpy",
// "actions.generateFile('runpycsv', 'csv', [{ 'name': 'John', 'email': 'john@tooljet.com' }])"
// );
// query("run");
// cy.wait(3000);
// cy.readFile("cypress/downloads/runpycsv.csv", "utf-8")
// .should("contain", "name,email")
// .and("contain", "John,john@tooljet.com");
// addInputOnQueryField(
// "runpy",
// "actions.goToApp('111234')"
// );
// query("run");
addInputOnQueryField("runpy", "actions.logout()");
// cy.wait(`@editQuery`);
cy.wait(200);
cy.waitForAutoSave();
query("run");
cy.get('[data-cy="sign-in-header"]', { timeout: 20000 }).should(
"be.visible"
);
});
it.skip("should verify global and page data", () => {
const data = {};
data.customText = randomString(12);
selectQueryFromLandingPage("runpy", "Python");
addInputOnQueryField("runpy", "tj_globals.theme");
cy.waitForAutoSave();
query("preview");
verifypreview("raw", `{"name":"light"}`);
addInputOnQueryField("runpy", "tj_globals.currentUser.email");
query("preview");
verifypreview("raw", `dev@tooljet.io`);
addInputOnQueryField("runpy", "tj_globals.currentUser.email");
query("preview");
verifypreview("raw", `dev@tooljet.io`);
addInputOnQueryField("runpy", "tj_globals.currentUser.firstName");
query("preview");
verifypreview("raw", `The`);
addInputOnQueryField("runpy", "tj_globals.currentUser.lastName");
query("preview");
verifypreview("raw", `Developer`);
addInputOnQueryField("runpy", "tj_globals.currentUser.groups");
query("preview");
cy.verifyToastMessage(
commonSelectors.toastMessage,
"Query (runpy1) completed."
);
waitForQueryAction("preview");
verifypreview("raw", `["all_users","admin"]`);
if (Cypress.env("environment") != "Community") {
addInputOnQueryField("runpy", "tj_globals.environment.name");
query("preview");
verifypreview("raw", `development`);
// addInputOnQueryField( //WIP
// "runpy",
// "(tj_globals.currentUser.ssoUserInfo == undefined)"
// );
// query("preview");
// verifypreview("raw", `true`);
}
addInputOnQueryField("runpy", "tj_globals.mode.value");
query("preview");
verifypreview("raw", `edit`);
addInputOnQueryField("runpy", "constants");
query("preview");
waitForQueryAction("preview");
verifypreview("raw", `{}`);
cy.apiDeleteApp();
});
it("should verify action by button", () => {
const data = {};
data.customText = randomString(12);
selectQueryFromLandingPage("runpy", "Python");
addInputOnQueryField(
"runpy",
"actions.showAlert('success', 'alert from runpy');"
);
cy.waitForAutoSave();
query("run");
openEditorSidebar("button1");
selectEvent("On Click", "Run query");
cy.get('[data-cy="query-selection-field"]').type("runpy1{enter}");
cy.get(commonWidgetSelector.draggableWidget("button1")).click();
cy.verifyToastMessage(commonSelectors.toastMessage, "alert from runpy");
renameQueryFromEditor("newrunpy");
cy.get('[data-cy="event-handler"]').click();
cy.get('[data-cy="query-selection-field"]').should("have.text", "newrunpy");
cy.get(commonWidgetSelector.draggableWidget("button1")).click();
cy.verifyToastMessage(commonSelectors.toastMessage, "alert from runpy");
cy.apiDeleteApp();
});
it("should verify runpy toggle options", () => {
const data = {};
data.customText = randomString(12);
selectQueryFromLandingPage("runpy", "Python");
cy.waitForAutoSave();
addInputOnQueryField(
"runpy",
"actions.showAlert('success', 'alert from runpy');"
);
cy.get('[data-cy="query-tab-settings"]').click();
// cy.wait("@editQuery");
cy.wait(200);
cy.waitForAutoSave();
changeQueryToggles("run-on-app-load");
// cy.wait("@editQuery");
cy.waitForAutoSave();
cy.reload();
cy.verifyToastMessage(commonSelectors.toastMessage, "alert from runpy");
cy.get('[data-cy="query-tab-settings"]').click();
changeQueryToggles("confirmation-before-run");
// cy.wait("@editQuery");
cy.wait(200);
cy.waitForAutoSave();
cy.reload();
cy.get('[data-cy="modal-message"]').verifyVisibleElement(
"have.text",
"Do you want to run this query - runpy1?"
);
cy.get('[data-cy="modal-confirm-button"]').realClick();
cy.verifyToastMessage(commonSelectors.toastMessage, "alert from runpy");
cy.get('[data-cy="query-tab-settings"]').click();
changeQueryToggles("notification-on-success");
cy.get('[data-cy="success-message-input-field"]').clearAndTypeOnCodeMirror(
"Success alert"
);
cy.forceClickOnCanvas();
// cy.wait("@editQuery");
cy.wait(200);
cy.waitForAutoSave();
cy.reload();
cy.get('[data-cy="modal-confirm-button"]', { timeout: 10000 }).realClick();
cy.verifyToastMessage(commonSelectors.toastMessage, "Success alert", false);
cy.verifyToastMessage(
commonSelectors.toastMessage,
"alert from runpy",
false
);
cy.apiDeleteApp();
});
});

View file

@ -0,0 +1,221 @@
import { fake } from "Fixtures/fake";
import { postgreSqlSelector } from "Selectors/postgreSql";
import { postgreSqlText } from "Texts/postgreSql";
import { commonSelectors } from "Selectors/common";
import { selectAndAddDataSource } from "Support/utils/postgreSql";
import { closeDSModal } from "Support/utils/dataSource";
const data = {};
data.dsNamefake = fake.lastName.toLowerCase().replaceAll("[^A-Za-z]", "");
data.dsNamefake1 = fake.lastName.toLowerCase().replaceAll("[^A-Za-z]", "");
const cyParamName = (name) => name.toLowerCase().replace(/[^a-z0-9]/g, "-");
data.workspaceName = fake.lastName.toLowerCase().replaceAll("[^A-Za-z]", "");
data.workspaceSlug = fake.lastName.toLowerCase().replace(/\s+/g, "-");
const dataSources = [
"BigQuery",
"ClickHouse",
"CosmosDB",
"CouchDB",
"Databricks",
"DynamoDB",
"Elasticsearch",
"Firestore",
"InfluxDB",
"MariaDB",
"MongoDB",
"SQL Server",
"MySQL",
"Oracle DB",
"PostgreSQL",
"Redis",
"RethinkDB",
"SAP HANA",
"Snowflake",
"TypeSense",
"Airtable",
"Amazon SES",
"Appwrite",
"Amazon Athena",
"Baserow",
// "Google Sheets", need to remove
"GraphQL",
// "gRPC", need to remove
"Mailgun",
"n8n",
"Notion",
"OpenAPI",
"REST API",
"SendGrid",
// "Slack", need to remove
"SMTP",
"Stripe",
"Twilio",
"Woocommerce",
//"Zendesk", need to remove
"Azure Blob Storage",
"GCS",
"Minio",
"AWS S3",
];
describe("Add all Data sources to app", () => {
beforeEach(() => {
cy.apiLogin();
});
it.skip("Should verify global data source page", () => {
cy.apiCreateWorkspace(data.workspaceName, data.workspaceSlug);
cy.visit(`${data.workspaceSlug}`);
cy.get(commonSelectors.globalDataSourceIcon).click();
closeDSModal();
cy.get(postgreSqlSelector.allDatasourceLabelAndCount).should(
"have.text",
postgreSqlText.allDataSources()
);
cy.get(postgreSqlSelector.commonlyUsedLabelAndCount).should(
"have.text",
postgreSqlText.commonlyUsed
);
cy.get(postgreSqlSelector.cloudStorageLabelAndCount).should(
"have.text",
postgreSqlText.allCloudStorage
);
});
it.skip("Should add all data sources in data source page", () => {
cy.visit(`${data.workspaceSlug}`);
dataSources.forEach((dsName) => {
cy.get(commonSelectors.globalDataSourceIcon).click();
selectAndAddDataSource("databases", dsName, dsName); // Using the correct fake name
// Test connection
// cy.get(postgreSqlSelector.buttonTestConnection).click();
// cy.get(postgreSqlSelector.textConnectionVerified, {
// timeout: 10000,
// }).should("have.text", postgreSqlText.labelConnectionVerified);
// // Save data source
// cy.get(postgreSqlSelector.buttonSave).click();
// cy.verifyToastMessage(
// commonSelectors.toastMessage,
// `Data Source ${dsName} saved.`
// );
});
});
it.skip("Should add all data sources in the app", () => {
cy.visit(`${data.workspaceSlug}`);
cy.get(commonSelectors.dashboardIcon).click();
cy.get(commonSelectors.appCreateButton).click();
cy.get(commonSelectors.appNameInput).click().type(data.dsNamefake);
cy.get(commonSelectors.createAppButton).click();
cy.skipWalkthrough();
cy.wrap(dataSources).each((dsName) => {
cy.get('[data-cy="show-ds-popover-button"]').click();
cy.get(".css-4e90k9").type(
`cypress-${cyParamName(dsName)}-${cyParamName(dsName)}`
);
cy.wait(500);
cy.contains(
`[id*="react-select-"]`,
`cypress-${cyParamName(dsName)}-${cyParamName(dsName)}`
)
.should("be.visible")
.click();
cy.wait(500);
});
});
it.skip("Should install all makretplace plugins and add them into the app", () => {
cy.visit(`${data.workspaceSlug}`);
const dataSourcesMarketplace = [
"Plivo",
"GitHub",
"OpenAI",
"AWS Textract",
"HarperDB",
"AWS Redshift",
"PocketBase",
"AWS Lambda",
"Supabase",
"Engagespot",
// "Salesforce", need to remove
"Presto",
"Jira",
// "Sharepoint", need to remove
"Portkey",
"Pinecone",
"Hugging Face",
"Cohere",
"Gemini",
"Mistral",
"Anthropic",
"Qdrant",
"Weaviate DB",
];
cy.get(commonSelectors.globalDataSourceIcon).click();
cy.window().then((win) => {
cy.stub(win, "open").callsFake((url) => {
win.location.href = url;
});
});
cy.get('[data-cy="data-source-add-plugin"]').click();
cy.get(".marketplace-install").each(($el) => {
cy.wrap($el).click();
cy.wait(500);
cy.get(commonSelectors.toastMessage).should("include.text", "installed");
});
cy.wait(1000);
cy.get(commonSelectors.globalDataSourceIcon).click();
cy.get(commonSelectors.pageSectionHeader).should(
"have.text",
"Data sources"
);
cy.wrap(dataSourcesMarketplace).each((dsName) => {
cy.get(commonSelectors.globalDataSourceIcon).click();
selectAndAddDataSource("databases", dsName, dsName);
cy.wait(1000);
});
cy.get(commonSelectors.dashboardIcon).should("be.visible").click();
cy.get(commonSelectors.appCreateButton).should("be.visible").click();
cy.get(commonSelectors.appNameInput)
.should("be.visible")
.click()
.type(data.dsNamefake1);
cy.get(commonSelectors.createAppButton).click();
cy.skipWalkthrough();
cy.wrap(dataSourcesMarketplace).each((dsName) => {
cy.get('[data-cy="show-ds-popover-button"]').click();
cy.get(".css-4e90k9").type(
`cypress-${cyParamName(dsName)}-${cyParamName(dsName)}`
);
cy.wait(1000);
cy.contains(
`[id*="react-select-"]`,
`cypress-${cyParamName(dsName)}-${cyParamName(dsName)}`
)
.should("be.visible")
.click();
cy.wait(1000);
});
});
});

View file

@ -0,0 +1,349 @@
import { fake } from "Fixtures/fake";
import { postgreSqlSelector, airTableSelector } from "Selectors/postgreSql";
import { postgreSqlText } from "Texts/postgreSql";
import { airtableText } from "Texts/airTable";
import { commonSelectors } from "Selectors/common";
import { closeDSModal } from "Support/utils/dataSource";
import { dataSourceSelector } from "../../../../../constants/selectors/dataSource";
const data = {};
data.queryName = fake.lastName.toLowerCase().replaceAll("[^A-Za-z]", "");
const airTable_apiKey = Cypress.env("airTable_apikey");
const airTable_baseId = Cypress.env("airtabelbaseId");
const airTable_tableName = Cypress.env("airtable_tableName");
const airTable_recordID = Cypress.env("airtable_recordId");
describe("Data source Airtable", () => {
beforeEach(() => {
cy.apiLogin();
cy.visit("/");
data.dsName = fake.lastName.toLowerCase().replaceAll("[^A-Za-z]", "");
});
it("Should verify elements on connection AirTable form", () => {
cy.get(commonSelectors.globalDataSourceIcon).click();
closeDSModal();
cy.get(postgreSqlSelector.allDatasourceLabelAndCount).should(
"have.text",
postgreSqlText.allDataSources()
);
cy.get(postgreSqlSelector.commonlyUsedLabelAndCount).should(
"have.text",
postgreSqlText.commonlyUsed
);
cy.get(postgreSqlSelector.databaseLabelAndCount).should(
"have.text",
postgreSqlText.allDatabase()
);
cy.get(postgreSqlSelector.apiLabelAndCount).should(
"have.text",
postgreSqlText.allApis
);
cy.get(postgreSqlSelector.cloudStorageLabelAndCount).should(
"have.text",
postgreSqlText.allCloudStorage
);
cy.apiCreateGDS(
`${Cypress.env("server_host")}/api/data-sources`,
`cypress-${data.dsName}-airtable`,
"airtable",
[
{
key: "personal_access_token",
value: `${Cypress.env("airTable_apikey")}`,
encrypted: true,
},
]
);
cy.reload();
cy.get(
dataSourceSelector.dataSourceNameButton(`cypress-${data.dsName}-airtable`)
)
.should("be.visible")
.click();
cy.get(
dataSourceSelector.labelFieldName(airtableText.ApiKey)
).verifyVisibleElement("have.text", `${airtableText.ApiKey}*`);
cy.get(postgreSqlSelector.labelEncryptedText).verifyVisibleElement(
"have.text",
postgreSqlText.labelEncrypted
);
cy.get(dataSourceSelector.button(postgreSqlText.editButtonText)).should(
"be.visible"
);
cy.get(dataSourceSelector.button(postgreSqlText.editButtonText)).click();
cy.verifyRequiredFieldValidation(airtableText.ApiKey, "rgb(226, 99, 103)");
cy.get(dataSourceSelector.textField(airtableText.ApiKey)).should(
"be.visible"
);
cy.get(postgreSqlSelector.labelIpWhitelist).verifyVisibleElement(
"have.text",
postgreSqlText.whiteListIpText
);
cy.get(postgreSqlSelector.buttonCopyIp).verifyVisibleElement(
"have.text",
postgreSqlText.textCopy
);
cy.get(postgreSqlSelector.linkReadDocumentation).verifyVisibleElement(
"have.text",
postgreSqlText.readDocumentation
);
cy.get(postgreSqlSelector.buttonTestConnection)
.verifyVisibleElement(
"have.text",
postgreSqlText.buttonTextTestConnection
)
.click();
cy.get(postgreSqlSelector.connectionFailedText).verifyVisibleElement(
"have.text",
postgreSqlText.couldNotConnect
);
cy.get(postgreSqlSelector.buttonSave)
.verifyVisibleElement("have.text", postgreSqlText.buttonTextSave)
.and("be.disabled");
cy.get(dataSourceSelector.connectionAlertText).verifyVisibleElement(
"have.text",
airtableText.invalidAccessToken
);
cy.apiDeleteGDS(`cypress-${data.dsName}-airtable`);
});
it("Should verify the functionality of AirTable connection form.", () => {
cy.get(commonSelectors.globalDataSourceIcon).click();
cy.apiCreateGDS(
`${Cypress.env("server_host")}/api/data-sources`,
`cypress-${data.dsName}-airtable`,
"airtable",
[
{
key: "personal_access_token",
value: "Invalid access token",
encrypted: true,
},
]
);
cy.get(
dataSourceSelector.dataSourceNameButton(`cypress-${data.dsName}-airtable`)
)
.should("be.visible")
.click();
cy.get(postgreSqlSelector.buttonTestConnection).click();
cy.get(dataSourceSelector.connectionFailedText, {
timeout: 10000,
}).should("have.text", postgreSqlText.couldNotConnect);
cy.get(dataSourceSelector.connectionAlertText).verifyVisibleElement(
"have.text",
airtableText.invalidAccessToken
);
cy.reload();
cy.apiUpdateGDS({
name: `cypress-${data.dsName}-airtable`,
options: [
{
key: "personal_access_token",
value: `${Cypress.env("airTable_apikey")}`,
encrypted: true,
},
],
});
cy.get(
dataSourceSelector.dataSourceNameButton(`cypress-${data.dsName}-airtable`)
)
.should("be.visible")
.click();
cy.get(postgreSqlSelector.buttonTestConnection).click();
cy.get(postgreSqlSelector.textConnectionVerified, {
timeout: 10000,
}).should("have.text", postgreSqlText.labelConnectionVerified);
cy.apiDeleteGDS(`cypress-${data.dsName}-airtable`);
});
it("Should able to run the query with valid conection", () => {
cy.apiCreateGDS(
`${Cypress.env("server_host")}/api/data-sources`,
`cypress-${data.dsName}-airtable`,
"airtable",
[
{
key: "personal_access_token",
value: `${airTable_apiKey}`,
encrypted: true,
},
]
);
cy.apiCreateApp(`${data.dsName}-airtable-app`);
cy.openApp();
cy.get('[data-cy="show-ds-popover-button"]').click();
cy.get(".css-4e90k9").type(`${data.dsName}`);
cy.contains(`[id*="react-select-"]`, data.dsName).click();
cy.get('[data-cy="query-rename-input"]').clear().type(data.dsName);
// Verfiy List Recored operation
cy.get(airTableSelector.operationSelectDropdown)
.click()
.type("List records{enter}");
cy.get(airTableSelector.baseIdInputField).clearAndTypeOnCodeMirror(
airTable_baseId
);
cy.get(airTableSelector.tableNameInputField).clearAndTypeOnCodeMirror(
airTable_tableName
);
cy.get(dataSourceSelector.queryPreviewButton).click();
// cy.verifyToastMessage(
// commonSelectors.toastMessage,
// `Query (${data.dsName}) completed.`
// );
// Verfiy Retrieve record operation
cy.get(airTableSelector.operationSelectDropdown)
.click()
.type("Retrieve record{enter}");
cy.get(airTableSelector.baseIdInputField).clearAndTypeOnCodeMirror(
airTable_baseId
);
cy.get(airTableSelector.tableNameInputField).clearAndTypeOnCodeMirror(
airTable_tableName
);
cy.get(airTableSelector.recordIdInputField).clearAndTypeOnCodeMirror(
airTable_recordID
);
cy.get(dataSourceSelector.queryPreviewButton).click();
// cy.verifyToastMessage(
// commonSelectors.toastMessage,
// `Query (${data.dsName}) completed.`
// );
// Verfiy Create record operation
cy.get(airTableSelector.operationSelectDropdown)
.click()
.type("Create record{enter}");
cy.get(airTableSelector.baseIdInputField).clearAndTypeOnCodeMirror(
airTable_baseId
);
cy.get(airTableSelector.tableNameInputField).clearAndTypeOnCodeMirror(
airTable_tableName
);
cy.get(airTableSelector.bodyInputField)
.realClick()
.realType('[{"', { force: true, delay: 0 })
.realType("fields", { force: true, delay: 0 })
.realType('": {}', { force: true, delay: 0 });
cy.get(dataSourceSelector.queryPreviewButton).click();
// cy.verifyToastMessage(
// commonSelectors.toastMessage,
// `Query (${data.dsName}) completed.`
// );
// Verfiy Update record operation
cy.get('[data-cy="show-ds-popover-button"]').click();
cy.get(".css-4e90k9").type(`${data.dsName}`);
cy.contains(`[id*="react-select-"]`, data.dsName).click();
cy.get('[data-cy="query-rename-input"]').clear().type(data.queryName);
cy.get(airTableSelector.operationSelectDropdown)
.click()
.type("Update record{enter}");
cy.get(airTableSelector.baseIdInputField).clearAndTypeOnCodeMirror(
airTable_baseId
);
cy.get(airTableSelector.tableNameInputField).clearAndTypeOnCodeMirror(
airTable_tableName
);
cy.get(airTableSelector.recordIdInputField).clearAndTypeOnCodeMirror(
airTable_recordID
);
cy.get(airTableSelector.bodyInputField)
.realClick()
.realType("{", { force: true, delay: 0 })
.realType("{enter}", { force: true, delay: 0 })
.realType('"Phone Number": "555_98"', { force: true, delay: 0 });
cy.get(dataSourceSelector.queryPreviewButton).click();
// cy.verifyToastMessage(
// commonSelectors.toastMessage,
// `Query (${data.queryName}) completed.`
// );
// Verify Delete record operation
cy.get(airTableSelector.operationSelectDropdown)
.click()
.type("Delete record{enter}");
const recordId = Cypress._.uniqueId("recDummy_");
cy.request({
method: "POST",
url: `https://api.airtable.com/v0/${airTable_baseId}/${airTable_tableName}`,
headers: {
Authorization: `Bearer ${Cypress.env("airTable_apikey")}`,
"Content-Type": "application/json",
},
body: {
records: [
{
fields: {
"Employee ID": "E005",
"First Name": "test",
"Last Name": "abc",
Email: "doe@example.com",
"Phone Number": "555-12",
},
},
],
},
}).then((createResponse) => {
const newRecordId = createResponse.body.records[0].id;
cy.get(airTableSelector.operationSelectDropdown)
.click()
.type("Delete record{enter}");
cy.get(airTableSelector.baseIdInputField).clearAndTypeOnCodeMirror(
airTable_baseId
);
cy.get(airTableSelector.tableNameInputField).clearAndTypeOnCodeMirror(
airTable_tableName
);
cy.get(airTableSelector.recordIdInputField).clearAndTypeOnCodeMirror(
newRecordId
);
cy.get(dataSourceSelector.queryPreviewButton).click();
// cy.verifyToastMessage(
// commonSelectors.toastMessage,
// `Query (${data.queryName}) completed.`
// );
cy.apiDeleteApp(`${data.dsName}-airtable-app`);
cy.apiDeleteGDS(`cypress-${data.dsName}-airtable`);
});
});
});

View file

@ -0,0 +1,208 @@
import { fake } from "Fixtures/fake";
import { postgreSqlSelector } from "Selectors/postgreSql";
import { pluginSelectors } from "Selectors/plugins";
import { postgreSqlText } from "Texts/postgreSql";
import { amazonSesText } from "Texts/amazonSes";
import { amazonAthenaText } from "Texts/amazonAthena";
import { commonSelectors } from "Selectors/common";
import { commonText } from "Texts/common";
import {
fillDataSourceTextField,
selectAndAddDataSource,
} from "Support/utils/postgreSql";
import {
deleteDatasource,
closeDSModal,
deleteAppandDatasourceAfterExecution,
} from "Support/utils/dataSource";
import { dataSourceSelector } from "../../../../../constants/selectors/dataSource";
const data = {};
describe("Data source amazon athena", () => {
beforeEach(() => {
cy.apiLogin();
cy.visit("/");
data.dsName = fake.lastName.toLowerCase().replaceAll("[^A-Za-z]", "");
});
it.skip("Should verify elements on amazon athena connection form", () => {
const Accesskey = Cypress.env("amazonathena_accessKey");
const Secretkey = Cypress.env("amazonathena_secretKey");
const DbName = Cypress.env("amazonathena_DbName");
cy.get(commonSelectors.globalDataSourceIcon).click();
closeDSModal();
cy.get(postgreSqlSelector.allDatasourceLabelAndCount).should(
"have.text",
postgreSqlText.allDataSources()
);
cy.get(postgreSqlSelector.commonlyUsedLabelAndCount).should(
"have.text",
postgreSqlText.commonlyUsed
);
cy.get(postgreSqlSelector.databaseLabelAndCount).should(
"have.text",
postgreSqlText.allDatabase()
);
cy.get(postgreSqlSelector.apiLabelAndCount).should(
"have.text",
postgreSqlText.allApis
);
cy.get(postgreSqlSelector.cloudStorageLabelAndCount).should(
"have.text",
postgreSqlText.allCloudStorage
);
selectAndAddDataSource(
"databases",
amazonAthenaText.AmazonAthena,
data.dsName
);
cy.get(pluginSelectors.amazonAthenaDbName).click().type(DbName);
cy.get(pluginSelectors.amazonsesAccesKey).click().type(" ");
fillDataSourceTextField(
amazonSesText.labelSecretKey,
amazonAthenaText.placeholderSecretKey,
Secretkey
);
cy.get(".react-select__dropdown-indicator").eq(1).click();
cy.get(".react-select__option").contains("US West (N. California)").click();
cy.get(postgreSqlSelector.buttonTestConnection)
.verifyVisibleElement(
"have.text",
postgreSqlText.buttonTextTestConnection
)
.click();
cy.get(postgreSqlSelector.connectionFailedText).verifyVisibleElement(
"have.text",
postgreSqlText.couldNotConnect
);
cy.get(postgreSqlSelector.buttonSave)
.verifyVisibleElement("have.text", postgreSqlText.buttonTextSave)
.click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
postgreSqlText.toastDSSaved
);
deleteDatasource(`cypress-${data.dsName}-Amazon-Athena`);
});
it.skip("Should verify the functionality of amazon athena connection form.", () => {
const Accesskey = Cypress.env("amazonathena_accessKey");
const Secretkey = Cypress.env("amazonathena_secretKey");
const DbName = Cypress.env("amazonathena_DbName");
selectAndAddDataSource(
"databases",
amazonAthenaText.AmazonAthena,
data.dsName
);
cy.get(pluginSelectors.amazonAthenaDbName).click().type(DbName);
cy.get(pluginSelectors.amazonsesAccesKey).click().type(Accesskey);
fillDataSourceTextField(
amazonSesText.labelSecretKey,
amazonAthenaText.placeholderSecretKey,
Secretkey
);
cy.get(".react-select__dropdown-indicator").eq(1).click();
cy.get(".react-select__option").contains("US West (N. California)").click();
cy.get(postgreSqlSelector.buttonTestConnection).click();
cy.get(postgreSqlSelector.textConnectionVerified, {
timeout: 10000,
}).should("have.text", postgreSqlText.labelConnectionVerified);
cy.get(postgreSqlSelector.buttonSave).click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
postgreSqlText.toastDSSaved
);
deleteDatasource(`cypress-${data.dsName}-amazon-Athena`);
});
it.skip("Should able to run the query with valid conection", () => {
const Accesskey = Cypress.env("amazonathena_accessKey");
const Secretkey = Cypress.env("amazonathena_secretKey");
const DbName = Cypress.env("amazonathena_DbName");
selectAndAddDataSource(
"databases",
amazonAthenaText.AmazonAthena,
data.dsName
);
cy.get(pluginSelectors.amazonAthenaDbName).click().type(DbName);
fillDataSourceTextField(
amazonAthenaText.labelAccesskey,
amazonAthenaText.placeholderEnteraAccessKey,
Cypress.env("amazonathena_accessKey")
);
fillDataSourceTextField(
amazonAthenaText.labelSecretKey,
amazonAthenaText.placeholderSecretKey,
Cypress.env("amazonathena_secretKey")
);
cy.get(".react-select__dropdown-indicator").eq(1).click();
cy.get(".react-select__option").contains("US West (N. California)").click();
cy.get(postgreSqlSelector.buttonTestConnection).click();
cy.get(postgreSqlSelector.textConnectionVerified, {
timeout: 10000,
}).should("have.text", postgreSqlText.labelConnectionVerified);
cy.get(postgreSqlSelector.buttonSave).click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
postgreSqlText.toastDSSaved
);
cy.get(commonSelectors.globalDataSourceIcon).click();
cy.get(
`[data-cy="cypress-${data.dsName}-amazon-athena-button"]`
).verifyVisibleElement("have.text", `cypress-${data.dsName}-amazon-athena`);
cy.wait(1000);
cy.get(commonSelectors.dashboardIcon).click();
cy.get(commonSelectors.appCreateButton).click();
cy.get(commonSelectors.appNameInput).click().type(data.dsName);
cy.get(commonSelectors.createAppButton).click();
cy.skipWalkthrough();
cy.get('[data-cy="show-ds-popover-button"]').click();
cy.get(".css-4e90k9").type(`${data.dsName}`);
cy.contains(`[id*="react-select-"]`, data.dsName).click();
cy.get('[data-cy="query-rename-input"]').clear().type(data.dsName);
cy.get(`[data-cy="list-query-${data.dsName}"]`).should("be.visible");
cy.get('[data-cy="query-input-field"]').clearAndTypeOnCodeMirror(
"SHOW DATABASES;"
);
cy.get(
'[data-cy="query-input-field"] >>> .cm-editor >> .cm-content > .cm-line'
).should("have.text", "SHOW DATABASES;");
cy.get(dataSourceSelector.queryPreviewButton).click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
`Query (${data.dsName}) completed.`
);
deleteAppandDatasourceAfterExecution(
data.dsName,
`cypress-${data.dsName}-amazon-Athena`
);
});
});

View file

@ -0,0 +1,204 @@
import { fake } from "Fixtures/fake";
import { postgreSqlSelector } from "Selectors/postgreSql";
import { pluginSelectors } from "Selectors/plugins";
import { postgreSqlText } from "Texts/postgreSql";
import { amazonSesText } from "Texts/amazonSes";
import { commonSelectors } from "Selectors/common";
import { commonText } from "Texts/common";
import {
fillDataSourceTextField,
selectAndAddDataSource,
} from "Support/utils/postgreSql";
import {
deleteDatasource,
closeDSModal,
deleteAppandDatasourceAfterExecution,
} from "Support/utils/dataSource";
import { dataSourceSelector } from "../../../../../constants/selectors/dataSource";
const data = {};
describe("Data source amazon ses", () => {
beforeEach(() => {
cy.apiLogin();
cy.visit("/");
data.dsName = fake.lastName.toLowerCase().replaceAll("[^A-Za-z]", "");
});
it.skip("Should verify elements on amazonses connection form", () => {
const Accesskey = Cypress.env("amazonSes_accessKey");
const Secretkey = Cypress.env("amazonSes_secretKey");
cy.get(commonSelectors.globalDataSourceIcon).click();
closeDSModal();
cy.get(postgreSqlSelector.allDatasourceLabelAndCount).should(
"have.text",
postgreSqlText.allDataSources()
);
cy.get(postgreSqlSelector.commonlyUsedLabelAndCount).should(
"have.text",
postgreSqlText.commonlyUsed
);
cy.get(postgreSqlSelector.databaseLabelAndCount).should(
"have.text",
postgreSqlText.allDatabase()
);
cy.get(postgreSqlSelector.apiLabelAndCount).should(
"have.text",
postgreSqlText.allApis
);
cy.get(postgreSqlSelector.cloudStorageLabelAndCount).should(
"have.text",
postgreSqlText.allCloudStorage
);
selectAndAddDataSource("databases", amazonSesText.AmazonSES, data.dsName);
cy.get(".react-select__dropdown-indicator").eq(1).click();
cy.get(".react-select__option").contains("US West (N. California)").click();
cy.get(pluginSelectors.amazonsesAccesKey).click().type(Accesskey);
fillDataSourceTextField(
amazonSesText.labelSecretKey,
"**************",
Secretkey
);
cy.get(postgreSqlSelector.buttonSave)
.verifyVisibleElement("have.text", postgreSqlText.buttonTextSave)
.click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
postgreSqlText.toastDSSaved
);
deleteDatasource(`cypress-${data.dsName}-Amazon-ses`);
});
it.skip("Should verify the functionality of amazonses connection form.", () => {
selectAndAddDataSource("databases", amazonSesText.AmazonSES, data.dsName);
cy.get(".react-select__dropdown-indicator").eq(1).click();
cy.get(".react-select__option").contains("US West (N. California)").click();
fillDataSourceTextField(
amazonSesText.labelAccesskey,
amazonSesText.placeholderAccessKey,
Cypress.env("amazonSes_accessKey")
);
fillDataSourceTextField(
amazonSesText.labelSecretKey,
amazonSesText.placeholderSecretKey,
Cypress.env("amazonSes_secretKey")
);
cy.get(postgreSqlSelector.buttonSave).click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
postgreSqlText.toastDSSaved
);
cy.get(commonSelectors.globalDataSourceIcon).click();
cy.get(
`[data-cy="cypress-${data.dsName}-amazon-ses-button"]`
).verifyVisibleElement("have.text", `cypress-${data.dsName}-amazon-ses`);
deleteDatasource(`cypress-${data.dsName}-amazon-ses`);
});
it.skip("Should able to run the query with valid conection", () => {
const email = "adish" + "@" + "tooljet.com";
selectAndAddDataSource("databases", amazonSesText.AmazonSES, data.dsName);
cy.get(".react-select__dropdown-indicator").eq(1).click();
cy.get(".react-select__option").contains("US West (N. California)").click();
fillDataSourceTextField(
amazonSesText.labelAccesskey,
amazonSesText.placeholderAccessKey,
Cypress.env("amazonSes_accessKey")
);
fillDataSourceTextField(
amazonSesText.labelSecretKey,
amazonSesText.placeholderSecretKey,
Cypress.env("amazonSes_secretKey")
);
cy.get(postgreSqlSelector.buttonSave).click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
postgreSqlText.toastDSSaved
);
cy.get(commonSelectors.globalDataSourceIcon).click();
cy.get(
`[data-cy="cypress-${data.dsName}-amazon-ses-button"]`
).verifyVisibleElement("have.text", `cypress-${data.dsName}-amazon-ses`);
cy.wait(1000);
cy.get(commonSelectors.dashboardIcon).click();
cy.get(commonSelectors.appCreateButton).click();
cy.get(commonSelectors.appNameInput).click().type(data.dsName);
cy.get(commonSelectors.createAppButton).click();
cy.skipWalkthrough();
cy.get('[data-cy="show-ds-popover-button"]').click();
cy.get(".css-4e90k9").type(`${data.dsName}`);
cy.contains(`[id*="react-select-"]`, data.dsName).click();
cy.get('[data-cy="query-rename-input"]').clear().type(data.dsName);
cy.get(pluginSelectors.operationDropdown)
.click()
.type("Email service{enter}");
cy.wait(500);
cy.get(pluginSelectors.sendEmailInputField)
.realClick()
.realType('{{["', { force: true, delay: 0 })
.realType("mekhla@tooljet.com", { force: true, delay: 0 });
cy.get(pluginSelectors.ccEmailInputField)
.realClick()
.realType('{{["', { force: true, delay: 0 })
.realType("mani@tooljet.com", { force: true, delay: 0 });
cy.get(pluginSelectors.bccEmailInputField)
.realClick()
.realType('{{["', { force: true, delay: 0 })
.realType("midhun@tooljet.com", { force: true, delay: 0 });
cy.get(pluginSelectors.sendEmailFromInputField)
.realClick()
.realType("adish", { force: true, delay: 0 })
.realType("@", { force: true, delay: 0 })
.realType("tooljet.com", { force: true, delay: 0 });
cy.get(pluginSelectors.emailSubjetInputField).clearAndTypeOnCodeMirror(
"Testmail for amazon ses"
);
cy.get(pluginSelectors.emailbodyInputField).clearAndTypeOnCodeMirror(
"Body text for amazon ses"
);
cy.wait(1000);
cy.get(dataSourceSelector.queryPreviewButton).click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
`Query (${data.dsName}) completed.`
);
deleteAppandDatasourceAfterExecution(
data.dsName,
`cypress-${data.dsName}-amazon-ses`
);
});
});

View file

@ -0,0 +1,314 @@
import { fake } from "Fixtures/fake";
import { postgreSqlSelector } from "Selectors/postgreSql";
import { postgreSqlText } from "Texts/postgreSql";
import { appwriteText } from "Texts/appWrite";
import { appWriteSelectors } from "Selectors/Plugins";
import { commonSelectors } from "Selectors/common";
import { commonText } from "Texts/common";
import {
fillDataSourceTextField,
selectAndAddDataSource,
} from "Support/utils/postgreSql";
import {
deleteDatasource,
closeDSModal,
deleteAppandDatasourceAfterExecution,
} from "Support/utils/dataSource";
import { dataSourceSelector } from "../../../../../constants/selectors/dataSource";
const data = {};
describe("Data source AppWrite", () => {
beforeEach(() => {
cy.apiLogin();
cy.visit("/");
data.dsName = fake.lastName.toLowerCase().replaceAll("[^A-Za-z]", "");
});
it.skip("Should verify elements on appwrite connection form", () => {
const Host = Cypress.env("appwrite_host");
const ProjectID = Cypress.env("appwrite_projectID");
const DatabaseID = Cypress.env("appwrite_databaseID");
const SecretKey = Cypress.env("appwrite_secretkey");
cy.get(commonSelectors.globalDataSourceIcon).click();
closeDSModal();
cy.get(postgreSqlSelector.allDatasourceLabelAndCount).should(
"have.text",
postgreSqlText.allDataSources()
);
cy.get(postgreSqlSelector.commonlyUsedLabelAndCount).should(
"have.text",
postgreSqlText.commonlyUsed
);
cy.get(postgreSqlSelector.databaseLabelAndCount).should(
"have.text",
postgreSqlText.allDatabase()
);
cy.get(postgreSqlSelector.apiLabelAndCount).should(
"have.text",
postgreSqlText.allApis
);
cy.get(postgreSqlSelector.cloudStorageLabelAndCount).should(
"have.text",
postgreSqlText.allCloudStorage
);
selectAndAddDataSource("databases", appwriteText.appwrite, data.dsName);
fillDataSourceTextField(
appwriteText.host,
appwriteText.hostPlaceholder,
Host
);
fillDataSourceTextField(
appwriteText.ProjectID,
appwriteText.projectIdPlaceholder,
ProjectID
);
fillDataSourceTextField(
appwriteText.DatabaseID,
appwriteText.databaseIdPlaceholder,
DatabaseID
);
fillDataSourceTextField(
appwriteText.SecretKey,
appwriteText.SecretKeyPlaceholder,
SecretKey
);
cy.get(postgreSqlSelector.buttonTestConnection).click();
cy.get(postgreSqlSelector.textConnectionVerified, {
timeout: 10000,
}).should("have.text", postgreSqlText.labelConnectionVerified);
cy.get(postgreSqlSelector.buttonSave)
.verifyVisibleElement("have.text", postgreSqlText.buttonTextSave)
.click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
postgreSqlText.toastDSSaved
);
deleteDatasource(`cypress-${data.dsName}-Appwrite`);
});
it.skip("Should verify the functionality of appwrite connection form.", () => {
const Host = Cypress.env("appwrite_host");
const ProjectID = Cypress.env("appwrite_projectID");
const DatabaseID = Cypress.env("appwrite_databaseID");
const SecretKey = Cypress.env("appwrite_secretkey");
cy.get(commonSelectors.globalDataSourceIcon).click();
closeDSModal();
selectAndAddDataSource("databases", appwriteText.appwrite, data.dsName);
fillDataSourceTextField(
appwriteText.host,
appwriteText.hostPlaceholder,
Host
);
fillDataSourceTextField(
appwriteText.ProjectID,
appwriteText.projectIdPlaceholder,
ProjectID
);
fillDataSourceTextField(
appwriteText.DatabaseID,
appwriteText.databaseIdPlaceholder,
DatabaseID
);
fillDataSourceTextField(
appwriteText.SecretKey,
appwriteText.SecretKeyPlaceholder,
SecretKey
);
cy.get(postgreSqlSelector.buttonTestConnection).click();
cy.get(postgreSqlSelector.textConnectionVerified, {
timeout: 10000,
}).should("have.text", postgreSqlText.labelConnectionVerified);
cy.get(postgreSqlSelector.buttonSave)
.verifyVisibleElement("have.text", postgreSqlText.buttonTextSave)
.click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
postgreSqlText.toastDSSaved
);
deleteDatasource(`cypress-${data.dsName}-Appwrite`);
});
it.skip("Should be able to run the query with a valid connection", () => {
const Host = Cypress.env("appwrite_host");
const ProjectID = Cypress.env("appwrite_projectID");
const DatabaseID = Cypress.env("appwrite_databaseID");
const SecretKey = Cypress.env("appwrite_secretkey");
const CollectionID = Cypress.env("appwrite_collectionID");
cy.get(commonSelectors.globalDataSourceIcon).click();
closeDSModal();
selectAndAddDataSource("databases", appwriteText.appwrite, data.dsName);
fillDataSourceTextField(
appwriteText.host,
appwriteText.hostPlaceholder,
Host
);
fillDataSourceTextField(
appwriteText.ProjectID,
appwriteText.projectIdPlaceholder,
ProjectID
);
fillDataSourceTextField(
appwriteText.DatabaseID,
appwriteText.databaseIdPlaceholder,
DatabaseID
);
fillDataSourceTextField(
appwriteText.SecretKey,
appwriteText.SecretKeyPlaceholder,
SecretKey
);
cy.get(postgreSqlSelector.buttonTestConnection).click();
cy.get(postgreSqlSelector.textConnectionVerified, {
timeout: 10000,
}).should("have.text", postgreSqlText.labelConnectionVerified);
cy.get(postgreSqlSelector.buttonSave)
.verifyVisibleElement("have.text", postgreSqlText.buttonTextSave)
.click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
postgreSqlText.toastDSSaved
);
cy.get(commonSelectors.globalDataSourceIcon).click();
cy.get(
`[data-cy="cypress-${data.dsName}-appwrite-button"]`
).verifyVisibleElement("have.text", `cypress-${data.dsName}-appwrite`);
cy.wait(1000);
cy.get(commonSelectors.dashboardIcon).click();
cy.get(commonSelectors.appCreateButton).click();
cy.get(commonSelectors.appNameInput).click().type(data.dsName);
cy.get(commonSelectors.createAppButton).click();
cy.skipWalkthrough();
cy.get('[data-cy="show-ds-popover-button"]').click();
cy.get(".css-4e90k9").type(`${data.dsName}`);
cy.contains(`[id*="react-select-"]`, data.dsName).click();
cy.get('[data-cy="query-rename-input"]').clear().type(data.dsName);
// Create API document for delete operation
cy.request({
method: "POST",
url: `https://cloud.appwrite.io/v1/databases/${DatabaseID}/collections/${CollectionID}/documents`,
headers: {
"X-Appwrite-Project": ProjectID,
"X-Appwrite-Key": SecretKey,
"Content-Type": "application/json",
},
body: {
documentId: "unique()",
data: {
User_name: "test",
User_ID: 30,
},
permissions: ['read("any")'],
},
}).then((response) => {
expect(response.status).to.eq(201);
cy.wrap(response.body.$id).as("documentId");
});
// Verify all operations
const operations = [
"List documents",
"Get document",
"Add Document to Collection",
"Update document",
"Delete document",
];
cy.get("@documentId").then((documentId) => {
operations.forEach((operation) => {
cy.get(".react-select__input")
.eq(1)
.type(`${operation}{enter}`, { force: true });
if (operation === "Get document") {
cy.get(appWriteSelectors.collectionId).clearAndTypeOnCodeMirror(
CollectionID
);
cy.get(appWriteSelectors.documentId).clearAndTypeOnCodeMirror(
Cypress.env("appwrite_documentID")
);
}
if (operation === "Add Document to Collection") {
cy.get(appWriteSelectors.collectionId).clearAndTypeOnCodeMirror(
CollectionID
);
cy.get(appWriteSelectors.bodyInput).clearAndTypeOnCodeMirror(
'{"User_name": "John Updated", "User_ID": 35}'
);
}
if (operation === "Update document") {
cy.get(appWriteSelectors.collectionId).clearAndTypeOnCodeMirror(
CollectionID
);
cy.get(appWriteSelectors.documentId).clearAndTypeOnCodeMirror(
Cypress.env("appwrite_documentID")
);
cy.get(appWriteSelectors.bodyInput).clearAndTypeOnCodeMirror(
'{"User_name": "John Updated", "User_ID": 35}'
);
}
if (operation === "List documents") {
cy.get(appWriteSelectors.collectionId).clearAndTypeOnCodeMirror(
CollectionID
);
}
if (operation === "Delete document") {
cy.get(appWriteSelectors.collectionId).clearAndTypeOnCodeMirror(
CollectionID
);
cy.get(appWriteSelectors.documentId).clearAndTypeOnCodeMirror(
documentId
);
}
cy.get(dataSourceSelector.queryPreviewButton).click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
`Query (${data.dsName}) completed.`
);
});
deleteAppandDatasourceAfterExecution(
data.dsName,
`cypress-${data.dsName}-Appwrite`
);
});
});
});

View file

@ -0,0 +1,188 @@
import { fake } from "Fixtures/fake";
import { postgreSqlSelector } from "Selectors/postgreSql";
import { pluginSelectors } from "Selectors/plugins";
import { postgreSqlText } from "Texts/postgreSql";
import { awsLambdaText } from "Texts/awsLambda";
import { commonSelectors } from "Selectors/common";
import { commonText } from "Texts/common";
import {
fillDataSourceTextField,
selectAndAddDataSource,
} from "Support/utils/postgreSql";
import {
deleteDatasource,
closeDSModal,
deleteAppandDatasourceAfterExecution,
} from "Support/utils/dataSource";
import { dataSourceSelector } from "../../../../../constants/selectors/dataSource";
const data = {};
describe("Data source AWS Lambda", () => {
beforeEach(() => {
cy.apiLogin();
cy.visit("/");
data.dsName = fake.lastName.toLowerCase().replaceAll("[^A-Za-z]", "");
});
it.skip("Should verify elements on AWS Lambda connection form", () => {
const Accesskey = Cypress.env("awslamda_access");
const Secretkey = Cypress.env("awslamda_secret");
cy.get(commonSelectors.globalDataSourceIcon).click();
closeDSModal();
cy.get(postgreSqlSelector.allDatasourceLabelAndCount).should(
"have.text",
postgreSqlText.allDataSources()
);
cy.get(postgreSqlSelector.commonlyUsedLabelAndCount).should(
"have.text",
postgreSqlText.commonlyUsed
);
cy.get(postgreSqlSelector.databaseLabelAndCount).should(
"have.text",
postgreSqlText.allDatabase()
);
cy.get(postgreSqlSelector.apiLabelAndCount).should(
"have.text",
postgreSqlText.allApis
);
cy.get(postgreSqlSelector.cloudStorageLabelAndCount).should(
"have.text",
postgreSqlText.allCloudStorage
);
cy.installMarketplacePlugin("AWS Lambda");
selectAndAddDataSource("databases", awsLambdaText.awsLambda, data.dsName);
cy.get(".react-select__dropdown-indicator").eq(1).click();
cy.get(".react-select__option").contains("US West (N. California)").click();
cy.get(pluginSelectors.amazonsesAccesKey).click().type(Accesskey);
fillDataSourceTextField(
awsLambdaText.labelSecretKey,
"**************",
Secretkey
);
cy.get(postgreSqlSelector.buttonSave)
.verifyVisibleElement("have.text", postgreSqlText.buttonTextSave)
.click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
postgreSqlText.toastDSSaved
);
deleteDatasource(`cypress-${data.dsName}-aws-lambda`);
cy.uninstallMarketplacePlugin("AWS Lambda");
});
it.skip("Should verify the functionality of AWS Lambda connection form", () => {
const Accesskey = Cypress.env("awslamda_access");
const Secretkey = Cypress.env("awslamda_secret");
cy.get(commonSelectors.globalDataSourceIcon).click();
closeDSModal();
cy.installMarketplacePlugin("AWS Lambda");
selectAndAddDataSource("databases", awsLambdaText.awsLambda, data.dsName);
cy.get(".react-select__dropdown-indicator").eq(1).click();
cy.get(".react-select__option").contains("US West (N. California)").click();
cy.get(pluginSelectors.amazonsesAccesKey).click().type(Accesskey);
fillDataSourceTextField(
awsLambdaText.labelSecretKey,
"**************",
Secretkey
);
cy.get(postgreSqlSelector.buttonSave)
.verifyVisibleElement("have.text", postgreSqlText.buttonTextSave)
.click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
postgreSqlText.toastDSSaved
);
deleteDatasource(`cypress-${data.dsName}-aws-lambda`);
cy.uninstallMarketplacePlugin("AWS Lambda");
});
it.skip("Should able to run the query with valid conection", () => {
const Accesskey = Cypress.env("awslamda_access");
const Secretkey = Cypress.env("awslamda_secret");
cy.get(commonSelectors.globalDataSourceIcon).click();
closeDSModal();
cy.installMarketplacePlugin("AWS Lambda");
selectAndAddDataSource("databases", awsLambdaText.awsLambda, data.dsName);
cy.get(".react-select__dropdown-indicator").eq(1).click();
cy.get(".react-select__option")
.contains("US West (N. California)")
.wait(500)
.click();
cy.get(pluginSelectors.amazonsesAccesKey).click().type(Accesskey);
fillDataSourceTextField(
awsLambdaText.labelSecretKey,
"**************",
Secretkey
);
cy.get(postgreSqlSelector.buttonSave)
.verifyVisibleElement("have.text", postgreSqlText.buttonTextSave)
.click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
postgreSqlText.toastDSSaved
);
cy.get(commonSelectors.dashboardIcon).click();
cy.get(commonSelectors.appCreateButton).click();
cy.get(commonSelectors.appNameInput).click().type(data.dsName);
cy.get(commonSelectors.createAppButton).click();
cy.skipWalkthrough();
cy.get('[data-cy="show-ds-popover-button"]').click();
cy.get(".css-4e90k9").type(`${data.dsName}`);
cy.contains(`[id*="react-select-"]`, data.dsName).click();
cy.get('[data-cy="query-rename-input"]').clear().type(data.dsName);
cy.get(pluginSelectors.operationDropdown)
.click()
.type("Invoke Lambda Function{enter}");
cy.wait(500);
cy.get(
'[data-cy="function-name-section"] .cm-content'
).clearAndTypeOnCodeMirror("testAwslambdaPlugin");
cy.wait(500);
cy.get(dataSourceSelector.queryPreviewButton).click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
`Query (${data.dsName}) completed.`
);
deleteAppandDatasourceAfterExecution(
data.dsName,
`cypress-${data.dsName}-aws-lambda`
);
cy.uninstallMarketplacePlugin("AWS Lambda");
});
});

View file

@ -0,0 +1,225 @@
import { fake } from "Fixtures/fake";
import { postgreSqlSelector } from "Selectors/postgreSql";
import { pluginSelectors } from "Selectors/plugins";
import { awsTextractSelectors } from "Selectors/Plugins";
import { postgreSqlText } from "Texts/postgreSql";
import { awsTextractText } from "Texts/awsTextract";
import { commonSelectors } from "Selectors/common";
import { commonText } from "Texts/common";
import {
fillDataSourceTextField,
selectAndAddDataSource,
} from "Support/utils/postgreSql";
import {
deleteDatasource,
closeDSModal,
deleteAppandDatasourceAfterExecution,
} from "Support/utils/dataSource";
import { dataSourceSelector } from "../../../../../constants/selectors/dataSource";
const data = {};
describe("Data source AWS Textract", () => {
beforeEach(() => {
cy.apiLogin();
cy.visit("/");
data.dsName = fake.lastName.toLowerCase().replaceAll("[^A-Za-z]", "");
});
it.skip("Should verify elements on AWS Textract connection form", () => {
const Accesskey = Cypress.env("awstextract_access");
const Secretkey = Cypress.env("awstextract_secret");
cy.get(commonSelectors.globalDataSourceIcon).click();
closeDSModal();
cy.get(postgreSqlSelector.allDatasourceLabelAndCount).should(
"have.text",
postgreSqlText.allDataSources()
);
cy.get(postgreSqlSelector.commonlyUsedLabelAndCount).should(
"have.text",
postgreSqlText.commonlyUsed
);
cy.get(postgreSqlSelector.databaseLabelAndCount).should(
"have.text",
postgreSqlText.allDatabase()
);
cy.get(postgreSqlSelector.apiLabelAndCount).should(
"have.text",
postgreSqlText.allApis
);
cy.get(postgreSqlSelector.cloudStorageLabelAndCount).should(
"have.text",
postgreSqlText.allCloudStorage
);
cy.installMarketplacePlugin("AWS Textract");
selectAndAddDataSource(
"databases",
awsTextractText.awsTextract,
data.dsName
);
cy.get(".react-select__dropdown-indicator").eq(1).click();
cy.get(".react-select__option").contains("US West (N. California)").click();
cy.get(pluginSelectors.amazonsesAccesKey).click().type(Accesskey);
fillDataSourceTextField(
awsTextractText.labelSecretKey,
"**************",
Secretkey
);
cy.get(postgreSqlSelector.buttonSave)
.verifyVisibleElement("have.text", postgreSqlText.buttonTextSave)
.click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
postgreSqlText.toastDSSaved
);
deleteDatasource(`cypress-${data.dsName}-aws-textract`);
});
it.skip("Should verify functionality of AWS Textract connection form", () => {
const Accesskey = Cypress.env("awstextract_access");
const Secretkey = Cypress.env("awstextract_secret");
cy.get(commonSelectors.globalDataSourceIcon).click();
closeDSModal();
cy.installMarketplacePlugin("AWS Textract");
selectAndAddDataSource(
"databases",
awsTextractText.awsTextract,
data.dsName
);
cy.get(".react-select__dropdown-indicator").eq(1).click();
cy.get(".react-select__option").contains("US West (N. California)").click();
cy.get(pluginSelectors.amazonsesAccesKey).click().type(Accesskey);
fillDataSourceTextField(
awsTextractText.labelSecretKey,
"**************",
Secretkey
);
cy.get(postgreSqlSelector.buttonSave)
.verifyVisibleElement("have.text", postgreSqlText.buttonTextSave)
.click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
postgreSqlText.toastDSSaved
);
deleteDatasource(`cypress-${data.dsName}-aws-textract`);
cy.uninstallMarketplacePlugin("AWS Textract");
});
it.skip("Should able to run the query with valid conection", () => {
const Accesskey = Cypress.env("awstextract_access");
const Secretkey = Cypress.env("awstextract_secret");
cy.get(commonSelectors.globalDataSourceIcon).click();
closeDSModal();
cy.installMarketplacePlugin("AWS Textract");
selectAndAddDataSource(
"databases",
awsTextractText.awsTextract,
data.dsName
);
cy.get(".react-select__dropdown-indicator").eq(1).click();
cy.get(".react-select__option")
.contains("US West (N. California)")
.wait(500)
.click();
cy.get(pluginSelectors.amazonsesAccesKey).click().type(Accesskey);
fillDataSourceTextField(
awsTextractText.labelSecretKey,
"**************",
Secretkey
);
cy.get(postgreSqlSelector.buttonSave)
.verifyVisibleElement("have.text", postgreSqlText.buttonTextSave)
.click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
postgreSqlText.toastDSSaved
);
cy.get(commonSelectors.dashboardIcon).click();
cy.get(commonSelectors.appCreateButton).click();
cy.get(commonSelectors.appNameInput).click().type(data.dsName);
cy.get(commonSelectors.createAppButton).click();
cy.skipWalkthrough();
cy.get('[data-cy="show-ds-popover-button"]').click();
cy.get(".css-4e90k9").type(`${data.dsName}`);
cy.contains(`[id*="react-select-"]`, data.dsName).click();
cy.get('[data-cy="query-rename-input"]').clear().type(data.dsName);
// Verifying analyze document operation
cy.get(pluginSelectors.operationDropdown)
.click()
.wait(500)
.type("Analyze Document{enter}");
cy.wait(500);
cy.get(awsTextractSelectors.documentInputField).clearAndTypeOnCodeMirror(
awsTextractText.documentName
);
cy.wait(500);
cy.get(dataSourceSelector.queryPreviewButton).click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
`Query (${data.dsName}) completed.`
);
// Verifying Analyze document stored in AWS S3 operation
cy.get(pluginSelectors.operationDropdown)
.click()
.wait(500)
.type("Analyze document stored in AWS S3{enter}");
cy.wait(500);
cy.get(awsTextractSelectors.bucketNameInputField).clearAndTypeOnCodeMirror(
awsTextractText.bucketName
);
cy.get(awsTextractSelectors.keyNameInputField).clearAndTypeOnCodeMirror(
awsTextractText.keyName
);
cy.wait(500);
cy.get(dataSourceSelector.queryPreviewButton).click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
`Query (${data.dsName}) completed.`
);
deleteAppandDatasourceAfterExecution(
data.dsName,
`cypress-${data.dsName}-aws-textract`
);
cy.uninstallMarketplacePlugin("AWS Textract");
});
});

View file

@ -17,8 +17,8 @@ data.customText = fake.randomSentence;
describe("Data source Azure Blob Storage", () => {
beforeEach(() => {
cy.appUILogin();
cy.intercept("GET", "/api/v2/data_sources");
cy.apiLogin();
cy.visit("/");
data.dataSourceName = fake.lastName
.toLowerCase()
.replaceAll("[^A-Za-z]", "");

View file

@ -0,0 +1,217 @@
import { fake } from "Fixtures/fake";
import { postgreSqlSelector } from "Selectors/postgreSql";
import { pluginSelectors, baserowSelectors } from "Selectors/plugins";
import { postgreSqlText } from "Texts/postgreSql";
import { baseRowText } from "Texts/baseRow";
import { commonSelectors } from "Selectors/common";
import { commonText } from "Texts/common";
import {
fillDataSourceTextField,
selectAndAddDataSource,
} from "Support/utils/postgreSql";
import {
deleteDatasource,
closeDSModal,
deleteAppandDatasourceAfterExecution,
} from "Support/utils/dataSource";
import { dataSourceSelector } from "../../../../../constants/selectors/dataSource";
const data = {};
describe("Data source baserow", () => {
beforeEach(() => {
cy.apiLogin();
cy.visit("/");
data.dsName = fake.lastName.toLowerCase().replaceAll("[^A-Za-z]", "");
});
it.skip("Should verify elements on baserow connection form", () => {
const Apikey = Cypress.env("baserow_apikey");
cy.get(commonSelectors.globalDataSourceIcon).click();
closeDSModal();
cy.get(postgreSqlSelector.allDatasourceLabelAndCount).should(
"have.text",
postgreSqlText.allDataSources()
);
cy.get(postgreSqlSelector.commonlyUsedLabelAndCount).should(
"have.text",
postgreSqlText.commonlyUsed
);
cy.get(postgreSqlSelector.databaseLabelAndCount).should(
"have.text",
postgreSqlText.allDatabase()
);
cy.get(postgreSqlSelector.apiLabelAndCount).should(
"have.text",
postgreSqlText.allApis
);
cy.get(postgreSqlSelector.cloudStorageLabelAndCount).should(
"have.text",
postgreSqlText.allCloudStorage
);
selectAndAddDataSource("databases", baseRowText.baserow, data.dsName);
fillDataSourceTextField(
baseRowText.lableApiToken,
baseRowText.placeholderApiToken,
Apikey
);
cy.get(".react-select__control").eq(1).click();
cy.get(".react-select__option").contains("Baserow Cloud").click();
cy.get(postgreSqlSelector.buttonSave)
.verifyVisibleElement("have.text", postgreSqlText.buttonTextSave)
.click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
postgreSqlText.toastDSSaved
);
deleteDatasource(`cypress-${data.dsName}-baserow`);
});
it.skip("Should verify the functionality of baserow connection form.", () => {
const Apikey = Cypress.env("baserow_apikey");
selectAndAddDataSource("databases", baseRowText.baserow, data.dsName);
fillDataSourceTextField(
baseRowText.lableApiToken,
baseRowText.placeholderApiToken,
Apikey
);
cy.get(".react-select__control").eq(1).click();
cy.get(".react-select__option").contains("Baserow Cloud").click();
cy.get(postgreSqlSelector.buttonSave)
.verifyVisibleElement("have.text", postgreSqlText.buttonTextSave)
.click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
postgreSqlText.toastDSSaved
);
deleteDatasource(`cypress-${data.dsName}-baserow`);
});
it.skip("Should be able to run the query with a valid connection", () => {
const baserowTableID = Cypress.env("baserow_tableid");
const baserowRowID = Cypress.env("baserow_rowid");
const Apikey = Cypress.env("baserow_apikey");
selectAndAddDataSource("databases", baseRowText.baserow, data.dsName);
fillDataSourceTextField(
baseRowText.lableApiToken,
baseRowText.placeholderApiToken,
Apikey
);
cy.get(".react-select__control").eq(1).click();
cy.get(".react-select__option").contains("Baserow Cloud").click();
cy.get(postgreSqlSelector.buttonSave)
.verifyVisibleElement("have.text", postgreSqlText.buttonTextSave)
.click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
postgreSqlText.toastDSSaved
);
cy.get(commonSelectors.globalDataSourceIcon).click();
cy.get(
`[data-cy="cypress-${data.dsName}-baserow-button"]`
).verifyVisibleElement("have.text", `cypress-${data.dsName}-baserow`);
cy.wait(1000);
cy.log("Baserow Table ID:", baserowTableID);
cy.log("Row ID:", baserowRowID);
cy.log("API Key:", Apikey);
if (!baserowTableID || !Apikey) {
throw new Error("Missing required environment variables!");
}
cy.request({
method: "POST",
url: `https://api.baserow.io/api/database/rows/table/${baserowTableID}/`,
headers: { Authorization: `Token ${Apikey}` },
body: {
field_1: "Sample Data",
field_2: "Another Value",
},
}).then((response) => {
expect(response.status).to.eq(200);
const rowId = response.body.id;
cy.get(commonSelectors.dashboardIcon).click();
cy.get(commonSelectors.appCreateButton).click();
cy.get(commonSelectors.appNameInput).click().type(data.dsName);
cy.get(commonSelectors.createAppButton).click();
cy.skipWalkthrough();
cy.get('[data-cy="show-ds-popover-button"]').click();
cy.get(".css-4e90k9").type(`${data.dsName}`);
cy.contains(`[id*="react-select-"]`, data.dsName).click();
cy.get('[data-cy="query-rename-input"]').clear().type(data.dsName);
// Verify delete operation (Need to uncomment after bug fixes)
// cy.get('[data-cy="operation-select-dropdown"]').click();
// cy.get(".react-select__option").contains("Delete row").click();
// cy.get(baserowSelectors.baserowTabelId).clearAndTypeOnCodeMirror(baserowTableID);
// cy.get(baserowSelectors.rowIdinputfield).clearAndTypeOnCodeMirror(rowId.toString());
// cy.get(dataSourceSelector.queryPreviewButton).click();
// cy.verifyToastMessage(commonSelectors.toastMessage, `Query (${data.dsName}) completed.`);
});
// Verify other operations
const operations = [
"List fields",
"List rows",
"Get row",
"Create row",
"Update row",
"Move row",
];
operations.forEach((operation) => {
cy.get(pluginSelectors.operationDropdown).click();
cy.get(".react-select__option").contains(operation).click();
cy.get(baserowSelectors.table).clearAndTypeOnCodeMirror(baserowTableID);
if (operation === "Get row") {
cy.get(baserowSelectors.rowIdinputfield).clearAndTypeOnCodeMirror(
baserowRowID
);
}
if (operation === "Move row") {
cy.get('[data-cy="before-id-input-field"]').clearAndTypeOnCodeMirror(
"1"
);
}
cy.get(dataSourceSelector.queryPreviewButton).click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
`Query (${data.dsName}) completed.`
);
});
deleteAppandDatasourceAfterExecution(
data.dsName,
`cypress-${data.dsName}-baserow`
);
});
});

View file

@ -4,6 +4,7 @@ import { postgreSqlText } from "Texts/postgreSql";
import { bigqueryText } from "Texts/bigquery";
import { firestoreText } from "Texts/firestore";
import { commonSelectors } from "Selectors/common";
import { dataSourceSelector } from "Selectors/dataSource";
import {
fillDataSourceTextField,
selectAndAddDataSource,
@ -15,8 +16,8 @@ const data = {};
describe("Data source BigQuery", () => {
beforeEach(() => {
cy.appUILogin();
cy.intercept("GET", "/api/v2/data_sources");
cy.apiLogin();
cy.visit("/");
data.dataSourceName = fake.lastName
.toLowerCase()
.replaceAll("[^A-Za-z]", "");
@ -50,16 +51,24 @@ describe("Data source BigQuery", () => {
postgreSqlText.allCloudStorage
);
selectAndAddDataSource(
"databases",
bigqueryText.bigQuery,
data.dataSourceName
cy.apiCreateGDS(
`${Cypress.env("server_host")}/api/data-sources`,
`cypress-${data.dataSourceName}-bigquery`,
"bigquery",
[{ key: "private_key", value: "", encrypted: true }]
);
cy.reload();
cy.get(`[data-cy="cypress-${data.dataSourceName}-bigquery-button"]`)
.should("be.visible")
.click();
cy.get(dataSourceSelector.dsNameInputField).should(
"have.value",
`cypress-${data.dataSourceName}-bigquery`
);
cy.get('[data-cy="label-private-key"]').verifyVisibleElement(
"have.text",
firestoreText.labelPrivateKey
);
cy.get(
dataSourceSelector.labelFieldName(firestoreText.labelPrivateKey)
).verifyVisibleElement("have.text", "Private key*");
cy.get(".datasource-edit-btn").should("be.visible");
cy.get(postgreSqlSelector.labelIpWhitelist).verifyVisibleElement(
"have.text",
@ -88,7 +97,7 @@ describe("Data source BigQuery", () => {
"have.text",
postgreSqlText.buttonTextSave
);
cy.get('[data-cy="connection-alert-text"]').verifyVisibleElement(
cy.get(dataSourceSelector.connectionAlertText).verifyVisibleElement(
"have.text",
bigqueryText.errorInvalidEmailId
);
@ -100,38 +109,30 @@ describe("Data source BigQuery", () => {
});
it("Should verify the functionality of BigQuery connection form.", () => {
selectAndAddDataSource(
"databases",
bigqueryText.bigQuery,
data.dataSourceName
);
fillDataSourceTextField(
firestoreText.privateKey,
bigqueryText.placehlderPrivateKey,
`${JSON.stringify(Cypress.env("bigquery_pvt_key"))}`,
"contain",
{ parseSpecialCharSequences: false, delay: 0 }
cy.get(commonSelectors.globalDataSourceIcon).click();
cy.apiCreateGDS(
`${Cypress.env("server_host")}/api/data-sources`,
`cypress-${data.dataSourceName}-bigquery`,
"bigquery",
[
{
key: "private_key",
value: `${JSON.stringify(Cypress.env("bigquery_pvt_key"))}`,
encrypted: true,
},
]
);
cy.get(
dataSourceSelector.dataSourceNameButton(
`cypress-${data.dataSourceName}-bigquery`
)
)
.should("be.visible")
.click();
cy.get(postgreSqlSelector.buttonTestConnection).click();
cy.get(postgreSqlSelector.textConnectionVerified, {
timeout: 10000,
}).should("have.text", postgreSqlText.labelConnectionVerified);
cy.get(postgreSqlSelector.buttonSave).click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
postgreSqlText.toastDSSaved
);
cy.get(commonSelectors.globalDataSourceIcon).click();
cy.get(
`[data-cy="cypress-${data.dataSourceName}-bigquery-button"]`
).verifyVisibleElement(
"have.text",
`cypress-${data.dataSourceName}-bigquery`
);
deleteDatasource(`cypress-${data.dataSourceName}-bigquery`);
cy.apiDeleteGDS(`cypress-${data.dataSourceName}-bigquery`);
});
});

View file

@ -1,9 +1,8 @@
import { fake } from "Fixtures/fake";
import { postgreSqlSelector } from "Selectors/postgreSql";
import { postgreSqlText } from "Texts/postgreSql";
import { commonWidgetText } from "Texts/common";
import { commonSelectors, commonWidgetSelector } from "Selectors/common";
import { commonText } from "Texts/common";
import { dataSourceSelector } from "Selectors/dataSource";
import { closeDSModal, deleteDatasource } from "Support/utils/dataSource";
import {
addQuery,
@ -20,7 +19,8 @@ const data = {};
describe("Data sources", () => {
beforeEach(() => {
cy.appUILogin();
cy.apiLogin();
cy.visit("/");
data.dataSourceName = fake.lastName
.toLowerCase()
.replaceAll("[^A-Za-z]", "");
@ -51,13 +51,20 @@ describe("Data sources", () => {
postgreSqlText.allCloudStorage
);
selectAndAddDataSource("databases", "ClickHouse", data.dataSourceName);
// cy.get(postgreSqlSelector.dataSourceNameInputField).should(
// //username,password,host,port,protocol,dbname,usepost, trimquery,gzip,debug,raw
// "have.value",
// "ClickHouse"
// );
cy.apiCreateGDS(
`${Cypress.env("server_host")}/api/data-sources`,
`cypress-${data.dataSourceName}-clickhouse`,
"clickhouse",
[]
);
cy.reload();
cy.get(`[data-cy="cypress-${data.dataSourceName}-clickhouse-button"]`)
.should("be.visible")
.click();
cy.get(dataSourceSelector.dsNameInputField).should(
"have.value",
`cypress-${data.dataSourceName}-clickhouse`
);
cy.get(postgreSqlSelector.labelUserName).verifyVisibleElement(
"have.text",
postgreSqlText.labelUserName
@ -78,7 +85,7 @@ describe("Data sources", () => {
cy.get(postgreSqlSelector.labelDbName).verifyVisibleElement(
"have.text",
postgreSqlText.labelDbName
"Database Name"
);
cy.get('[data-cy="label-protocol"]').verifyVisibleElement(
"have.text",
@ -140,11 +147,7 @@ describe("Data sources", () => {
Cypress.env("pg_host")
);
fillDataSourceTextField(postgreSqlText.labelPort, "8123", "8123");
fillDataSourceTextField(
postgreSqlText.labelDbName,
"database name",
"{del}"
);
fillDataSourceTextField("Database Name", "database name", "{del}");
fillDataSourceTextField(
postgreSqlText.labelUserName,
postgreSqlText.placeholderEnterUserName,

View file

@ -1,9 +1,8 @@
import { fake } from "Fixtures/fake";
import { postgreSqlSelector } from "Selectors/postgreSql";
import { postgreSqlText } from "Texts/postgreSql";
import { commonWidgetText } from "Texts/common";
import { commonSelectors, commonWidgetSelector } from "Selectors/common";
import { commonText } from "Texts/common";
import { dataSourceSelector } from "Selectors/dataSource";
import { closeDSModal, deleteDatasource } from "Support/utils/dataSource";
import {
addQuery,
@ -20,7 +19,8 @@ const data = {};
describe("Data sources", () => {
beforeEach(() => {
cy.appUILogin();
cy.apiLogin();
cy.visit("/");
data.dataSourceName = fake.lastName
.toLowerCase()
.replaceAll("[^A-Za-z]", "");
@ -50,7 +50,23 @@ describe("Data sources", () => {
"have.text",
postgreSqlText.allCloudStorage
);
selectAndAddDataSource("databases", "CosmosDB", data.dataSourceName);
cy.apiCreateGDS(
`${Cypress.env("server_host")}/api/data-sources`,
`cypress-${data.dataSourceName}-cosmosdb`,
"cosmosdb",
[
{ key: "endpoint", value: "" },
{ key: "key", value: "", encrypted: true },
]
);
cy.reload();
cy.get(`[data-cy="cypress-${data.dataSourceName}-cosmosdb-button"]`)
.should("be.visible")
.click();
cy.get(dataSourceSelector.dsNameInputField).should(
"have.value",
`cypress-${data.dataSourceName}-cosmosdb`
);
cy.get('[data-cy="label-end-point"]').verifyVisibleElement(
"have.text",
@ -85,14 +101,14 @@ describe("Data sources", () => {
"have.text",
postgreSqlText.buttonTextSave
);
cy.get('[data-cy="connection-alert-text"]').verifyVisibleElement(
cy.get(dataSourceSelector.connectionAlertText).verifyVisibleElement(
"have.text",
"Invalid URL"
);
deleteDatasource(`cypress-${data.dataSourceName}-cosmosdb`);
});
it.only("Should verify the functionality of CosmosDB connection form.", () => {
it("Should verify the functionality of CosmosDB connection form.", () => {
selectAndAddDataSource("databases", "CosmosDB", data.dataSourceName);
fillDataSourceTextField(

View file

@ -3,7 +3,7 @@ import { postgreSqlSelector } from "Selectors/postgreSql";
import { postgreSqlText } from "Texts/postgreSql";
import { commonWidgetText } from "Texts/common";
import { commonSelectors, commonWidgetSelector } from "Selectors/common";
import { commonText } from "Texts/common";
import { dataSourceSelector } from "Selectors/dataSource";
import { closeDSModal, deleteDatasource } from "Support/utils/dataSource";
import {
@ -21,7 +21,8 @@ const data = {};
describe("Data sources", () => {
beforeEach(() => {
cy.appUILogin();
cy.apiLogin();
cy.visit("/");
data.dataSourceName = fake.lastName
.toLowerCase()
.replaceAll("[^A-Za-z]", "");
@ -52,7 +53,27 @@ describe("Data sources", () => {
postgreSqlText.allCloudStorage
);
selectAndAddDataSource("databases", "CouchDB", data.dataSourceName);
cy.apiCreateGDS(
`${Cypress.env("server_host")}/api/data-sources`,
`cypress-${data.dataSourceName}-couchdb`,
"couchdb",
[
{ key: "username", value: "", encrypted: false },
{ key: "password", value: "", encrypted: true },
{ key: "database", value: "" },
{ key: "port", value: "5984" },
{ key: "host", value: "" },
{ key: "protocol" },
]
);
cy.reload();
cy.get(`[data-cy="cypress-${data.dataSourceName}-couchdb-button"]`)
.should("be.visible")
.click();
cy.get(dataSourceSelector.dsNameInputField).should(
"have.value",
`cypress-${data.dataSourceName}-couchdb`
);
cy.get(postgreSqlSelector.labelHost).verifyVisibleElement(
"have.text",
@ -72,7 +93,7 @@ describe("Data sources", () => {
);
cy.get(postgreSqlSelector.labelDbName).verifyVisibleElement(
"have.text",
postgreSqlText.labelDbName
"Database Name"
);
cy.get('[data-cy="label-protocol"]').verifyVisibleElement(
@ -106,7 +127,7 @@ describe("Data sources", () => {
"have.text",
postgreSqlText.buttonTextSave
);
cy.get('[data-cy="connection-alert-text"]').verifyVisibleElement(
cy.get(dataSourceSelector.connectionAlertText).verifyVisibleElement(
"have.text",
"Invalid URL"
);
@ -122,11 +143,7 @@ describe("Data sources", () => {
Cypress.env("couchdb_host")
);
fillDataSourceTextField(postgreSqlText.labelPort, "5984 ", "5984");
fillDataSourceTextField(
postgreSqlText.labelDbName,
"database name",
"{del}"
);
fillDataSourceTextField("Database Name", "database name", "{del}");
fillDataSourceTextField(
postgreSqlText.labelUserName,
"username for couchDB",

View file

@ -3,7 +3,7 @@ import { postgreSqlSelector } from "Selectors/postgreSql";
import { postgreSqlText } from "Texts/postgreSql";
import { dynamoDbText } from "Texts/dynamodb";
import { commonSelectors } from "Selectors/common";
import { commonText } from "Texts/common";
import { dataSourceSelector } from "Selectors/dataSource";
import {
fillDataSourceTextField,
@ -19,7 +19,8 @@ const data = {};
describe("Data source DynamoDB", () => {
beforeEach(() => {
cy.appUILogin();
cy.apiLogin();
cy.visit("/");
data.dataSourceName = fake.lastName
.toLowerCase()
.replaceAll("[^A-Za-z]", "");
@ -50,10 +51,28 @@ describe("Data source DynamoDB", () => {
postgreSqlText.allCloudStorage
);
selectAndAddDataSource(
"databases",
dynamoDbText.dynamoDb,
data.dataSourceName
cy.apiCreateGDS(
`${Cypress.env("server_host")}/api/data-sources`,
`cypress-${data.dataSourceName}-dynamodb`,
"dynamodb",
[
{ key: "region", value: "" },
{ key: "access_key", value: "" },
{ key: "secret_key", value: "", encrypted: true },
{
key: "instance_metadata_credentials",
value: "iam_access_keys",
encrypted: false,
},
]
);
cy.reload();
cy.get(`[data-cy="cypress-${data.dataSourceName}-dynamodb-button"]`)
.should("be.visible")
.click();
cy.get(dataSourceSelector.dsNameInputField).should(
"have.value",
`cypress-${data.dataSourceName}-dynamodb`
);
cy.get('[data-cy="label-region"]').verifyVisibleElement(
@ -96,7 +115,7 @@ describe("Data source DynamoDB", () => {
"have.text",
postgreSqlText.buttonTextSave
);
cy.get('[data-cy="connection-alert-text"]').verifyVisibleElement(
cy.get(dataSourceSelector.connectionAlertText).verifyVisibleElement(
"have.text",
dynamoDbText.errorMissingRegion
);

View file

@ -3,7 +3,7 @@ import { postgreSqlSelector } from "Selectors/postgreSql";
import { postgreSqlText } from "Texts/postgreSql";
import { elasticsearchText } from "Texts/elasticsearch";
import { commonSelectors } from "Selectors/common";
import { commonText } from "Texts/common";
import { dataSourceSelector } from "Selectors/dataSource";
import {
fillDataSourceTextField,
selectAndAddDataSource,
@ -17,8 +17,12 @@ import {
const data = {};
describe("Data source Elasticsearch", () => {
beforeEach(() => {
cy.appUILogin();
data.lastName = fake.lastName.toLowerCase().replaceAll("[^A-Za-z]", "");
cy.apiLogin();
cy.visit("/");
data.dataSourceName = fake.lastName
.toLowerCase()
.replaceAll("[^A-Za-z]", "");
});
it("Should verify elements on Elasticsearch connection form", () => {
@ -46,12 +50,27 @@ describe("Data source Elasticsearch", () => {
postgreSqlText.allCloudStorage
);
selectAndAddDataSource(
"databases",
elasticsearchText.elasticSearch,
data.lastName
cy.apiCreateGDS(
`${Cypress.env("server_host")}/api/data-sources`,
`cypress-${data.dataSourceName}-elasticsearch`,
"elasticsearch",
[
{ key: "host", value: "localhost" },
{ key: "port", value: 9200 },
{ key: "username", value: "" },
{ key: "password", value: "", encrypted: true },
{ key: "ssl_enabled", value: true, encrypted: false },
{ key: "ssl_certificate", value: "none", encrypted: false },
]
);
cy.reload();
cy.get(`[data-cy="cypress-${data.dataSourceName}-elasticsearch-button"]`)
.should("be.visible")
.click();
cy.get(dataSourceSelector.dsNameInputField).should(
"have.value",
`cypress-${data.dataSourceName}-elasticsearch`
);
cy.get(postgreSqlSelector.labelHost).verifyVisibleElement(
"have.text",
postgreSqlText.labelHost
@ -74,7 +93,7 @@ describe("Data source Elasticsearch", () => {
);
cy.get(postgreSqlSelector.labelSSLCertificate).verifyVisibleElement(
"have.text",
postgreSqlText.sslCertificate
"SSL Certificate"
);
cy.get(postgreSqlSelector.labelIpWhitelist).verifyVisibleElement(
"have.text",
@ -103,18 +122,18 @@ describe("Data source Elasticsearch", () => {
"have.text",
postgreSqlText.buttonTextSave
);
cy.get('[data-cy="connection-alert-text"]').verifyVisibleElement(
cy.get(dataSourceSelector.connectionAlertText).verifyVisibleElement(
"have.text",
elasticsearchText.errorConnectionRefused
);
deleteDatasource(`cypress-${data.lastName}-elasticsearch`);
deleteDatasource(`cypress-${data.dataSourceName}-elasticsearch`);
});
it("Should verify the functionality of Elasticsearch connection form.", () => {
selectAndAddDataSource(
"databases",
elasticsearchText.elasticSearch,
data.lastName
data.dataSourceName
);
fillDataSourceTextField(
@ -194,12 +213,12 @@ describe("Data source Elasticsearch", () => {
);
cy.get(
`[data-cy="cypress-${data.lastName}-elasticsearch-button"]`
`[data-cy="cypress-${data.dataSourceName}-elasticsearch-button"]`
).verifyVisibleElement(
"have.text",
`cypress-${data.lastName}-elasticsearch`
`cypress-${data.dataSourceName}-elasticsearch`
);
deleteDatasource(`cypress-${data.lastName}-elasticsearch`);
deleteDatasource(`cypress-${data.dataSourceName}-elasticsearch`);
});
});

View file

@ -3,7 +3,7 @@ import { postgreSqlSelector } from "Selectors/postgreSql";
import { postgreSqlText } from "Texts/postgreSql";
import { firestoreText } from "Texts/firestore";
import { commonSelectors } from "Selectors/common";
import { commonText } from "Texts/common";
import { dataSourceSelector } from "Selectors/dataSource";
import {
verifyCouldnotConnectWithAlert,
deleteDatasource,
@ -17,7 +17,8 @@ const data = {};
describe("Data source Firestore", () => {
beforeEach(() => {
cy.appUILogin();
cy.apiLogin();
cy.visit("/");
data.dataSourceName = fake.lastName
.toLowerCase()
.replaceAll("[^A-Za-z]", "");
@ -47,12 +48,20 @@ describe("Data source Firestore", () => {
postgreSqlText.allCloudStorage
);
selectAndAddDataSource(
"databases",
firestoreText.firestore,
data.dataSourceName
cy.apiCreateGDS(
`${Cypress.env("server_host")}/api/data-sources`,
`cypress-${data.dataSourceName}-firestore`,
"firestore",
[{ key: "gcp_key", value: "", encrypted: true }]
);
cy.reload();
cy.get(`[data-cy="cypress-${data.dataSourceName}-firestore-button"]`)
.should("be.visible")
.click();
cy.get(dataSourceSelector.dsNameInputField).should(
"have.value",
`cypress-${data.dataSourceName}-firestore`
);
cy.get('[data-cy="label-private-key"]').verifyVisibleElement(
"have.text",
firestoreText.labelPrivateKey
@ -85,7 +94,7 @@ describe("Data source Firestore", () => {
"have.text",
postgreSqlText.buttonTextSave
);
cy.get('[data-cy="connection-alert-text"]').verifyVisibleElement(
cy.get(dataSourceSelector.connectionAlertText).verifyVisibleElement(
"have.text",
firestoreText.errorGcpKeyCouldNotBeParsed
);

View file

@ -0,0 +1,153 @@
import { fake } from "Fixtures/fake";
import { postgreSqlSelector } from "Selectors/postgreSql";
import { postgreSqlText } from "Texts/postgreSql";
import { GraphQLText } from "Texts/graphQL";
import { commonSelectors } from "Selectors/common";
import { commonText } from "Texts/common";
import {
fillDataSourceTextField,
selectAndAddDataSource,
} from "Support/utils/postgreSql";
import {
deleteDatasource,
closeDSModal,
deleteAppandDatasourceAfterExecution,
} from "Support/utils/dataSource";
import { dataSourceSelector } from "../../../../../constants/selectors/dataSource";
const data = {};
describe("Data source GraphQL", () => {
beforeEach(() => {
cy.apiLogin();
cy.visit("/");
data.dsName = fake.lastName.toLowerCase().replaceAll("[^A-Za-z]", "");
});
it("Should verify elements on GraphQL connection form", () => {
const Url = Cypress.env("GraphQl_Url");
cy.get(commonSelectors.globalDataSourceIcon).click();
closeDSModal();
cy.get(postgreSqlSelector.allDatasourceLabelAndCount).should(
"have.text",
postgreSqlText.allDataSources()
);
cy.get(postgreSqlSelector.commonlyUsedLabelAndCount).should(
"have.text",
postgreSqlText.commonlyUsed
);
cy.get(postgreSqlSelector.databaseLabelAndCount).should(
"have.text",
postgreSqlText.allDatabase()
);
cy.get(postgreSqlSelector.apiLabelAndCount).should(
"have.text",
postgreSqlText.allApis
);
cy.get(postgreSqlSelector.cloudStorageLabelAndCount).should(
"have.text",
postgreSqlText.allCloudStorage
);
selectAndAddDataSource("databases", GraphQLText.GraphQL, data.dsName);
fillDataSourceTextField(
GraphQLText.urlInputLabel,
GraphQLText.urlInputPlaceholder,
Url
);
cy.get(postgreSqlSelector.buttonSave)
.verifyVisibleElement("have.text", postgreSqlText.buttonTextSave)
.click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
postgreSqlText.toastDSSaved
);
deleteDatasource(`cypress-${data.dsName}-GraphQL`);
});
it("Should verify the functionality of GraphQL connection form", () => {
const Url = Cypress.env("GraphQl_Url");
cy.get(commonSelectors.globalDataSourceIcon).click();
closeDSModal();
selectAndAddDataSource("databases", GraphQLText.GraphQL, data.dsName);
fillDataSourceTextField(
GraphQLText.urlInputLabel,
GraphQLText.urlInputPlaceholder,
Url
);
cy.get(postgreSqlSelector.buttonSave)
.verifyVisibleElement("have.text", postgreSqlText.buttonTextSave)
.click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
postgreSqlText.toastDSSaved
);
deleteDatasource(`cypress-${data.dsName}-GraphQL`);
});
it("Should able to run the query with valid conection", () => {
const Url = Cypress.env("GraphQl_Url");
cy.get(commonSelectors.globalDataSourceIcon).click();
closeDSModal();
selectAndAddDataSource("databases", GraphQLText.GraphQL, data.dsName);
fillDataSourceTextField(
GraphQLText.urlInputLabel,
GraphQLText.urlInputPlaceholder,
Url
);
cy.get(postgreSqlSelector.buttonSave)
.verifyVisibleElement("have.text", postgreSqlText.buttonTextSave)
.click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
postgreSqlText.toastDSSaved
);
cy.get(commonSelectors.globalDataSourceIcon).click();
cy.get(commonSelectors.dashboardIcon).click();
cy.get(commonSelectors.appCreateButton).click();
cy.get(commonSelectors.appNameInput).click().type(data.dsName);
cy.get(commonSelectors.createAppButton).click();
cy.skipWalkthrough();
cy.get('[data-cy="show-ds-popover-button"]').click();
cy.get(".css-4e90k9").type(`${data.dsName}`);
cy.contains(`[id*="react-select-"]`, data.dsName).click();
cy.get('[data-cy="query-rename-input"]').clear().type(data.dsName);
cy.get('[data-cy="query-input-field"]').clearAndTypeOnCodeMirror(
`{
allFilms {
films { title director }
}
}`
);
cy.get(dataSourceSelector.queryPreviewButton).click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
`Query (${data.dsName}) completed.`
);
deleteAppandDatasourceAfterExecution(
data.dsName,
`cypress-${data.dsName}-GraphQL`
);
});
});

View file

@ -0,0 +1,345 @@
import { fake } from "Fixtures/fake";
import { postgreSqlSelector } from "Selectors/postgreSql";
import { postgreSqlText } from "Texts/postgreSql";
import { harperDbText } from "Texts/harperDb";
import { harperDbSelectors } from "Selectors/Plugins";
import { commonSelectors } from "Selectors/common";
import { commonText } from "Texts/common";
import {
fillDataSourceTextField,
selectAndAddDataSource,
} from "Support/utils/postgreSql";
import {
deleteDatasource,
closeDSModal,
deleteAppandDatasourceAfterExecution,
} from "Support/utils/dataSource";
import { dataSourceSelector } from "../../../../../constants/selectors/dataSource";
const data = {};
data.dsName1 = fake.lastName.toLowerCase().replaceAll("[^A-Za-z]", "");
describe("Data source HarperDB", () => {
beforeEach(() => {
cy.apiLogin();
cy.visit("/");
data.dsName = fake.lastName.toLowerCase().replaceAll("[^A-Za-z]", "");
});
it("Should verify elements on HarperDB connection form", () => {
const Host = Cypress.env("harperdb_host");
const Port = Cypress.env("harperdb_port");
const Username = Cypress.env("harperdb_username");
const Password = Cypress.env("harperdb_password");
cy.get(commonSelectors.globalDataSourceIcon).click();
closeDSModal();
cy.get(postgreSqlSelector.allDatasourceLabelAndCount).should(
"have.text",
postgreSqlText.allDataSources()
);
cy.get(postgreSqlSelector.commonlyUsedLabelAndCount).should(
"have.text",
postgreSqlText.commonlyUsed
);
cy.get(postgreSqlSelector.databaseLabelAndCount).should(
"have.text",
postgreSqlText.allDatabase()
);
cy.get(postgreSqlSelector.apiLabelAndCount).should(
"have.text",
postgreSqlText.allApis
);
cy.get(postgreSqlSelector.cloudStorageLabelAndCount).should(
"have.text",
postgreSqlText.allCloudStorage
);
cy.installMarketplacePlugin("HarperDB");
selectAndAddDataSource("databases", harperDbText.harperDb, data.dsName);
fillDataSourceTextField(
harperDbText.hostLabel,
harperDbText.hostInputPlaceholder,
Host
);
fillDataSourceTextField(
harperDbText.portLabel,
harperDbText.portPlaceholder,
Port
);
fillDataSourceTextField(
harperDbText.userNameLabel,
harperDbText.userNamePlaceholder,
Username
);
fillDataSourceTextField(
harperDbText.passwordlabel,
harperDbText.passwordPlaceholder,
Password
);
cy.get(postgreSqlSelector.buttonTestConnection).click();
cy.get(postgreSqlSelector.textConnectionVerified, {
timeout: 10000,
}).should("have.text", postgreSqlText.labelConnectionVerified);
cy.get(postgreSqlSelector.buttonSave)
.verifyVisibleElement("have.text", postgreSqlText.buttonTextSave)
.click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
postgreSqlText.toastDSSaved
);
deleteDatasource(`cypress-${data.dsName}-HarperDB`);
cy.uninstallMarketplacePlugin("HarperDB");
});
it("Should verify functionality of HarperDB connection form", () => {
const Host = Cypress.env("harperdb_host");
const Port = Cypress.env("harperdb_port");
const Username = Cypress.env("harperdb_username");
const Password = Cypress.env("harperdb_password");
cy.get(commonSelectors.globalDataSourceIcon).click();
closeDSModal();
cy.installMarketplacePlugin("HarperDB");
selectAndAddDataSource("databases", harperDbText.harperDb, data.dsName);
fillDataSourceTextField(
harperDbText.hostLabel,
harperDbText.hostInputPlaceholder,
Host
);
fillDataSourceTextField(
harperDbText.portLabel,
harperDbText.portPlaceholder,
Port
);
fillDataSourceTextField(
harperDbText.userNameLabel,
harperDbText.userNamePlaceholder,
Username
);
fillDataSourceTextField(
harperDbText.passwordlabel,
harperDbText.passwordPlaceholder,
Password
);
cy.get(postgreSqlSelector.buttonTestConnection).click();
cy.get(postgreSqlSelector.textConnectionVerified, {
timeout: 10000,
}).should("have.text", postgreSqlText.labelConnectionVerified);
cy.get(postgreSqlSelector.buttonSave)
.verifyVisibleElement("have.text", postgreSqlText.buttonTextSave)
.click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
postgreSqlText.toastDSSaved
);
deleteDatasource(`cypress-${data.dsName}-HarperDB`);
cy.uninstallMarketplacePlugin("HarperDB");
});
it.skip("Should be able to run the query with a valid connection", () => {
const Host = Cypress.env("harperdb_host");
const Port = Cypress.env("harperdb_port");
const Username = Cypress.env("harperdb_username");
const Password = Cypress.env("harperdb_password");
cy.get(commonSelectors.globalDataSourceIcon).click();
closeDSModal();
cy.installMarketplacePlugin("HarperDB");
selectAndAddDataSource("databases", harperDbText.harperDb, data.dsName);
fillDataSourceTextField(
harperDbText.hostLabel,
harperDbText.hostInputPlaceholder,
Host
);
fillDataSourceTextField(
harperDbText.portLabel,
harperDbText.portPlaceholder,
Port
);
fillDataSourceTextField(
harperDbText.userNameLabel,
harperDbText.userNamePlaceholder,
Username
);
fillDataSourceTextField(
harperDbText.passwordlabel,
harperDbText.passwordPlaceholder,
Password
);
cy.get(postgreSqlSelector.buttonTestConnection).click();
cy.get(postgreSqlSelector.textConnectionVerified, {
timeout: 10000,
}).should("have.text", postgreSqlText.labelConnectionVerified);
cy.get(postgreSqlSelector.buttonSave)
.verifyVisibleElement("have.text", postgreSqlText.buttonTextSave)
.click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
postgreSqlText.toastDSSaved
);
cy.get(commonSelectors.dashboardIcon).click();
cy.get(commonSelectors.appCreateButton).click();
cy.get(commonSelectors.appNameInput).click().type(data.dsName);
cy.get(commonSelectors.createAppButton).click();
cy.skipWalkthrough();
cy.get('[data-cy="show-ds-popover-button"]').click();
cy.get(".css-4e90k9").type(`${data.dsName}`);
cy.contains(`[id*="react-select-"]`, data.dsName).click();
cy.get('[data-cy="query-rename-input"]').clear().type(data.dsName);
// Verifying NoSQL Operation
cy.get(".react-select__input")
.eq(1)
.click({ force: true })
.wait(500)
.type(`NoSQL mode{enter}`, { force: true });
const operationsDB = [
"Insert",
"Update",
"Search By Hash",
"Search By Value",
"Search By Condition",
"Delete",
];
operationsDB.forEach((operation) => {
cy.get(".react-select__input")
.eq(2)
.click({ force: true })
.wait(500)
.type(`${operation}{enter}`, { force: true });
const commonFields = {
"schema-input-field": harperDbText.schemaValue,
"table-input-field": harperDbText.tableValue,
};
Object.entries(commonFields).forEach(([field, value]) => {
cy.get(`[data-cy="${field}"]`).clearAndTypeOnCodeMirror(value);
});
if (["Insert", "Update"].includes(operation)) {
cy.get(harperDbSelectors.recordsInputField).clearAndTypeOnCodeMirror(
harperDbText.recordsValue
);
}
if (operation === "Search By Hash") {
cy.get(harperDbSelectors.hashValueInputField).clearAndTypeOnCodeMirror(
harperDbText.hashValue
);
cy.get(harperDbSelectors.attributesInputField).clearAndTypeOnCodeMirror(
harperDbText.attributesValue
);
}
if (operation === "Search By Value") {
cy.get(
harperDbSelectors.searchAttributeInputField
).clearAndTypeOnCodeMirror(harperDbText.searchAttributeValue);
cy.get(
harperDbSelectors.searchValueInputField
).clearAndTypeOnCodeMirror(harperDbText.searchValue);
cy.get(harperDbSelectors.attributesInputField).clearAndTypeOnCodeMirror(
harperDbText.attributesValue
);
}
if (operation === "Search By Condition") {
cy.get(".react-select__input")
.eq(3)
.click({ force: true })
.wait(500)
.type("Or{enter}", { force: true });
cy.get(harperDbSelectors.attributesInputField).clearAndTypeOnCodeMirror(
harperDbText.attributesValue
);
cy.get(harperDbSelectors.conditionInputField).clearAndTypeOnCodeMirror(
harperDbText.condtionValue
);
}
if (operation === "Delete") {
cy.get(harperDbSelectors.hashValueInputField).clearAndTypeOnCodeMirror(
harperDbText.hashValue
);
}
cy.get(dataSourceSelector.queryPreviewButton).click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
`Query (${data.dsName}) completed.`
);
});
// Verifying SQL Operation
cy.get('[data-cy="show-ds-popover-button"]').click();
cy.get(".css-4e90k9").type(`${data.dsName}`);
cy.contains(`[id*="react-select-"]`, data.dsName).click();
cy.get('[data-cy="query-rename-input"]').clear().type(data.dsName1);
cy.get(".react-select__input")
.eq(1)
.should("be.visible")
.click({ force: true })
.wait(500)
.type(`SQL mode{enter}`, { force: true });
cy.wait(1000);
cy.get(harperDbSelectors.sqlQueryInputField).clearAndTypeOnCodeMirror(
harperDbText.sqlValue
);
cy.get(dataSourceSelector.queryPreviewButton).click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
`Query (${data.dsName1}) completed.`
);
deleteAppandDatasourceAfterExecution(
data.dsName,
`cypress-${data.dsName}-HarperDB`
);
cy.uninstallMarketplacePlugin("HarperDB");
});
});

View file

@ -1,8 +1,8 @@
import { fake } from "Fixtures/fake";
import { postgreSqlSelector } from "Selectors/postgreSql";
import { postgreSqlText } from "Texts/postgreSql";
import { commonWidgetText, commonText } from "Texts/common";
import { commonSelectors, commonWidgetSelector } from "Selectors/common";
import { dataSourceSelector } from "Selectors/dataSource";
import {
addQuery,
fillDataSourceTextField,
@ -23,7 +23,8 @@ const data = {};
describe("Data sources", () => {
beforeEach(() => {
cy.appUILogin();
cy.apiLogin();
cy.visit("/");
data.dataSourceName = fake.lastName
.toLowerCase()
.replaceAll("[^A-Za-z]", "");
@ -54,7 +55,25 @@ describe("Data sources", () => {
postgreSqlText.allCloudStorage
);
selectAndAddDataSource("databases", "InfluxDB", data.dataSourceName);
cy.apiCreateGDS(
`${Cypress.env("server_host")}/api/data-sources`,
`cypress-${data.dataSourceName}-influxdb`,
"influxdb",
[
{ key: "api_token", value: "", encrypted: true },
{ key: "port", value: "8086", encrypted: false },
{ key: "host", value: "", encrypted: false },
{ key: "protocol", value: "http", encrypted: false },
]
);
cy.reload();
cy.get(`[data-cy="cypress-${data.dataSourceName}-influxdb-button"]`)
.should("be.visible")
.click();
cy.get(dataSourceSelector.dsNameInputField).should(
"have.value",
`cypress-${data.dataSourceName}-influxdb`
);
cy.get('[data-cy="label-api-token"]').verifyVisibleElement(
"have.text",
@ -99,7 +118,7 @@ describe("Data sources", () => {
"have.text",
postgreSqlText.buttonTextSave
);
cy.get('[data-cy="connection-alert-text"]').verifyVisibleElement(
cy.get(dataSourceSelector.connectionAlertText).verifyVisibleElement(
"have.text",
"Invalid URL"
);

View file

@ -0,0 +1,192 @@
import { postgreSqlSelector } from "Selectors/postgreSql";
import { postgreSqlText } from "Texts/postgreSql";
import { dataSourceSelector } from "Selectors/dataSource";
import { commonSelectors, commonWidgetSelector } from "Selectors/common";
import {
addQuery,
fillDataSourceTextField,
fillConnectionForm,
selectAndAddDataSource,
openQueryEditor,
selectQueryMode,
addGuiQuery,
addWidgetsToAddUser,
} from "Support/utils/postgreSql";
import { fake } from "Fixtures/fake";
import { closeDSModal, deleteDatasource } from "Support/utils/dataSource";
const data = {};
describe("Data sources", () => {
beforeEach(() => {
cy.apiLogin();
cy.visit("/");
data.dataSourceName = fake.lastName
.toLowerCase()
.replaceAll("[^A-Za-z]", "");
});
it("Should verify elements on connection form", () => {
cy.get(commonSelectors.globalDataSourceIcon).click();
closeDSModal();
cy.get(postgreSqlSelector.allDatasourceLabelAndCount).should(
"have.text",
postgreSqlText.allDataSources()
);
cy.get(postgreSqlSelector.commonlyUsedLabelAndCount).should(
"have.text",
postgreSqlText.commonlyUsed
);
cy.get(postgreSqlSelector.databaseLabelAndCount).should(
"have.text",
postgreSqlText.allDatabase()
);
cy.get(postgreSqlSelector.apiLabelAndCount).should(
"have.text",
postgreSqlText.allApis
);
cy.get(postgreSqlSelector.cloudStorageLabelAndCount).should(
"have.text",
postgreSqlText.allCloudStorage
);
cy.apiCreateGDS(
`${Cypress.env("server_host")}/api/data-sources`,
`cypress-${data.dataSourceName}-mariadb`,
"mariadb",
[{ key: "connectionLimit", value: 5 }]
);
cy.reload();
cy.get(`[data-cy="cypress-${data.dataSourceName}-mariadb-button"]`)
.should("be.visible")
.click();
cy.get(dataSourceSelector.dsNameInputField).should(
"have.value",
`cypress-${data.dataSourceName}-mariadb`
);
cy.get(postgreSqlSelector.labelHost).verifyVisibleElement(
"have.text",
postgreSqlText.labelHost
);
cy.get(postgreSqlSelector.labelUserName).verifyVisibleElement(
"have.text",
postgreSqlText.labelUserName
);
cy.get(postgreSqlSelector.labelPassword).verifyVisibleElement(
"have.text",
"Password"
);
cy.get('[data-cy="label-connection-limit"]').verifyVisibleElement(
"have.text",
"Connection Limit"
);
cy.get(postgreSqlSelector.labelPort).verifyVisibleElement(
"have.text",
postgreSqlText.labelPort
);
cy.get(postgreSqlSelector.labelSsl).verifyVisibleElement(
"have.text",
postgreSqlText.labelSSL
);
cy.get('[data-cy="label-database"]').verifyVisibleElement(
"have.text",
"Database"
);
cy.get(postgreSqlSelector.labelSSLCertificate).verifyVisibleElement(
"have.text",
"SSL Certificate"
);
cy.get(postgreSqlSelector.labelIpWhitelist).verifyVisibleElement(
"have.text",
postgreSqlText.whiteListIpText
);
cy.get(postgreSqlSelector.buttonCopyIp).verifyVisibleElement(
"have.text",
postgreSqlText.textCopy
);
cy.get(postgreSqlSelector.linkReadDocumentation).verifyVisibleElement(
"have.text",
postgreSqlText.readDocumentation
);
cy.get(postgreSqlSelector.buttonTestConnection)
.verifyVisibleElement(
"have.text",
postgreSqlText.buttonTextTestConnection
)
.click();
cy.get(postgreSqlSelector.connectionFailedText)
.scrollIntoView()
.verifyVisibleElement("have.text", postgreSqlText.couldNotConnect);
cy.get(postgreSqlSelector.buttonSave).verifyVisibleElement(
"have.text",
postgreSqlText.buttonTextSave
);
// cy.get(dataSourceSelector.connectionAlertText).should("be.visible")
deleteDatasource(`cypress-${data.dataSourceName}-mariadb`);
});
it("Should verify the functionality of MariaDB connection form.", () => {
selectAndAddDataSource("databases", "MariaDB", data.dataSourceName);
fillDataSourceTextField(
postgreSqlText.labelHost,
postgreSqlText.placeholderEnterHost,
Cypress.env("mariadb_host")
);
// fillDataSourceTextField(
// postgreSqlText.labelPort,
// postgreSqlText.placeholderEnterPort,
// "5432"
// );
cy.get('[data-cy="label-port"]').verifyVisibleElement("have.text", "Port");
cy.get('[data-cy="port-text-field"]')
.should("be.visible")
.invoke("attr", "placeholder")
.should("contain", "Enter port");
fillDataSourceTextField(
postgreSqlText.labelUserName,
postgreSqlText.placeholderEnterUserName,
Cypress.env("mariadb_user")
);
fillDataSourceTextField(
postgreSqlText.labelPassword,
"**************",
Cypress.env("mariadb_password")
);
cy.get('[data-cy="label-database"]').verifyVisibleElement(
"have.text",
"Database"
);
cy.get('[data-cy="database-text-field"]')
.should("be.visible")
.invoke("attr", "placeholder")
.should("contain", "Enter name of the database");
cy.get(postgreSqlSelector.buttonTestConnection).click();
cy.get(postgreSqlSelector.textConnectionVerified, {
timeout: 10000,
}).should("have.text", postgreSqlText.labelConnectionVerified);
cy.get(postgreSqlSelector.buttonSave).click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
postgreSqlText.toastDSSaved
);
cy.get(
`[data-cy="cypress-${data.dataSourceName}-mariadb-button"]`
).verifyVisibleElement(
"have.text",
`cypress-${data.dataSourceName}-mariadb`
);
deleteDatasource(`cypress-${data.dataSourceName}-mariadb`);
});
});

View file

@ -0,0 +1,285 @@
import { fake } from "Fixtures/fake";
import { postgreSqlSelector } from "Selectors/postgreSql";
import { postgreSqlText } from "Texts/postgreSql";
import { minioText } from "Texts/minio";
import { minioSelectors } from "Selectors/Plugins";
import { commonSelectors } from "Selectors/common";
import { commonText } from "Texts/common";
import {
fillDataSourceTextField,
selectAndAddDataSource,
} from "Support/utils/postgreSql";
import {
deleteDatasource,
closeDSModal,
deleteAppandDatasourceAfterExecution,
} from "Support/utils/dataSource";
import { dataSourceSelector } from "../../../../../constants/selectors/dataSource";
const data = {};
describe("Data source minio", () => {
beforeEach(() => {
cy.apiLogin();
cy.visit("/");
data.dsName = fake.lastName.toLowerCase().replaceAll("[^A-Za-z]", "");
});
it("Should verify elements on minio connection form", () => {
const Host = Cypress.env("minio_host");
const Port = Cypress.env("minio_port");
const AccessKey = Cypress.env("minio_accesskey");
const SecretKey = Cypress.env("minio_secretkey");
cy.get(commonSelectors.globalDataSourceIcon).click();
closeDSModal();
cy.get(postgreSqlSelector.allDatasourceLabelAndCount).should(
"have.text",
postgreSqlText.allDataSources()
);
cy.get(postgreSqlSelector.commonlyUsedLabelAndCount).should(
"have.text",
postgreSqlText.commonlyUsed
);
cy.get(postgreSqlSelector.databaseLabelAndCount).should(
"have.text",
postgreSqlText.allDatabase()
);
cy.get(postgreSqlSelector.apiLabelAndCount).should(
"have.text",
postgreSqlText.allApis
);
cy.get(postgreSqlSelector.cloudStorageLabelAndCount).should(
"have.text",
postgreSqlText.allCloudStorage
);
selectAndAddDataSource("databases", minioText.minio, data.dsName);
fillDataSourceTextField(
minioText.hostLabel,
minioText.hostInputPlaceholder,
Host
);
fillDataSourceTextField(
minioText.portLabel,
minioText.portPlaceholder,
Port
);
cy.get(`[${minioSelectors.sslToggle}]`).click();
fillDataSourceTextField(
minioText.labelAccesskey,
minioText.placeholderAccessKey,
AccessKey
);
fillDataSourceTextField(
minioText.labelSecretKey,
minioText.placeholderSecretKey,
SecretKey
);
cy.get(postgreSqlSelector.buttonTestConnection).click();
cy.get(postgreSqlSelector.textConnectionVerified, {
timeout: 10000,
}).should("have.text", postgreSqlText.labelConnectionVerified);
cy.get(postgreSqlSelector.buttonSave)
.verifyVisibleElement("have.text", postgreSqlText.buttonTextSave)
.click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
postgreSqlText.toastDSSaved
);
deleteDatasource(`cypress-${data.dsName}-minio`);
});
it("Should verify functionality of minio connection form", () => {
const Host = Cypress.env("minio_host");
const Port = Cypress.env("minio_port");
const AccessKey = Cypress.env("minio_accesskey");
const SecretKey = Cypress.env("minio_secretkey");
cy.get(commonSelectors.globalDataSourceIcon).click();
closeDSModal();
selectAndAddDataSource("databases", minioText.minio, data.dsName);
fillDataSourceTextField(
minioText.hostLabel,
minioText.hostInputPlaceholder,
Host
);
fillDataSourceTextField(
minioText.portLabel,
minioText.portPlaceholder,
Port
);
cy.get(`[${minioSelectors.sslToggle}]`).click();
fillDataSourceTextField(
minioText.labelAccesskey,
minioText.placeholderAccessKey,
AccessKey
);
fillDataSourceTextField(
minioText.labelSecretKey,
minioText.placeholderSecretKey,
SecretKey
);
cy.get(postgreSqlSelector.buttonTestConnection).click();
cy.get(postgreSqlSelector.textConnectionVerified, {
timeout: 10000,
}).should("have.text", postgreSqlText.labelConnectionVerified);
cy.get(postgreSqlSelector.buttonSave)
.verifyVisibleElement("have.text", postgreSqlText.buttonTextSave)
.click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
postgreSqlText.toastDSSaved
);
deleteDatasource(`cypress-${data.dsName}-minio`);
});
it.skip("Should be able to run the query with a valid connection", () => {
const Host = Cypress.env("minio_host");
const Port = Cypress.env("minio_port");
const AccessKey = Cypress.env("minio_accesskey");
const SecretKey = Cypress.env("minio_secretkey");
cy.get(commonSelectors.globalDataSourceIcon).click();
closeDSModal();
selectAndAddDataSource("databases", minioText.minio, data.dsName);
fillDataSourceTextField(
minioText.hostLabel,
minioText.hostInputPlaceholder,
Host
);
fillDataSourceTextField(
minioText.portLabel,
minioText.portPlaceholder,
Port
);
cy.get(`[${minioSelectors.sslToggle}]`).click();
fillDataSourceTextField(
minioText.labelAccesskey,
minioText.placeholderAccessKey,
AccessKey
);
fillDataSourceTextField(
minioText.labelSecretKey,
minioText.placeholderSecretKey,
SecretKey
);
cy.get(postgreSqlSelector.buttonTestConnection).click();
cy.get(postgreSqlSelector.textConnectionVerified, {
timeout: 10000,
}).should("have.text", postgreSqlText.labelConnectionVerified);
cy.get(postgreSqlSelector.buttonSave)
.verifyVisibleElement("have.text", postgreSqlText.buttonTextSave)
.click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
postgreSqlText.toastDSSaved
);
cy.get(commonSelectors.dashboardIcon).click();
cy.get(commonSelectors.appCreateButton).click();
cy.get(commonSelectors.appNameInput).click().type(data.dsName);
cy.get(commonSelectors.createAppButton).click();
cy.skipWalkthrough();
cy.get('[data-cy="show-ds-popover-button"]').click();
cy.get(".css-4e90k9").type(`${data.dsName}`);
cy.contains(`[id*="react-select-"]`, data.dsName).click();
cy.get('[data-cy="query-rename-input"]').clear().type(data.dsName);
const operationsMinio = [
"List buckets",
"Put object",
"List objects in a bucket",
"Read object",
"Presigned url for download",
"Presigned url for upload",
"Remove object",
];
operationsMinio.forEach((operation) => {
cy.get(".react-select__input")
.eq(1)
.type(`${operation}{enter}`, { force: true });
if (operation === "List objects in a bucket") {
cy.get(minioSelectors.bucketNameInputField).clearAndTypeOnCodeMirror(
minioText.bucketName
);
}
if (operation === "Read object" || operation === "Remove object") {
cy.get(minioSelectors.bucketNameInputField).clearAndTypeOnCodeMirror(
minioText.bucketName
);
cy.get(minioSelectors.objectNameInputField).clearAndTypeOnCodeMirror(
minioText.objectName
);
}
if (operation === "Put object") {
cy.get(minioSelectors.bucketNameInputField).clearAndTypeOnCodeMirror(
minioText.bucketName
);
cy.get(minioSelectors.objectNameInputField).clearAndTypeOnCodeMirror(
minioText.objectName
);
cy.get(minioSelectors.contentTypeInputField).clearAndTypeOnCodeMirror(
'"string"'
);
cy.get(minioSelectors.dataInput).clearAndTypeOnCodeMirror(`test`);
}
if (
operation === "Presigned url for download" ||
operation === "Presigned url for upload"
) {
cy.get(minioSelectors.bucketNameInputField).clearAndTypeOnCodeMirror(
minioText.bucketName
);
cy.get(minioSelectors.objectNameInputField).clearAndTypeOnCodeMirror(
minioText.objectName
);
}
cy.get(dataSourceSelector.queryPreviewButton).click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
`Query (${data.dsName}) completed.`
);
});
deleteAppandDatasourceAfterExecution(
data.dsName,
`cypress-${data.dsName}-minio`
);
});
});

View file

@ -0,0 +1,405 @@
import { fake } from "Fixtures/fake";
import { postgreSqlSelector } from "Selectors/postgreSql";
import { postgreSqlText } from "Texts/postgreSql";
import { mongoDbText } from "Texts/mongoDb";
import { commonSelectors } from "Selectors/common";
import { dataSourceSelector } from "Selectors/dataSource";
import { closeDSModal, deleteDatasource } from "Support/utils/dataSource";
import {
fillDataSourceTextField,
selectAndAddDataSource,
} from "Support/utils/postgreSql";
import {
connectMongo,
openMongoQueryEditor,
selectQueryType,
} from "Support/utils/mongoDB";
import {
verifyCouldnotConnectWithAlert,
resizeQueryPanel,
query,
verifypreview,
addInput,
} from "Support/utils/dataSource";
const data = {};
describe("Data source MongoDB", () => {
beforeEach(() => {
cy.apiLogin();
cy.visit("/");
data.dataSourceName = fake.lastName
.toLowerCase()
.replaceAll("[^A-Za-z]", "");
});
it("Should verify elements on MongoDB connection form", () => {
cy.get(commonSelectors.globalDataSourceIcon).click();
closeDSModal();
cy.get(postgreSqlSelector.allDatasourceLabelAndCount).should(
"have.text",
postgreSqlText.allDataSources()
);
cy.get(postgreSqlSelector.commonlyUsedLabelAndCount).should(
"have.text",
postgreSqlText.commonlyUsed
);
cy.get(postgreSqlSelector.databaseLabelAndCount).should(
"have.text",
postgreSqlText.allDatabase()
);
cy.get(postgreSqlSelector.apiLabelAndCount).should(
"have.text",
postgreSqlText.allApis
);
cy.get(postgreSqlSelector.cloudStorageLabelAndCount).should(
"have.text",
postgreSqlText.allCloudStorage
);
cy.apiCreateGDS(
`${Cypress.env("server_host")}/api/data-sources`,
`cypress-${data.dataSourceName}-mongodb`,
"mongodb",
[
{ key: "database", value: "", encrypted: false },
{ key: "host", value: "localhost" },
{ key: "port", value: 27017 },
{ key: "username", value: "" },
{ key: "password", value: "", encrypted: true },
{ key: "connection_type", value: "manual" },
{ key: "connection_string", value: "", encrypted: true },
{ key: "tls_certificate", value: "none", encrypted: false },
]
);
cy.reload();
cy.get(`[data-cy="cypress-${data.dataSourceName}-mongodb-button"]`)
.should("be.visible")
.click();
cy.get(dataSourceSelector.dsNameInputField).should(
"have.value",
`cypress-${data.dataSourceName}-mongodb`
);
cy.get(postgreSqlSelector.labelHost).verifyVisibleElement(
"have.text",
postgreSqlText.labelHost
);
cy.get(postgreSqlSelector.labelPort).verifyVisibleElement(
"have.text",
postgreSqlText.labelPort
);
cy.get(postgreSqlSelector.labelDbName).verifyVisibleElement(
"have.text",
"Database Name"
);
cy.get(postgreSqlSelector.labelUserName).verifyVisibleElement(
"have.text",
postgreSqlText.labelUserName
);
cy.get(postgreSqlSelector.labelPassword).verifyVisibleElement(
"have.text",
postgreSqlText.labelPassword
);
cy.get(postgreSqlSelector.labelIpWhitelist).verifyVisibleElement(
"have.text",
postgreSqlText.whiteListIpText
);
cy.get(postgreSqlSelector.buttonCopyIp).verifyVisibleElement(
"have.text",
postgreSqlText.textCopy
);
cy.get(postgreSqlSelector.linkReadDocumentation).verifyVisibleElement(
"have.text",
postgreSqlText.readDocumentation
);
cy.get(postgreSqlSelector.buttonTestConnection)
.verifyVisibleElement(
"have.text",
postgreSqlText.buttonTextTestConnection
)
.click();
cy.get(postgreSqlSelector.connectionFailedText, {
timeout: 70000,
}).verifyVisibleElement("have.text", postgreSqlText.couldNotConnect, {
timeout: 65000,
});
cy.get(postgreSqlSelector.buttonSave).verifyVisibleElement(
"have.text",
postgreSqlText.buttonTextSave
);
cy.get(dataSourceSelector.connectionAlertText).verifyVisibleElement(
"have.text",
mongoDbText.errorConnectionRefused
);
cy.get('[data-cy="connection-type-select-dropdown"]').type(
mongoDbText.optionConnectUsingConnectionString
);
cy.get('[data-cy="label-connection-string"]').verifyVisibleElement(
"have.text",
mongoDbText.labelConnectionString
);
cy.get(postgreSqlSelector.labelIpWhitelist).verifyVisibleElement(
"have.text",
postgreSqlText.whiteListIpText
);
cy.get(postgreSqlSelector.buttonCopyIp).verifyVisibleElement(
"have.text",
postgreSqlText.textCopy
);
cy.get(postgreSqlSelector.linkReadDocumentation).verifyVisibleElement(
"have.text",
postgreSqlText.readDocumentation
);
cy.get(postgreSqlSelector.buttonTestConnection)
.verifyVisibleElement(
"have.text",
postgreSqlText.buttonTextTestConnection
)
.click();
cy.get(postgreSqlSelector.connectionFailedText, {
timeout: 70000,
}).verifyVisibleElement("have.text", postgreSqlText.couldNotConnect, {
timeout: 95000,
});
cy.get(dataSourceSelector.connectionAlertText).verifyVisibleElement(
"have.text",
"Cannot read properties of null (reading '2')"
);
verifyCouldnotConnectWithAlert(mongoDbText.errorInvalisScheme);
cy.get(postgreSqlSelector.buttonSave)
.verifyVisibleElement("have.text", postgreSqlText.buttonTextSave)
.click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
postgreSqlText.toastDSSaved
);
cy.wait(1000);
deleteDatasource(`cypress-${data.dataSourceName}-mongodb`);
});
it("Should verify the functionality of MongoDB connection form.", () => {
selectAndAddDataSource(
"databases",
mongoDbText.mongoDb,
data.dataSourceName
);
cy.get('[data-cy="connection-type-select-dropdown"]').type(
mongoDbText.optionConnectUsingConnectionString
);
fillDataSourceTextField(
mongoDbText.labelConnectionString,
"**************",
Cypress.env("mongodb_connString"),
"contain",
{ parseSpecialCharSequences: false, delay: 0 }
);
cy.get(postgreSqlSelector.buttonTestConnection).click();
cy.get(postgreSqlSelector.textConnectionVerified, {
timeout: 10000,
}).should("have.text", postgreSqlText.labelConnectionVerified);
cy.get(postgreSqlSelector.buttonSave).click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
postgreSqlText.toastDSSaved
);
cy.get(commonSelectors.globalDataSourceIcon).click();
cy.get(
`[data-cy="cypress-${data.dataSourceName}-mongodb-button"]`
).verifyVisibleElement(
"have.text",
`cypress-${data.dataSourceName}-mongodb`
);
deleteDatasource(`cypress-${data.dataSourceName}-mongodb`);
});
it.skip("Should verify the queries of MongoDB.", () => {
connectMongo();
openMongoQueryEditor();
resizeQueryPanel();
selectQueryType("Delete Many");
addInput("collection", "test");
query("run");
cy.verifyToastMessage(".go2072408551", "Query (mongodb1) completed.");
selectQueryType("List Collections");
query("run");
cy.verifyToastMessage(".go2072408551", "Query (mongodb1) completed.");
query("preview");
verifypreview("raw", '[{"name":"test"'); //'root:[] 0 items'
selectQueryType("Insert One");
addInput("collection", "test");
addInput("document", '{name:"mike"}');
query("run");
cy.verifyToastMessage(".go2072408551", "Query (mongodb1) completed.");
query("preview");
verifypreview("raw", '{"acknowledged":true,"insertedId"');
selectQueryType("Find One");
addInput("collection", "test");
addInput("filter", '{name:"mike"}');
query("run");
cy.verifyToastMessage(".go2072408551", "Query (mongodb1) completed.");
query("preview");
verifypreview("raw", '"name":"mike"}');
selectQueryType("Find many");
addInput("collection", "test");
addInput("filter", '{name:"mike"}');
query("run");
cy.verifyToastMessage(".go2072408551", "Query (mongodb1) completed.");
query("preview");
verifypreview("raw", '"name":"mike"}');
selectQueryType("Total Count");
addInput("collection", "test");
query("run");
cy.verifyToastMessage(".go2072408551", "Query (mongodb1) completed.");
query("preview");
verifypreview("raw", '{"count":');
selectQueryType("Count");
addInput("collection", "test");
query("run");
cy.verifyToastMessage(".go2072408551", "Query (mongodb1) completed.");
query("preview");
verifypreview("raw", '{"count":');
selectQueryType("Distinct");
addInput("collection", "test");
addInput("field", "name");
query("run");
cy.verifyToastMessage(".go2072408551", "Query (mongodb1) completed.");
query("preview");
verifypreview("raw", '["mike"]');
selectQueryType("Insert Many");
addInput("collection", "test");
addInput(
"documents",
'[{_id:331, name:"Nina"},{_id:441, name:"mina"}, {_id:4441, name:"Steph"}, {_id:41, name:"Mark"},{_id:3131, name:"Lina"}]'
);
query("run");
cy.verifyToastMessage(".go2072408551", "Query (mongodb1) completed.");
addInput("documents", '[{_id:3113, name:"Nina"},{_id:414, name:"mina"}]');
query("preview");
verifypreview(
"raw",
'{"acknowledged":true,"insertedCount":2,"insertedIds":{"0":3113,"1":414}}'
);
selectQueryType("Update One");
addInput("collection", "test");
addInput("filter", '{name:"mina"}');
addInput("update", '{$set:{name: "mike2023"}}');
query("run");
cy.verifyToastMessage(".go2072408551", "Query (mongodb1) completed.");
query("preview");
verifypreview(
"raw",
'{"acknowledged":true,"modifiedCount":1,"upsertedId":null,"upsertedCount":0'
);
selectQueryType("Update Many");
addInput("collection", "test");
addInput("filter", '{name:"Nina"}');
addInput("update", '{$set:{name: "mike22222"}}');
query("run");
cy.verifyToastMessage(".go2072408551", "Query (mongodb1) completed.");
addInput("filter", '{name:"mike22222"}');
addInput("update", '{$set:{name: "Mark"}}');
query("preview");
verifypreview(
"raw",
'{"acknowledged":true,"modifiedCount":2,"upsertedId":null,"upsertedCount":0'
);
selectQueryType("Replace One");
addInput("collection", "test");
addInput("filter", '{name:"mike"}');
addInput("replacement", '{name: "mike2023"}');
query("run");
cy.verifyToastMessage(".go2072408551", "Query (mongodb1) completed.");
addInput("filter", '{name:"mike"}');
addInput("replacement", '{name: "Nina"}');
query("preview");
verifypreview(
"raw",
'{"acknowledged":true,"modifiedCount":1,"upsertedId":null,"upsertedCount":0'
);
selectQueryType("Find One and Update");
addInput("collection", "test");
addInput("filter", '{name:"mike"}');
addInput("update", '{$set:{name: "mike2023"}}');
query("run");
cy.verifyToastMessage(".go2072408551", "Query (mongodb1) completed.");
addInput("filter", '{name:"Mark"}');
addInput("update", '{$set:{name: "Nina"}}');
query("preview");
verifypreview(
"raw",
'{"lastErrorObject":{"n":1,"updatedExisting":true},"value":{"_id":'
);
selectQueryType("Find One and Replace");
addInput("collection", "test");
addInput("filter", '{name:"mike"}');
addInput("replacement", '{name: "mike2023"}');
query("run");
cy.verifyToastMessage(".go2072408551", "Query (mongodb1) completed.");
addInput("filter", '{name:"mike2023"}');
addInput("replacement", '{name: "Nina"}');
query("preview");
verifypreview(
"raw",
'{"lastErrorObject":{"n":1,"updatedExisting":true},"value":{"_id":'
);
selectQueryType("Find One and Delete");
addInput("collection", "test");
addInput("filter", '{name:"Nina"}');
query("run");
cy.verifyToastMessage(".go2072408551", "Query (mongodb1) completed.");
addInput("filter", '{name:"mike2023"}');
query("preview");
verifypreview("raw", '{"lastErrorObject":{"n":1},"value":{"_id":');
selectQueryType("Delete One");
addInput("collection", "test");
addInput("filter", '{name:"mike"}');
query("run");
cy.verifyToastMessage(".go2072408551", "Query (mongodb1) completed.");
addInput("filter", '{name:"Lina"}');
query("preview");
verifypreview("raw", '{"acknowledged":true,"deletedCount":1}');
selectQueryType("Aggregate");
addInput("collection", "test");
addInput("pipeline", '[{$match:{name:"mike2023"}}, {$match:{_id:414}}]');
query("run");
cy.verifyToastMessage(".go2072408551", "Query (mongodb1) completed.");
query("preview");
verifypreview("raw", '[{"_id":414,"name":"mike2023"}]');
selectQueryType("Operations");
addInput("collection", "test");
addInput("operations", '[{insertOne:{name:"midhun"}}]');
query("run");
cy.verifyToastMessage(".go2072408551", "Query (mongodb1) completed.");
query("preview");
verifypreview(
"raw",
'{"ok":1,"writeErrors":[],"writeConcernErrors":[],"insertedIds":[{"index":'
);
});
});

View file

@ -0,0 +1,506 @@
import { fake } from "Fixtures/fake";
import { postgreSqlSelector } from "Selectors/postgreSql";
import { postgreSqlText } from "Texts/postgreSql";
import { mySqlText } from "Texts/mysql";
import { commonSelectors } from "Selectors/common";
import { commonWidgetText, commonText } from "Texts/common";
import {
fillDataSourceTextField,
selectAndAddDataSource,
addQuery,
fillConnectionForm,
openQueryEditor,
selectQueryMode,
addGuiQuery,
addWidgetsToAddUser,
} from "Support/utils/postgreSql";
import {
closeDSModal,
deleteDatasource,
verifyCouldnotConnectWithAlert,
} from "Support/utils/dataSource";
import { dataSourceSelector } from "Selectors/dataSource";
import { realHover } from "cypress-real-events/commands/realHover";
const data = {};
describe("Data sources MySql", () => {
beforeEach(() => {
cy.apiLogin();
cy.visit("/");
data.dataSourceName = fake.lastName
.toLowerCase()
.replaceAll("[^A-Za-z]", "");
});
it("Should verify elements on MySQL connection form", () => {
cy.get(commonSelectors.globalDataSourceIcon).click();
closeDSModal();
cy.get(postgreSqlSelector.allDatasourceLabelAndCount).should(
"have.text",
postgreSqlText.allDataSources()
);
cy.get(postgreSqlSelector.commonlyUsedLabelAndCount).should(
"have.text",
postgreSqlText.commonlyUsed
);
cy.get(postgreSqlSelector.databaseLabelAndCount).should(
"have.text",
postgreSqlText.allDatabase()
);
cy.get(postgreSqlSelector.apiLabelAndCount).should(
"have.text",
postgreSqlText.allApis
);
cy.get(postgreSqlSelector.cloudStorageLabelAndCount).should(
"have.text",
postgreSqlText.allCloudStorage
);
cy.apiCreateGDS(
`${Cypress.env("server_host")}/api/data-sources`,
`cypress-${data.dataSourceName}-mysql`,
"mysql",
[
{ key: "connection_type", value: "hostname" },
{ key: "host", value: "localhost" },
{ key: "port", value: 3306 },
{ key: "database", value: "" },
{ key: "socket", value: "", encrypted: false },
{ key: "username", value: "" },
{ key: "password", value: "", encrypted: true },
{ key: "ssl_enabled", value: false, encrypted: false },
{ key: "ssl_certificate", value: "none", encrypted: false },
]
);
cy.reload();
cy.get(`[data-cy="cypress-${data.dataSourceName}-mysql-button"]`)
.should("be.visible")
.click();
cy.get(dataSourceSelector.dsNameInputField).should(
"have.value",
`cypress-${data.dataSourceName}-mysql`
);
cy.get(postgreSqlSelector.labelHost).verifyVisibleElement(
"have.text",
postgreSqlText.labelHost
);
cy.get(postgreSqlSelector.labelPort).verifyVisibleElement(
"have.text",
postgreSqlText.labelPort
);
cy.get(postgreSqlSelector.labelSsl).verifyVisibleElement(
"have.text",
postgreSqlText.labelSSL
);
cy.get(postgreSqlSelector.labelDbName).verifyVisibleElement(
"have.text",
postgreSqlText.labelDbName
);
cy.get(postgreSqlSelector.labelUserName).verifyVisibleElement(
"have.text",
postgreSqlText.labelUserName
);
cy.get(postgreSqlSelector.labelPassword).verifyVisibleElement(
"have.text",
postgreSqlText.labelPassword
);
cy.get(postgreSqlSelector.labelIpWhitelist).verifyVisibleElement(
"have.text",
postgreSqlText.whiteListIpText
);
cy.get(postgreSqlSelector.buttonCopyIp).verifyVisibleElement(
"have.text",
postgreSqlText.textCopy
);
cy.get(postgreSqlSelector.linkReadDocumentation).verifyVisibleElement(
"have.text",
postgreSqlText.readDocumentation
);
cy.get(postgreSqlSelector.buttonTestConnection)
.verifyVisibleElement(
"have.text",
postgreSqlText.buttonTextTestConnection
)
.click();
cy.get(postgreSqlSelector.buttonSave).verifyVisibleElement(
"have.text",
postgreSqlText.buttonTextSave
);
verifyCouldnotConnectWithAlert(mySqlText.errorConnectionRefused);
deleteDatasource(`cypress-${data.dataSourceName}-mysql`);
});
it("Should verify the functionality of MySQL connection form.", () => {
selectAndAddDataSource("databases", "MySQL", data.dataSourceName);
fillDataSourceTextField(
postgreSqlText.labelHost,
postgreSqlText.placeholderEnterHost,
Cypress.env("mysql_host")
);
fillDataSourceTextField(
postgreSqlText.labelPort,
postgreSqlText.placeholderEnterPort,
"3318"
);
fillDataSourceTextField(
postgreSqlText.labelDbName,
postgreSqlText.placeholderNameOfDB,
"unknowndb"
);
fillDataSourceTextField(
postgreSqlText.labelUserName,
postgreSqlText.placeholderEnterUserName,
Cypress.env("mysql_user")
);
fillDataSourceTextField(
postgreSqlText.labelPassword,
"**************",
Cypress.env("mysql_password")
);
cy.get(postgreSqlSelector.buttonTestConnection).click();
cy.wait(500);
verifyCouldnotConnectWithAlert("");
fillDataSourceTextField(
postgreSqlText.labelDbName,
postgreSqlText.placeholderNameOfDB,
"test_db"
);
fillDataSourceTextField(
postgreSqlText.labelUserName,
postgreSqlText.placeholderEnterUserName,
"admin1"
);
cy.get(postgreSqlSelector.buttonTestConnection).click();
cy.wait(500);
verifyCouldnotConnectWithAlert(
"ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client"
);
fillDataSourceTextField(
postgreSqlText.labelUserName,
postgreSqlText.placeholderEnterUserName,
Cypress.env("mysql_user")
);
cy.get(postgreSqlSelector.passwordTextField).type("testpassword");
cy.get(postgreSqlSelector.buttonTestConnection).click();
cy.wait(500);
verifyCouldnotConnectWithAlert(
"ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'103.171.99.42' (using password: YES)"
);
cy.get('[data-cy="ssl-enabled-toggle-input"]').then(($el) => {
if ($el.is(":checked")) {
cy.get('[data-cy="ssl-enabled-toggle-input"]').uncheck();
}
});
fillDataSourceTextField(
postgreSqlText.labelPassword,
"**************",
Cypress.env("mysql_password")
);
// cy.get(postgreSqlSelector.passwordTextField).should("be.visible");
// cy.get(".datasource-edit-btn").should("be.visible").click();
// cy.get(postgreSqlSelector.passwordTextField).type(
// `{selectAll}{backspace}${Cypress.env("mysql_password")}`,
// { log: false }
// );
cy.get(postgreSqlSelector.buttonTestConnection).click();
cy.get(postgreSqlSelector.textConnectionVerified, {
timeout: 10000,
}).should("have.text", postgreSqlText.labelConnectionVerified);
cy.get(postgreSqlSelector.buttonSave).click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
postgreSqlText.toastDSSaved
);
cy.get(commonSelectors.globalDataSourceIcon).click();
cy.get(
`[data-cy="cypress-${data.dataSourceName}-mysql-button"]`
).verifyVisibleElement("have.text", `cypress-${data.dataSourceName}-mysql`);
deleteDatasource(`cypress-${data.dataSourceName}-mysql`);
});
it.skip("Should verify elements of the Query section.", () => {
cy.viewport(1200, 1300);
selectAndAddDataSource("databases", "MySQL", data.dataSourceName);
fillConnectionForm({
Host: Cypress.env("mysql_host"),
Port: Cypress.env("mysql_port"),
"Database name": "test_db",
Username: Cypress.env("mysql_user"),
Password: Cypress.env("mysql_password"),
});
cy.get('[class="query-pane"]').invoke("css", "height", "calc(85%)");
openQueryEditor("MySQL");
// cy.get('[class="query-pane"]').invoke("css", "height", "calc(95%)");
// cy.get(postgreSqlSelector.addQueriesCard)
// .verifyVisibleElement("contain", mySqlText.cypressMySql)
// .click();
// cy.get(postgreSqlSelector.queryTabGeneral).verifyVisibleElement(
// "contain",
// postgreSqlText.tabGeneral
// );
// cy.get(postgreSqlSelector.queryLabelInputField).verifyVisibleElement(
// "have.value",
// postgreSqlText.firstQueryName
// );
// cy.get(postgreSqlSelector.queryPreviewButton).verifyVisibleElement(
// "have.text",
// postgreSqlText.buttonLabelPreview
// );
// cy.get(postgreSqlSelector.queryCreateAndRunButton).verifyVisibleElement(
// "have.text",
// postgreSqlText.buttonLabelCreateAndRun
// );
// cy.get(postgreSqlSelector.queryCreateDropdown).should("be.visible").click();
// cy.get(postgreSqlSelector.queryCreateAndRunOption).verifyVisibleElement(
// "have.text",
// postgreSqlText.buttonLabelCreateAndRun
// );
// cy.get(postgreSqlSelector.queryCreateOption)
// .verifyVisibleElement("have.text", postgreSqlText.buttonLabelCreate)
// .click();
// cy.get(postgreSqlSelector.queryCreateAndRunButton).verifyVisibleElement(
// "have.text",
// postgreSqlText.buttonLabelCreate
// );
cy.get('[class="query-pane"]').invoke("css", "height", "calc(85%)");
cy.get(`${postgreSqlSelector.querySelectDropdown}:eq(0)`)
.scrollIntoView()
.should("be.visible")
.click();
cy.contains("[id*=react-select-]", postgreSqlText.queryModeSql).should(
"have.text",
postgreSqlText.queryModeSql
);
cy.contains("[id*=react-select-]", postgreSqlText.queryModeGui).should(
"have.text",
postgreSqlText.queryModeGui
);
cy.get(postgreSqlSelector.queryCreateAndRunButton)
.should("be.visible")
.click();
// cy.get('[data-cy="list-query-mysql1"]').should("be.visible").click();
cy.get(postgreSqlSelector.labelTransformation)
.scrollIntoView()
.verifyVisibleElement("have.text", postgreSqlText.headerTransformations);
cy.wait(200);
cy.get(postgreSqlSelector.toggleTransformation).parent().click();
cy.get(postgreSqlSelector.inputFieldTransformation).should("be.visible");
cy.get(postgreSqlSelector.toggleTransformation).parent().click();
cy.get(postgreSqlSelector.headerQueryPreview).verifyVisibleElement(
"have.text",
postgreSqlText.buttonLabelPreview
);
cy.get(postgreSqlSelector.previewTabJson).verifyVisibleElement(
"have.text",
postgreSqlText.json
);
cy.get(postgreSqlSelector.previewTabRaw).verifyVisibleElement(
"have.text",
postgreSqlText.raw
);
selectQueryMode(postgreSqlText.queryModeGui, "4");
cy.get(postgreSqlSelector.operationsDropDownLabel).verifyVisibleElement(
"have.text",
postgreSqlText.labelOperation
);
cy.get(`${postgreSqlSelector.querySelectDropdown}:eq(1)`).click();
cy.contains('[id*="react-select-10"]', postgreSqlText.guiOptionBulkUpdate)
.should("have.text", postgreSqlText.guiOptionBulkUpdate)
.click();
cy.get(postgreSqlSelector.labelTableNameInputField).verifyVisibleElement(
"have.text",
postgreSqlText.labelTable
);
cy.get(postgreSqlSelector.labelPrimaryKeyColoumn).verifyVisibleElement(
"have.text",
postgreSqlText.labelPrimaryKeyColumn
);
cy.get('[data-cy="label-records"]').verifyVisibleElement(
"have.text",
"Records"
);
// cy.get(postgreSqlSelector.queryTabAdvanced)
// .verifyVisibleElement("contain", postgreSqlText.tabAdvanced)
// .click();
cy.get(postgreSqlSelector.labelRunQueryOnPageLoad).verifyVisibleElement(
"have.text",
postgreSqlText.toggleLabelRunOnPageLoad
);
cy.get(
postgreSqlSelector.labelRequestConfirmationOnRun
).verifyVisibleElement("have.text", postgreSqlText.toggleLabelconfirmation);
cy.get(postgreSqlSelector.labelShowNotification).verifyVisibleElement(
"have.text",
postgreSqlText.toggleLabelShowNotification
);
cy.get(postgreSqlSelector.toggleNotification).parent().click();
cy.get(postgreSqlSelector.labelSuccessMessageInput).verifyVisibleElement(
"have.text",
postgreSqlText.labelSuccessMessage
);
cy.get(postgreSqlSelector.notificationDurationInput).verifyVisibleElement(
"have.text",
postgreSqlText.labelNotificatioDuration
);
cy.get(postgreSqlSelector.addEventHandler).verifyVisibleElement(
"have.text",
commonWidgetText.addEventHandlerLink
);
cy.get(postgreSqlSelector.noEventHandlerMessage).verifyVisibleElement(
"have.text",
postgreSqlText.labelNoEventhandler
);
cy.get('[data-cy="list-query-mysql1"]').verifyVisibleElement(
"have.text",
"mysql1"
);
cy.get('[class="row query-row query-row-selected"]')
.realHover()
.then(() => {
cy.get('[data-cy="delete-query-mysql1"]').click();
});
cy.get(postgreSqlSelector.deleteModalMessage).verifyVisibleElement(
"have.text",
postgreSqlText.dialogueTextDelete
);
cy.get(postgreSqlSelector.deleteModalCancelButton).verifyVisibleElement(
"have.text",
postgreSqlText.cancel
);
cy.get(postgreSqlSelector.deleteModalConfirmButton)
.verifyVisibleElement("have.text", postgreSqlText.yes)
.click();
});
it.skip("Should verify CRUD operations on SQL Query.", () => {
let dbName = "7mmplik";
selectAndAddDataSource("databases", "MySQL", data.dataSourceName);
cy.clearAndType(
postgreSqlSelector.dataSourceNameInputField,
mySqlText.cypressMySql
);
cy.get('[class="query-pane"]').invoke("css", "height", "calc(85%)");
cy.intercept("GET", "api/data_sources?**").as("datasource");
fillConnectionForm({
Host: Cypress.env("mysql_host"),
Port: Cypress.env("mysql_port"),
"Database name": "test_db",
Username: Cypress.env("mysql_user"),
Password: Cypress.env("mysql_password"),
});
cy.wait("@datasource");
addQuery(
"table_creation",
`CREATE TABLE ${dbName} (id MEDIUMINT NOT NULL AUTO_INCREMENT, name CHAR(30) NOT NULL,email VARCHAR(255),PRIMARY KEY (id));`,
mySqlText.cypressMySql
);
addQuery(
"table_preview",
`SELECT * FROM ${dbName}`,
mySqlText.cypressMySql
);
addQuery(
"existance_of_table",
`SHOW TABLES LIKE '${dbName}';`,
mySqlText.cypressMySql
);
cy.get(postgreSqlSelector.queryPreviewButton, { timeout: 3000 }).click();
cy.get('[class="tab-pane active"]', { timeout: 3000 }).should("be.visible");
cy.get(postgreSqlSelector.previewTabRaw, { timeout: 3000 })
.scrollIntoView()
.should("be.visible", { timeout: 3000 })
.click();
cy.get(".p-3").should(
"have.text",
`[{"Tables_in_test_db (${dbName})":"${dbName}"}]`
);
// addQuery(
// "add_data_using_widgets",
// `INSERT INTO "public"."cypress_test_users"("name", "email") VALUES('{{components.textinput1.value{rightArrow}{rightArrow}', '{{}{{}components.textinput2.value{rightArrow}{rightArrow}') RETURNING "id", "name", "email";`,
// mySqlText.cypressMySql
// );
addQuery(
"truncate_table",
`TRUNCATE TABLE ${dbName}`,
mySqlText.cypressMySql
);
cy.get(postgreSqlSelector.queryPreviewButton).click();
cy.get('[class="tab-pane active"]', { timeout: 3000 }).should("be.visible");
cy.get(postgreSqlSelector.previewTabRaw).click();
cy.get('[class="tab-pane active"]').should(
"have.text",
`{"fieldCount":0,"affectedRows":0,"insertId":0,"serverStatus":2,"warningCount":0,"message":"","protocol41":true,"changedRows":0}`
);
addQuery("drop_table", `DROP TABLE ${dbName}`, mySqlText.cypressMySql);
cy.get('[data-cy="list-query-existance_of_table"]').click();
cy.get(postgreSqlSelector.queryPreviewButton).click();
cy.get('[class="tab-pane active"]', { timeout: 3000 }).should("be.visible");
cy.get(postgreSqlSelector.previewTabRaw).click();
cy.get('[class="tab-pane active"]').should("have.text", "[]");
// addWidgetsToAddUser();
});
it.skip("Should verify bulk update", () => {
selectAndAddDataSource("databases", "MySQL", data.dataSourceName);
cy.clearAndType(
postgreSqlSelector.dataSourceNameInputField,
mySqlText.cypressMySql
);
fillConnectionForm({
Host: Cypress.env("mysql_host"),
Port: "3318",
"Database name": "test_db",
Username: Cypress.env("mysql_user"),
Password: Cypress.env("mysql_password"),
});
openQueryEditor(mySqlText.cypressMySql);
cy.get('[class="query-pane"]').invoke("css", "height", "calc(85%)");
selectQueryMode(postgreSqlText.queryModeGui);
addGuiQuery("name", "email");
cy.get(postgreSqlSelector.queryCreateAndRunButton).click();
});
});

View file

@ -15,7 +15,7 @@ import {
describe("Data sources", () => {
beforeEach(() => {
cy.appUILogin();
cy.apiLogin();
// cy.createApp();
});
@ -123,7 +123,7 @@ describe("Data sources", () => {
);
cy.clearAndType(
'[data-cy="data-source-name-input-filed"]',
'[data-cy="data-source-name-input-field"]',
postgreSqlText.psqlName
);

View file

@ -3,6 +3,7 @@ import { postgreSqlSelector } from "Selectors/postgreSql";
import { postgreSqlText } from "Texts/postgreSql";
import { commonWidgetText, commonText } from "Texts/common";
import { commonSelectors, commonWidgetSelector } from "Selectors/common";
import { dataSourceSelector } from "Selectors/dataSource";
import {
addQuery,
fillDataSourceTextField,
@ -19,13 +20,14 @@ const data = {};
describe("Data sources", () => {
beforeEach(() => {
cy.appUILogin();
cy.apiLogin();
cy.visit("/");
data.dataSourceName = fake.lastName
.toLowerCase()
.replaceAll("[^A-Za-z]", "");
});
it("Should verify elements on connection form", () => {
it("Should verify elements on connection form with validation", () => {
cy.log(process.env.NODE_ENV);
cy.log(postgreSqlText.allDatabase());
cy.get(commonSelectors.globalDataSourceIcon).click();
@ -52,36 +54,174 @@ describe("Data sources", () => {
postgreSqlText.allCloudStorage
);
selectAndAddDataSource(
"databases",
postgreSqlText.postgreSQL,
data.dataSourceName
cy.apiCreateGDS(
`${Cypress.env("server_host")}/api/data-sources`,
`cypress-${data.dataSourceName}-postgresql`,
"postgresql",
[
{ key: "connection_type", value: "manual", encrypted: false },
{ key: "host", value: "localhost", encrypted: false },
{ key: "port", value: 5432, encrypted: false },
{ key: "ssl_enabled", value: true, encrypted: false },
{ key: "ssl_certificate", value: "none", encrypted: false },
{ key: "password", value: null, encrypted: true },
{ key: "ca_cert", value: null, encrypted: true },
{ key: "client_key", value: null, encrypted: true },
{ key: "client_cert", value: null, encrypted: true },
{ key: "root_cert", value: null, encrypted: true },
{ key: "connection_string", value: null, encrypted: true },
]
);
cy.reload();
cy.get(`[data-cy="cypress-${data.dataSourceName}-postgresql-button"]`)
.should("be.visible")
.click();
cy.get(dataSourceSelector.dsNameInputField).should(
"have.value",
`cypress-${data.dataSourceName}-postgresql`
);
cy.get(postgreSqlSelector.labelHost).verifyVisibleElement(
cy.get(
dataSourceSelector.dropdownLabel(postgreSqlText.labelConnectionType)
).verifyVisibleElement("have.text", postgreSqlText.labelConnectionType);
cy.get(dataSourceSelector.dropdownField(postgreSqlText.labelConnectionType))
.should("be.visible")
.click();
cy.contains(
`[id*="react-select-"]`,
postgreSqlText.connectionStringOption
).click();
cy.get(
dataSourceSelector.dropdownField(postgreSqlText.labelConnectionType)
).should("be.visible");
cy.get(
dataSourceSelector.labelFieldName(postgreSqlText.connectionStringOption)
).verifyVisibleElement(
"have.text",
postgreSqlText.labelHost
`${postgreSqlText.connectionStringOption}*`
);
cy.get(postgreSqlSelector.labelPort).verifyVisibleElement(
cy.get(postgreSqlSelector.labelEncryptedText).verifyVisibleElement(
"have.text",
postgreSqlText.labelPort
postgreSqlText.labelEncrypted
);
cy.get(dataSourceSelector.button(postgreSqlText.editButtonText)).should(
"be.visible"
);
cy.get(dataSourceSelector.button(postgreSqlText.editButtonText)).click();
cy.verifyRequiredFieldValidation(
postgreSqlText.connectionStringOption,
"rgb(226, 99, 103)"
);
cy.get(
dataSourceSelector.textField(postgreSqlText.connectionStringOption)
).should("be.visible");
cy.get(postgreSqlSelector.labelIpWhitelist).verifyVisibleElement(
"have.text",
postgreSqlText.whiteListIpText
);
cy.get(postgreSqlSelector.buttonCopyIp).verifyVisibleElement(
"have.text",
postgreSqlText.textCopy
);
cy.get(postgreSqlSelector.linkReadDocumentation).verifyVisibleElement(
"have.text",
postgreSqlText.readDocumentation
);
cy.get(postgreSqlSelector.buttonTestConnection)
.verifyVisibleElement(
"have.text",
postgreSqlText.buttonTextTestConnection
)
.click();
cy.get(postgreSqlSelector.connectionFailedText).verifyVisibleElement(
"have.text",
postgreSqlText.couldNotConnect
);
cy.get(postgreSqlSelector.buttonSave)
.verifyVisibleElement("have.text", postgreSqlText.buttonTextSave)
.and("be.disabled");
cy.get(dataSourceSelector.connectionAlertText).verifyVisibleElement(
"have.text",
postgreSqlText.unableAcquireConnectionAlertText
);
cy.get(dataSourceSelector.dropdownField(postgreSqlText.labelConnectionType))
.should("be.visible")
.click();
cy.contains(
`[id*="react-select-"]`,
postgreSqlText.manualConnectionOption
).click();
cy.get(
dataSourceSelector.dropdownField(postgreSqlText.labelConnectionType)
).should("be.visible");
const requiredFields = [
postgreSqlText.labelHost,
postgreSqlText.labelPort,
postgreSqlText.labelUserName,
postgreSqlText.labelPassword,
];
const sections = [
postgreSqlText.labelHost,
postgreSqlText.labelPort,
postgreSqlText.labelDbName,
postgreSqlText.labelUserName,
postgreSqlText.labelPassword,
postgreSqlText.labelConnectionOptions,
];
sections.forEach((section) => {
if (section === postgreSqlText.labelConnectionOptions) {
cy.get(dataSourceSelector.keyInputField(section, 0)).should(
"be.visible"
);
cy.get(dataSourceSelector.valueInputField(section, 0)).should(
"be.visible"
);
cy.get(dataSourceSelector.deleteButton(section, 0)).should(
"be.visible"
);
cy.get(dataSourceSelector.addMoreButton(section)).should("be.visible");
} else if (requiredFields.includes(section)) {
cy.get(dataSourceSelector.labelFieldName(section)).verifyVisibleElement(
"have.text",
`${section}*`
);
cy.get(dataSourceSelector.textField(section)).should("be.visible");
if (section === postgreSqlText.labelPassword) {
cy.get(
dataSourceSelector.button(postgreSqlText.editButtonText)
).click();
cy.verifyRequiredFieldValidation(section, "rgb(215, 45, 57)");
} else {
cy.get(dataSourceSelector.textField(section)).click();
cy.get(commonSelectors.textField(section)).should(
"have.css",
"border-color",
"rgba(0, 0, 0, 0)"
);
cy.get(dataSourceSelector.textField(section))
.type("123")
.clear()
.blur();
cy.verifyRequiredFieldValidation(section, "rgb(215, 45, 57)");
}
} else {
cy.get(dataSourceSelector.labelFieldName(section)).verifyVisibleElement(
"have.text",
section
);
cy.get(dataSourceSelector.textField(section)).should("be.visible");
}
});
cy.get(postgreSqlSelector.labelSsl).verifyVisibleElement(
"have.text",
postgreSqlText.labelSSL
);
cy.get(postgreSqlSelector.labelDbName).verifyVisibleElement(
"have.text",
postgreSqlText.labelDbName
);
cy.get(postgreSqlSelector.labelUserName).verifyVisibleElement(
"have.text",
postgreSqlText.labelUserName
);
cy.get(postgreSqlSelector.labelPassword).verifyVisibleElement(
"have.text",
postgreSqlText.labelPassword
);
cy.get(postgreSqlSelector.sslToggleInput).should("be.visible");
cy.get(postgreSqlSelector.labelSSLCertificate).verifyVisibleElement(
"have.text",
postgreSqlText.sslCertificate
@ -109,72 +249,85 @@ describe("Data sources", () => {
"have.text",
postgreSqlText.couldNotConnect
);
cy.get(postgreSqlSelector.buttonSave).verifyVisibleElement(
cy.get(postgreSqlSelector.buttonSave)
.verifyVisibleElement("have.text", postgreSqlText.buttonTextSave)
.and("be.disabled");
cy.get(dataSourceSelector.connectionAlertText).verifyVisibleElement(
"have.text",
postgreSqlText.buttonTextSave
postgreSqlText.serverNotSuppotSsl
);
cy.get('[data-cy="connection-alert-text"]').should("be.visible");
deleteDatasource(`cypress-${data.dataSourceName}-postgresql`);
cy.apiDeleteGDS(`cypress-${data.dataSourceName}-postgresql`);
});
it("Should verify the functionality of PostgreSQL connection form.", () => {
selectAndAddDataSource(
"databases",
postgreSqlText.postgreSQL,
data.dataSourceName
cy.get(commonSelectors.globalDataSourceIcon).click();
cy.apiCreateGDS(
`${Cypress.env("server_host")}/api/data-sources`,
`cypress-${data.dataSourceName}-manual-pgsql`,
"postgresql",
[
{ key: "connection_type", value: "manual", encrypted: false },
{ key: "host", value: `${Cypress.env("pg_host")}`, encrypted: false },
{ key: "port", value: 5432, encrypted: false },
{ key: "ssl_enabled", value: false, encrypted: false },
{ key: "database", value: "postgres", encrypted: false },
{ key: "ssl_certificate", value: "none", encrypted: false },
{
key: "username",
value: `${Cypress.env("pg_user")}`,
encrypted: false,
},
{
key: "password",
value: `${Cypress.env("pg_password")}`,
encrypted: true,
},
{ key: "ca_cert", value: null, encrypted: true },
{ key: "client_key", value: null, encrypted: true },
{ key: "client_cert", value: null, encrypted: true },
{ key: "root_cert", value: null, encrypted: true },
{ key: "connection_string", value: null, encrypted: true },
]
);
fillDataSourceTextField(
postgreSqlText.labelHost,
postgreSqlText.placeholderEnterHost,
Cypress.env("pg_host")
);
fillDataSourceTextField(
postgreSqlText.labelPort,
postgreSqlText.placeholderEnterPort,
"5432"
);
cy.get('[data-cy="-toggle-input"]').then(($el) => {
if ($el.is(":checked")) {
cy.get('[data-cy="-toggle-input"]').uncheck();
}
});
fillDataSourceTextField(
postgreSqlText.labelDbName,
postgreSqlText.placeholderNameOfDB,
"postgres"
);
fillDataSourceTextField(
postgreSqlText.labelUserName,
postgreSqlText.placeholderEnterUserName,
"postgres"
);
fillDataSourceTextField(
postgreSqlText.labelPassword,
"**************",
Cypress.env("pg_password")
);
cy.get(
dataSourceSelector.dataSourceNameButton(
`cypress-${data.dataSourceName}-manual-pgsql`
)
)
.should("be.visible")
.click();
cy.get(postgreSqlSelector.buttonTestConnection).click();
cy.get(postgreSqlSelector.textConnectionVerified, {
timeout: 10000,
}).should("have.text", postgreSqlText.labelConnectionVerified);
cy.get(postgreSqlSelector.buttonSave).click();
cy.verifyToastMessage(
commonSelectors.toastMessage,
postgreSqlText.toastDSSaved
cy.apiDeleteGDS(`cypress-${data.dataSourceName}-manual-pgsql`);
cy.reload();
cy.apiCreateGDS(
`${Cypress.env("server_host")}/api/data-sources`,
`cypress-${data.dataSourceName}-string-pgsql`,
"postgresql",
[
{ key: "connection_type", value: "string", encrypted: false },
{
key: "connection_string",
value: `${Cypress.env("pg_string")}`,
encrypted: true,
},
]
);
cy.get(commonSelectors.globalDataSourceIcon).click();
cy.get(
`[data-cy="cypress-${data.dataSourceName}-postgresql-button"]`
).verifyVisibleElement(
"have.text",
`cypress-${data.dataSourceName}-postgresql`
);
deleteDatasource(`cypress-${data.dataSourceName}-postgresql`);
dataSourceSelector.dataSourceNameButton(
`cypress-${data.dataSourceName}-string-pgsql`
)
)
.should("be.visible")
.click();
cy.get(postgreSqlSelector.buttonTestConnection).click();
cy.get(postgreSqlSelector.textConnectionVerified, {
timeout: 10000,
}).should("have.text", postgreSqlText.labelConnectionVerified);
cy.apiDeleteGDS(`cypress-${data.dataSourceName}-string-pgsql`);
});
it.skip("Should verify elements of the Query section.", () => {

View file

@ -3,7 +3,7 @@ import { postgreSqlSelector } from "Selectors/postgreSql";
import { postgreSqlText } from "Texts/postgreSql";
import { redisText } from "Texts/redis";
import { commonSelectors } from "Selectors/common";
import { commonText } from "Texts/common";
import { dataSourceSelector } from "Selectors/dataSource";
import {
fillDataSourceTextField,
@ -11,26 +11,22 @@ import {
} from "Support/utils/postgreSql";
import {
verifyCouldnotConnectWithAlert,
deleteDatasource,
closeDSModal,
addQuery,
addDsAndAddQuery,
deleteAppandDatasourceAfterExecution,
} from "Support/utils/dataSource";
import { openQueryEditor } from "Support/utils/dataSource";
import { dataSourceSelector } from "../../../../../constants/selectors/dataSource";
const data = {};
data.dsName = fake.lastName.toLowerCase().replaceAll("[^A-Za-z]", "");
describe("Data source Redis", () => {
beforeEach(() => {
cy.appUILogin();
cy.intercept("POST", "/api/data_queries").as("createQuery");
cy.apiLogin();
cy.visit("/");
});
it("Should verify elements on connection Redison form", () => {
it("Should verify elements on connection Redis form", () => {
cy.get(commonSelectors.globalDataSourceIcon).click();
closeDSModal();
@ -100,7 +96,7 @@ describe("Data source Redis", () => {
"have.text",
postgreSqlText.buttonTextSave
);
cy.get('[data-cy="connection-alert-text"]').should(
cy.get(dataSourceSelector.connectionAlertText).should(
"have.text",
redisText.errorMaxRetries
);
@ -114,7 +110,7 @@ describe("Data source Redis", () => {
deleteDatasource(`cypress-${data.dsName}-redis`);
});
it("Should verify the functionality of Redis connection form.", () => {
it("Should verify the functionality of Redis connection form", () => {
selectAndAddDataSource("databases", redisText.redis, data.dsName);
fillDataSourceTextField(
@ -141,9 +137,9 @@ describe("Data source Redis", () => {
);
cy.get(postgreSqlSelector.buttonTestConnection).click();
cy.get('[data-cy="connection-alert-text"]').should(
cy.get(dataSourceSelector.connectionAlertText).should(
"have.text",
"WRONGPASS invalid username-password pair or user is disabled."
redisText.errorInvalidUserOrPassword
);
fillDataSourceTextField(
postgreSqlText.labelHost,
@ -156,7 +152,7 @@ describe("Data source Redis", () => {
"108299"
);
cy.get(postgreSqlSelector.buttonTestConnection).click();
cy.get('[data-cy="connection-alert-text"]').should(
cy.get(dataSourceSelector.connectionAlertText).should(
"have.text",
redisText.errorPort
);
@ -174,9 +170,9 @@ describe("Data source Redis", () => {
);
cy.get(postgreSqlSelector.buttonTestConnection).click();
cy.get('[data-cy="connection-alert-text"]').should(
cy.get(dataSourceSelector.connectionAlertText).should(
"have.text",
"WRONGPASS invalid username-password pair or user is disabled."
redisText.errorInvalidUserOrPassword
);
fillDataSourceTextField(
@ -191,9 +187,9 @@ describe("Data source Redis", () => {
"redis"
);
cy.get(postgreSqlSelector.buttonTestConnection).click();
cy.get('[data-cy="connection-alert-text"]').should(
cy.get(dataSourceSelector.connectionAlertText).should(
"have.text",
"WRONGPASS invalid username-password pair or user is disabled."
redisText.errorInvalidUserOrPassword
);
fillDataSourceTextField(
@ -219,7 +215,7 @@ describe("Data source Redis", () => {
deleteDatasource(`cypress-${data.dsName}-redis`);
});
it("Should able to run the query with valid conection", () => {
it.skip("Should able to run the query with valid conection", () => {
selectAndAddDataSource("databases", redisText.redis, data.dsName);
fillDataSourceTextField(
@ -256,5 +252,9 @@ describe("Data source Redis", () => {
cy.skipWalkthrough();
addDsAndAddQuery("redis", `TIME`, `cypress-${data.dsName}-redis`);
deleteAppandDatasourceAfterExecution(
data.dsName,
`cypress-${data.dsName}-redis`
);
});
});

View file

@ -0,0 +1,792 @@
import { fake } from "Fixtures/fake";
import { commonSelectors } from "Selectors/common";
import { closeDSModal, deleteDatasource } from "Support/utils/dataSource";
import { postgreSqlSelector } from "Selectors/postgreSql";
import { postgreSqlText } from "Texts/postgreSql";
import { restAPISelector } from "Selectors/restAPI";
import { restAPIText } from "Texts/restAPI";
import { createAndRunRestAPIQuery } from "Support/utils/restAPI";
const data = {};
const authenticationDropdownSelector =
".dynamic-form-element > .css-nwhe5y-container > .react-select__control";
const grantTypeDropdown =
":nth-child(1) > :nth-child(2) > .react-select__control";
const addAccessTokenDropdown =
":nth-child(9) > .css-nwhe5y-container > .react-select__control";
const clientAuthenticationDropdown =
":nth-child(14) > .css-nwhe5y-container > .react-select__control";
describe("Data source Rest API", () => {
beforeEach(() => {
cy.apiLogin();
cy.visit("/");
data.dataSourceName = fake.lastName
.toLowerCase()
.replaceAll("[^A-Za-z]", "");
});
it("Should verify elements on Rest API connection form", () => {
cy.get(commonSelectors.globalDataSourceIcon).click();
closeDSModal();
cy.get(postgreSqlSelector.allDatasourceLabelAndCount).should(
"have.text",
postgreSqlText.allDataSources()
);
cy.get(postgreSqlSelector.commonlyUsedLabelAndCount).should(
"have.text",
postgreSqlText.commonlyUsed
);
cy.get(postgreSqlSelector.databaseLabelAndCount).should(
"have.text",
postgreSqlText.allDatabase()
);
cy.get(postgreSqlSelector.apiLabelAndCount).should(
"have.text",
postgreSqlText.allApis
);
cy.get(postgreSqlSelector.cloudStorageLabelAndCount).should(
"have.text",
postgreSqlText.allCloudStorage
);
cy.apiCreateGDS(
`${Cypress.env("server_host")}/api/data-sources`,
`cypress-${data.dataSourceName}-restapi`,
"restapi",
[
{ key: "url", value: "" },
{ key: "auth_type", value: "none" },
{ key: "grant_type", value: "authorization_code" },
{ key: "add_token_to", value: "header" },
{ key: "header_prefix", value: "Bearer " },
{ key: "access_token_url", value: "" },
{ key: "client_id", value: "" },
{ key: "client_secret", value: "", encrypted: true },
{ key: "audience", value: "" },
{ key: "scopes", value: "read, write" },
{ key: "username", value: "", encrypted: false },
{ key: "password", value: "", encrypted: true },
{ key: "bearer_token", value: "", encrypted: true },
{ key: "auth_url", value: "" },
{ key: "client_auth", value: "header" },
{ key: "headers", value: [["", ""]] },
{ key: "custom_query_params", value: [["", ""]], encrypted: false },
{ key: "custom_auth_params", value: [["", ""]] },
{
key: "access_token_custom_headers",
value: [["", ""]],
encrypted: false,
},
{ key: "multiple_auth_enabled", value: false, encrypted: false },
{ key: "ssl_certificate", value: "none", encrypted: false },
{ key: "retry_network_errors", value: true, encrypted: false },
]
);
cy.reload();
cy.get(`[data-cy="cypress-${data.dataSourceName}-restapi-button"]`)
.should("be.visible")
.click();
cy.get(restAPISelector.inputField("data-source-name")).should(
"have.value",
`cypress-${data.dataSourceName}-restapi`
);
cy.get(restAPISelector.subHeaderLabel(restAPIText.credentialsText)).should(
"have.text",
restAPIText.credentialsText
);
const sections = [
restAPIText.baseUrlLabel,
restAPIText.headersLabel,
restAPIText.urlParametesLabel,
restAPIText.bodyLabel,
restAPIText.cookiesLabel,
];
sections.forEach((section) => {
cy.get(restAPISelector.subHeaderLabel(section)).should(
"have.text",
section
);
if (section !== restAPIText.baseUrlLabel) {
cy.get(restAPISelector.keyInputField(section, 0)).should("be.visible");
cy.get(restAPISelector.valueInputField(section, 0)).should(
"be.visible"
);
cy.get(restAPISelector.deleteButton(section, 0)).should("be.visible");
cy.get(restAPISelector.addMoreButton(section)).should("be.visible");
} else {
cy.get('[data-cy="base-url-text-field"]').should("be.visible");
}
});
cy.get(
restAPISelector.subHeaderLabel(restAPIText.authenticationText)
).should("have.text", restAPIText.authenticationText);
cy.get(
restAPISelector.subHeaderLabel(restAPIText.authenticationTypeLabel)
).should("have.text", restAPIText.authenticationTypeLabel);
cy.get(authenticationDropdownSelector).click();
cy.contains(
`[id*="react-select-"]`,
restAPIText.basicAuth.basicText
).click();
cy.get(authenticationDropdownSelector).should(
"have.text",
restAPIText.basicAuth.basicText
);
cy.get(
restAPISelector.subHeaderLabel(restAPIText.basicAuth.usernameLabel)
).should("have.text", restAPIText.basicAuth.usernameLabel);
cy.get(
restAPISelector.inputField(restAPIText.basicAuth.usernameLabel)
).should("be.visible");
cy.get(
restAPISelector.subHeaderLabel(restAPIText.basicAuth.passwordLabel)
).should("have.text", restAPIText.basicAuth.passwordLabel);
cy.get(restAPISelector.button(restAPIText.editButtonText)).should(
"be.visible"
);
cy.get(
restAPISelector.inputField(restAPIText.basicAuth.passwordLabel)
).should("be.visible");
cy.get(authenticationDropdownSelector).click();
cy.contains(`[id*="react-select-"]`, restAPIText.bearerAuth.bearerText)
.should("be.visible")
.click();
cy.get(authenticationDropdownSelector).should(
"have.text",
restAPIText.bearerAuth.bearerText
);
cy.get(
restAPISelector.subHeaderLabel(restAPIText.bearerAuth.tokenLabel)
).should("have.text", restAPIText.bearerAuth.tokenLabel);
cy.get(
restAPISelector.inputField(restAPIText.bearerAuth.tokenLabel)
).should("be.visible");
cy.get(authenticationDropdownSelector).click();
cy.contains(`[id*="react-select-"]`, restAPIText.oAuthText).click();
cy.get(authenticationDropdownSelector).should(
"have.text",
restAPIText.oAuthText
);
cy.get(restAPISelector.subHeaderLabel(restAPIText.grantTypeLabel)).should(
"have.text",
restAPIText.grantTypeLabel
);
cy.get(grantTypeDropdown).click();
cy.contains(
`[id*="react-select-"]`,
restAPIText.authorizationCode.authorizationCodeLabel
)
.should("be.visible")
.click();
cy.get(grantTypeDropdown).should(
"contain",
restAPIText.authorizationCode.authorizationCodeLabel
);
cy.get(
restAPISelector.inputField(
restAPIText.authorizationCode.headerPrefixLabel
)
).should(($input) => {
expect($input.val().trim()).to.equal(restAPIText.bearerAuth.bearerText);
});
cy.get(
restAPISelector.inputField(
restAPIText.authorizationCode.accessTokenURLLabel
)
)
.invoke("attr", "placeholder")
.should("eq", "https://api.example.com/oauth/token");
cy.get(
restAPISelector.inputField(restAPIText.authorizationCode.clientIDLabel)
).should("be.visible");
cy.get(restAPISelector.button(restAPIText.editButtonText)).should(
"be.visible"
);
cy.get(
restAPISelector.inputField(
restAPIText.authorizationCode.clientSecretLabel
)
).should("be.visible");
Object.entries(restAPIText.authorizationCode).forEach(([key, value]) => {
if (
key !== "authorizationCodeLabel" &&
key !== "requestHeader" &&
key !== "sendBasicAuthheaderOption" &&
key !== "sendClientCredentialsBodyOption"
) {
cy.get(
restAPISelector.subHeaderLabel(restAPIText.authorizationCode[key])
).should("have.text", value);
}
});
cy.get(addAccessTokenDropdown)
.should("be.visible")
.and("contain", restAPIText.authorizationCode.requestHeader);
cy.get(
restAPISelector.inputField(restAPIText.authorizationCode.scopeLabel)
).should("be.visible");
const authorizationCodeSections = [
restAPIText.authorizationCode.accessTokenURLCustomHeadersLabel,
restAPIText.authorizationCode.customQueryParametersLabel,
restAPIText.authorizationCode.customAuthenticationParametersLabel,
];
authorizationCodeSections.forEach((authorizationCodeSections) => {
cy.get(
restAPISelector.subHeaderLabel(authorizationCodeSections)
).verifyVisibleElement("have.text", authorizationCodeSections);
if (authorizationCodeSections !== restAPIText.baseUrlLabel) {
cy.get(
restAPISelector.keyInputField(authorizationCodeSections, 0)
).should("be.visible");
cy.get(
restAPISelector.valueInputField(authorizationCodeSections, 0)
).should("be.visible");
cy.get(
restAPISelector.deleteButton(authorizationCodeSections, 0)
).should("be.visible");
cy.get(restAPISelector.addMoreButton(authorizationCodeSections)).should(
"be.visible"
);
} else {
cy.get('[data-cy="base-url-text-field"]').should("be.visible");
}
});
cy.get(clientAuthenticationDropdown).click();
cy.contains(
`[id*="react-select-"]`,
restAPIText.authorizationCode.sendClientCredentialsBodyOption
).should("be.visible");
cy.contains(
`[id*="react-select-"]`,
restAPIText.authorizationCode.sendBasicAuthheaderOption
)
.should("be.visible")
.click();
cy.get(clientAuthenticationDropdown).should(
"have.text",
restAPIText.authorizationCode.sendBasicAuthheaderOption
);
cy.get(
restAPISelector.subHeaderLabel(
restAPIText.authorizationCode.authenticationRequiredUsersToggle
)
).verifyVisibleElement(
"have.text",
restAPIText.authorizationCode.authenticationRequiredUsersToggle
);
cy.get(restAPISelector.authenticationAllUsersToggleSwitch).should(
"be.visible"
);
cy.get(grantTypeDropdown).click();
cy.contains(
`[id*="react-select-"]`,
restAPIText.clientCredentials.clientCredentialsLabel
)
.should("be.visible")
.click();
cy.get(grantTypeDropdown).should(
"contain",
restAPIText.clientCredentials.clientCredentialsLabel
);
Object.entries(restAPIText.clientCredentials).forEach(([key, value]) => {
if (key !== "clientCredentialsLabel") {
cy.get(
restAPISelector.subHeaderLabel(restAPIText.clientCredentials[key])
).should("have.text", value);
}
});
cy.get(
restAPISelector.subHeaderLabel(restAPIText.secureSocketsLayerText)
).should("have.text", restAPIText.secureSocketsLayerText);
cy.get(restAPISelector.dropdownLabel("SSL Certificate")).should(
"have.text",
"SSL Certificate"
);
cy.get(
restAPISelector.subHeaderLabel(restAPIText.generalSettingsText)
).should("have.text", restAPIText.generalSettingsText);
cy.get(restAPISelector.retryNetworkToggleSwitch).should("be.visible");
cy.get(restAPISelector.retryNetworkToggleText).should(
"have.text",
restAPIText.retryNetworkErrorsToggleLabel
);
cy.get(restAPISelector.retryNetworkToggleSubtext).should(
"have.text",
restAPIText.retryToggleHelperText
);
cy.get(restAPISelector.readDocumentationLinkText).should(
"have.text",
postgreSqlText.readDocumentation
);
cy.contains("Save").click();
cy.verifyToastMessage(commonSelectors.toastMessage, "Data Source Saved");
cy.apiDeleteGDS(`cypress-${data.dataSourceName}-restapi`);
});
it("Should verify connection response for all methods", () => {
cy.apiCreateGDS(
`${Cypress.env("server_host")}/api/data-sources`,
`cypress-${data.dataSourceName}-restapi`,
"restapi",
[
{ key: "url", value: "https://jsonplaceholder.typicode.com" },
{ key: "auth_type", value: "none" },
{ key: "grant_type", value: "authorization_code" },
{ key: "add_token_to", value: "header" },
{ key: "header_prefix", value: "Bearer " },
{ key: "access_token_url", value: "" },
{ key: "client_id", value: "" },
{ key: "client_secret", value: "", encrypted: true },
{ key: "audience", value: "" },
{ key: "scopes", value: "read, write" },
{ key: "username", value: "", encrypted: false },
{ key: "password", value: "", encrypted: true },
{ key: "bearer_token", value: "", encrypted: true },
{ key: "auth_url", value: "" },
{ key: "client_auth", value: "header" },
{ key: "headers", value: [["", ""]] },
{ key: "custom_query_params", value: [["", ""]], encrypted: false },
{ key: "custom_auth_params", value: [["", ""]] },
{
key: "access_token_custom_headers",
value: [["", ""]],
encrypted: false,
},
{ key: "multiple_auth_enabled", value: false, encrypted: false },
{ key: "ssl_certificate", value: "none", encrypted: false },
{ key: "retry_network_errors", value: true, encrypted: false },
]
);
cy.reload();
cy.apiCreateApp(`${fake.companyName}-restAPI-CURD-App`);
cy.openApp();
createAndRunRestAPIQuery({
queryName: "get_all_users",
dsName: `cypress-${data.dataSourceName}-restapi`,
method: "GET",
urlSuffix: "/users",
run: true,
expectedResponseShape: {
"0.id": true,
"0.name": true,
"0.email": true,
},
});
createAndRunRestAPIQuery({
queryName: "post_restapi",
dsName: `cypress-${data.dataSourceName}-restapi`,
method: "POST",
headersList: [["Content-Type", "application/json"]],
rawBody: `{
"name": "Test User",
"username": "testuser",
"email": "test@example.com",
"address": {
"street": "123 Test St",
"city": "Testville",
"zipcode": "12345"
}
}`,
urlSuffix: "/users",
run: true,
expectedResponseShape: {
id: true,
name: "Test User",
email: "test@example.com",
},
});
const id1 = 1;
createAndRunRestAPIQuery({
queryName: "put_restapi_id",
dsName: `cypress-${data.dataSourceName}-restapi`,
method: "PUT",
headersList: [["Content-Type", "application/json"]],
rawBody: `{
"id": 1,
"name": "Fully Updated User",
"username": "updateduser",
"email": "updated@example.com",
"address": {
"street": "456 Updated St",
"city": "Updatedville",
"zipcode": "54321"
}
}`,
urlSuffix: `/users/${id1}`,
run: true,
expectedResponseShape: {
id: id1,
name: "Fully Updated User",
email: "updated@example.com",
},
});
createAndRunRestAPIQuery({
queryName: "patch_restapi_id",
dsName: `cypress-${data.dataSourceName}-restapi`,
method: "PATCH",
headersList: [["Content-Type", "application/json"]],
rawBody: `{
"email": "partially.updated@example.com"
}`,
urlSuffix: `/users/${id1}`,
run: true,
expectedResponseShape: {
id: id1,
email: "partially.updated@example.com",
},
});
createAndRunRestAPIQuery({
queryName: "get_restapi_id",
dsName: `cypress-${data.dataSourceName}-restapi`,
method: "GET",
urlSuffix: `/users/${id1}`,
run: true,
expectedResponseShape: {
id: id1,
email: "Sincere@april.biz",
},
});
createAndRunRestAPIQuery({
queryName: "delete_restapi_id",
dsName: `cypress-${data.dataSourceName}-restapi`,
method: "DELETE",
urlSuffix: `/users/${id1}`,
run: true,
expectedResponseShape: {},
});
cy.apiDeleteApp(`${fake.companyName}-restAPI-CURD-App`);
cy.apiDeleteGDS(`cypress-${data.dataSourceName}-restapi`);
});
it("Should verify response for basic authentication type connection", () => {
cy.apiCreateGDS(
`${Cypress.env("server_host")}/api/data-sources`,
`cypress-${data.dataSourceName}-restapi`,
"restapi",
[
{ key: "url", value: "https://httpbin.org" },
{ key: "auth_type", value: "basic" },
{ key: "grant_type", value: "authorization_code" },
{ key: "add_token_to", value: "header" },
{ key: "header_prefix", value: "Bearer " },
{ key: "access_token_url", value: "" },
{ key: "client_id", value: "" },
{
key: "client_secret",
encrypted: true,
credential_id: "b044a293-82b4-4381-84fd-d173c86a6a0c",
},
{ key: "audience", value: "" },
{ key: "scopes", value: "read, write" },
{ key: "username", value: "user", encrypted: false },
{ key: "password", value: "pass", encrypted: true },
{
key: "bearer_token",
encrypted: true,
credential_id: "21caf3cb-dbde-43c7-9f42-77feffb63062",
},
{ key: "auth_url", value: "" },
{ key: "client_auth", value: "header" },
{ key: "headers", value: [["", ""]] },
{ key: "custom_query_params", value: [["", ""]], encrypted: false },
{ key: "custom_auth_params", value: [["", ""]] },
{
key: "access_token_custom_headers",
value: [["", ""]],
encrypted: false,
},
{ key: "multiple_auth_enabled", value: false, encrypted: false },
{ key: "ssl_certificate", value: "none", encrypted: false },
{ key: "retry_network_errors", value: true, encrypted: false },
{ key: "url_parameters", value: [["", ""]], encrypted: false },
{ key: "tokenData", encrypted: false },
]
);
cy.reload();
cy.intercept("GET", "/api/library_apps").as("appLibrary");
cy.apiCreateApp(`${fake.companyName}-restAPI-Basic-App`);
createAndRunRestAPIQuery({
queryName: "get_basic_auth_valid",
dsName: `cypress-${data.dataSourceName}-restapi`,
method: "GET",
urlSuffix: "/basic-auth/user/pass",
expectedResponseShape: { authenticated: true, user: "user" },
});
createAndRunRestAPIQuery({
queryName: "get_basic_auth_invalid",
dsName: `cypress-${data.dataSourceName}-restapi`,
method: "GET",
urlSuffix: "/basic-auth/invaliduser/invalidpass",
});
cy.apiDeleteApp(`${fake.companyName}-restAPI-Basic-App`);
cy.apiDeleteGDS(`cypress-${data.dataSourceName}-restapi`);
});
it("Should verify response for bearer authentication type connection", () => {
cy.apiCreateGDS(
`${Cypress.env("server_host")}/api/data-sources`,
`cypress-${data.dataSourceName}-restapi`,
"restapi",
[
{ key: "url", value: "https://httpbin.org" },
{ key: "auth_type", value: "bearer" },
{ key: "grant_type", value: "authorization_code" },
{ key: "add_token_to", value: "header" },
{ key: "header_prefix", value: "Bearer " },
{ key: "access_token_url", value: "" },
{ key: "client_id", value: "" },
{
key: "client_secret",
encrypted: true,
credential_id: "b044a293-82b4-4381-84fd-d173c86a6a0c",
},
{ key: "audience", value: "" },
{ key: "scopes", value: "read, write" },
{ key: "username", value: "", encrypted: false },
{ key: "password", value: "", encrypted: true },
{
key: "bearer_token",
value: "my-token-123",
encrypted: true,
},
{ key: "auth_url", value: "" },
{ key: "client_auth", value: "header" },
{ key: "headers", value: [["", ""]] },
{ key: "custom_query_params", value: [["", ""]], encrypted: false },
{ key: "custom_auth_params", value: [["", ""]] },
{
key: "access_token_custom_headers",
value: [["", ""]],
encrypted: false,
},
{ key: "multiple_auth_enabled", value: false, encrypted: false },
{ key: "ssl_certificate", value: "none", encrypted: false },
{ key: "retry_network_errors", value: true, encrypted: false },
{ key: "url_parameters", value: [["", ""]], encrypted: false },
{ key: "tokenData", encrypted: false },
]
);
cy.reload();
cy.intercept("GET", "/api/library_apps").as("appLibrary");
cy.apiCreateApp(`${fake.companyName}-restAPI-Bearer-App`);
cy.openApp();
createAndRunRestAPIQuery({
queryName: "get_bearer_auth_valid",
dsName: `cypress-${data.dataSourceName}-restapi`,
method: "GET",
urlSuffix: "/bearer",
expectedResponseShape: { authenticated: true, token: "my-token-123" },
});
cy.apiDeleteApp(`${fake.companyName}-restAPI-Bearer-App`);
cy.intercept("GET", "api/data_sources?**").as("datasource");
cy.apiCreateGDS(
`${Cypress.env("server_host")}/api/data-sources`,
`cypress-${data.dataSourceName}-restapi-invalid`,
"restapi",
[
{ key: "url", value: "https://httpbin.org" },
{ key: "auth_type", value: "bearer" },
{ key: "grant_type", value: "authorization_code" },
{ key: "add_token_to", value: "header" },
{ key: "header_prefix", value: "Bearer " },
{ key: "access_token_url", value: "" },
{ key: "client_id", value: "" },
{
key: "client_secret",
encrypted: true,
credential_id: "b044a293-82b4-4381-84fd-d173c86a6a0c",
},
{ key: "audience", value: "" },
{ key: "scopes", value: "read, write" },
{ key: "username", value: "", encrypted: false },
{ key: "password", value: "", encrypted: true },
{
key: "bearer_token",
value: "",
encrypted: true,
},
{ key: "auth_url", value: "" },
{ key: "client_auth", value: "header" },
{ key: "headers", value: [["", ""]] },
{ key: "custom_query_params", value: [["", ""]], encrypted: false },
{ key: "custom_auth_params", value: [["", ""]] },
{
key: "access_token_custom_headers",
value: [["", ""]],
encrypted: false,
},
{ key: "multiple_auth_enabled", value: false, encrypted: false },
{ key: "ssl_certificate", value: "none", encrypted: false },
{ key: "retry_network_errors", value: true, encrypted: false },
{ key: "url_parameters", value: [["", ""]], encrypted: false },
{ key: "tokenData", encrypted: false },
]
);
cy.apiCreateApp(`${fake.companyName}-restAPI-Bearer-invalid`);
cy.openApp();
createAndRunRestAPIQuery({
queryName: "get_bearer_auth_invalid",
dsName: `cypress-${data.dataSourceName}-restapi-invalid`,
method: "GET",
urlSuffix: "/bearer",
});
cy.apiDeleteApp(`${fake.companyName}-restAPI-Bearer-invalid`);
cy.apiDeleteGDS(`cypress-${data.dataSourceName}-restapi`);
});
it.skip("Should verify response for authentication code grant type connection", () => {
cy.apiCreateGDS(
`${Cypress.env("server_host")}/api/data-sources`,
`cypress-${data.dataSourceName}-restapi`,
"restapi",
[
{
key: "url",
value: "https://dev-6lj2hoxdz5fg3m57.uk.auth0.com/api/v2/users",
},
{ key: "auth_type", value: "oauth2" },
{ key: "grant_type", value: "client_credentials" },
{ key: "add_token_to", value: "header" },
{ key: "header_prefix", value: "Bearer " },
{
key: "access_token_url",
value: "https://dev-6lj2hoxdz5fg3m57.uk.auth0.com/oauth/token",
},
{ key: "client_id", value: "JBDuuLU9vaSTP6Do7zYSkw0GvVgWhfyZ" },
{
key: "client_secret",
encrypted: true,
credential_id: "a6d26607-4d09-42a2-8bc0-e5c185c7c2f7",
},
{
key: "audience",
value: "https://dev-6lj2hoxdz5fg3m57.uk.auth0.com/api/v2/",
},
{ key: "scopes", value: "" },
{ key: "username", value: "", encrypted: false },
{
key: "password",
encrypted: true,
credential_id: "4502a906-b512-447a-a128-39f67e9778d2",
},
{
key: "bearer_token",
encrypted: true,
credential_id: "c94262c7-d2c5-4d7f-96f8-657689f2b1f0",
},
{ key: "auth_url", value: "" },
{ key: "client_auth", value: "header" },
{ key: "headers", value: [["", ""]] },
{ key: "custom_query_params", value: [["", ""]], encrypted: false },
{ key: "custom_auth_params", value: [["", ""]] },
{
key: "access_token_custom_headers",
value: [["", ""]],
encrypted: false,
},
{ key: "multiple_auth_enabled", value: false, encrypted: false },
{ key: "ssl_certificate", value: "none", encrypted: false },
{ key: "retry_network_errors", value: true, encrypted: false },
]
);
cy.reload();
cy.intercept("GET", "/api/library_apps").as("appLibrary");
cy.apiCreateApp(`${fake.companyName}-client-Grant-RestAPI`);
});
it("Should verify response for content-type", () => {
cy.apiCreateApp(`${fake.companyName}-restAPI-Content-App`);
createAndRunRestAPIQuery({
queryName: "post_json",
dsName: "restapidefault",
method: "POST",
url: "https://jsonplaceholder.typicode.com/posts",
headersList: [["Content-Type", "application/json"]],
rawBody: '{"title": "foo","body": "bar","userId": 1}',
run: true,
urlSuffix: "",
expectedResponseShape: { id: true, title: "foo", body: "bar", userId: 1 },
});
createAndRunRestAPIQuery({
queryName: "post_raw_text",
dsName: "restapidefault",
method: "POST",
url: "https://httpbin.org/post",
headersList: [["Content-Type", "text/plain"]],
rawBody: "This is plain text content",
jsonBody: null,
run: true,
expectedResponseShape: { data: "This is plain text content" },
});
createAndRunRestAPIQuery({
queryName: "post_form_urlencoded",
dsName: "restapidefault",
method: "POST",
url: "https://httpbin.org/post",
headersList: [["Content-Type", "application/x-www-form-urlencoded"]],
bodyList: [
["name", "Jane"],
["age", "30"],
],
expectedResponseShape: {
"form.name": "Jane",
"form.age": "30",
},
});
createAndRunRestAPIQuery({
queryName: "post_xml_soap",
dsName: "restapidefault",
method: "POST",
url: "http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL",
headersList: [["Content-Type", "text/xml; charset=utf-8"]],
rawBody: `<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ListOfContinentsByName xmlns="http://www.oorsprong.org/websamples.countryinfo">
</ListOfContinentsByName>
</soap:Body>
</soap:Envelope>`,
jsonBody: null,
bodyList: [],
cookiesList: [["session", "abc123"]],
paramsList: [["lang", "en"]],
run: true,
shouldSucceed: true,
expectedResponseShape: {},
});
// createAndRunRestAPIQuery({
// queryName: "post_text_csv",
// dsName: "restapidefault",
// method: "POST",
// url: `https://tejasvi.free.beeceptor.com/csv-upload`,
// headersList: [["Content-Type", "text/csv"]],
// rawBody:
// "id,name,email\n1,Alice,alice@example.com\n2,Bob,bob@example.com",
// expectedResponseShape: {
// data: '{\n "status": "ok",\n "message": "File uploaded successfully",\n "body": id,name,email\n1,Alice,alice@example.com\n2,Bob,bob@example.com\n}',
// },
// });
// const filename = "tooljet.png";
// createAndRunRestAPIQuery({
// queryName: "upload_image",
// dsName: "restapidefault",
// method: "POST",
// url: `https://tejasvi.free.beeceptor.commultipart-upload`,
// headersList: [["Content-Type", "multipart/form-data"]],
// bodyList: [
// ["Image_File", "fixture:Image/tooljet.png"],
// ["filename", filename],
// ],
// expectedResponseShape: {
// filename: filename,
// },
// });
});
});

View file

@ -3,6 +3,7 @@ import { postgreSqlSelector } from "Selectors/postgreSql";
import { postgreSqlText } from "Texts/postgreSql";
import { commonWidgetText, commonText } from "Texts/common";
import { commonSelectors, commonWidgetSelector } from "Selectors/common";
import { dataSourceSelector } from "Selectors/dataSource";
import {
addQuery,
fillDataSourceTextField,
@ -18,7 +19,8 @@ const data = {};
describe("Data sources", () => {
beforeEach(() => {
cy.appUILogin();
cy.apiLogin();
cy.visit("/");
data.dataSourceName = fake.lastName
.toLowerCase()
.replaceAll("[^A-Za-z]", "");
@ -49,7 +51,26 @@ describe("Data sources", () => {
postgreSqlText.allCloudStorage
);
selectAndAddDataSource("databases", "RethinkDB", data.dataSourceName);
cy.apiCreateGDS(
`${Cypress.env("server_host")}/api/data-sources`,
`cypress-${data.dataSourceName}-rethinkdb`,
"rethinkdb",
[
{ key: "port", value: "28015", encrypted: false },
{ key: "host", value: "", encrypted: false },
{ key: "database", value: "", encrypted: false },
{ key: "username", value: "", encrypted: false },
{ key: "password", value: "", encrypted: true },
]
);
cy.reload();
cy.get(`[data-cy="cypress-${data.dataSourceName}-rethinkdb-button"]`)
.should("be.visible")
.click();
cy.get(dataSourceSelector.dsNameInputField).should(
"have.value",
`cypress-${data.dataSourceName}-rethinkdb`
);
cy.get('[data-cy="label-database"]').verifyVisibleElement(
"have.text",

View file

@ -4,7 +4,7 @@ import { s3Selector } from "Selectors/awss3";
import { postgreSqlText } from "Texts/postgreSql";
import { s3Text } from "Texts/awss3";
import { commonSelectors } from "Selectors/common";
import { commonText } from "Texts/common";
import { dataSourceSelector } from "Selectors/dataSource";
import {
fillDataSourceTextField,
selectAndAddDataSource,
@ -19,7 +19,8 @@ const data = {};
describe("Data sources AWS S3", () => {
beforeEach(() => {
cy.appUILogin();
cy.apiLogin();
cy.visit("/");
data.dataSourceName = fake.lastName
.toLowerCase()
.replaceAll("[^A-Za-z]", "");
@ -50,7 +51,31 @@ describe("Data sources AWS S3", () => {
postgreSqlText.allCloudStorage
);
selectAndAddDataSource("cloudstorage", s3Text.awsS3, data.dataSourceName);
cy.apiCreateGDS(
`${Cypress.env("server_host")}/api/data-sources`,
`cypress-${data.dataSourceName}-aws-s3`,
"s3",
[
{ key: "access_key", value: "" },
{ key: "secret_key", value: "", encrypted: true },
{ key: "region", value: "" },
{ key: "endpoint", value: "" },
{ key: "endpoint_enabled", value: false, encrypted: false },
{
key: "instance_metadata_credentials",
value: "iam_access_keys",
encrypted: false,
},
]
);
cy.reload();
cy.get(`[data-cy="cypress-${data.dataSourceName}-aws-s3-button"]`)
.should("be.visible")
.click();
cy.get(dataSourceSelector.dsNameInputField).should(
"have.value",
`cypress-${data.dataSourceName}-aws-s3`
);
cy.get(s3Selector.accessKeyLabel).verifyVisibleElement(
"have.text",
s3Text.accessKey
@ -95,7 +120,7 @@ describe("Data sources AWS S3", () => {
"have.text",
postgreSqlText.buttonTextSave
);
cy.get('[data-cy="connection-alert-text"]').should(
cy.get(dataSourceSelector.connectionAlertText).should(
"have.text",
s3Text.alertRegionIsMissing
);
@ -119,7 +144,7 @@ describe("Data sources AWS S3", () => {
);
cy.get(postgreSqlSelector.buttonTestConnection).click();
cy.get('[data-cy="connection-alert-text"]').should(
cy.get(dataSourceSelector.connectionAlertText).should(
"have.text",
s3Text.alertRegionIsMissing
);
@ -145,7 +170,7 @@ describe("Data sources AWS S3", () => {
.click();
cy.get(postgreSqlSelector.buttonTestConnection).click();
cy.get('[data-cy="connection-alert-text"]').should(
cy.get(dataSourceSelector.connectionAlertText).should(
"have.text",
s3Text.alertInvalidUrl
);
@ -163,7 +188,7 @@ describe("Data sources AWS S3", () => {
);
cy.get(postgreSqlSelector.buttonTestConnection).click();
cy.get('[data-cy="connection-alert-text"]').should(
cy.get(dataSourceSelector.connectionAlertText).should(
"have.text",
s3Text.accessKeyError
);
@ -182,7 +207,7 @@ describe("Data sources AWS S3", () => {
cy.get(postgreSqlSelector.buttonTestConnection).click();
cy.get('[data-cy="connection-alert-text"]').should(
cy.get(dataSourceSelector.connectionAlertText).should(
"have.text",
s3Text.sinatureError
);

View file

@ -15,7 +15,7 @@ import {
describe("Data sources", () => {
beforeEach(() => {
cy.appUILogin();
cy.apiLogin();
// cy.createApp();
});
@ -108,7 +108,7 @@ describe("Data sources", () => {
selectAndAddDataSource(postgreSqlText.postgreSQL);
cy.clearAndType(
'[data-cy="data-source-name-input-filed"]',
'[data-cy="data-source-name-input-field"]',
postgreSqlText.psqlName
);

View file

@ -2,7 +2,7 @@ import { fake } from "Fixtures/fake";
import { postgreSqlSelector } from "Selectors/postgreSql";
import { postgreSqlText } from "Texts/postgreSql";
import { commonSelectors } from "Selectors/common";
import { commonText } from "Texts/common";
import { dataSourceSelector } from "Selectors/dataSource";
import {
fillDataSourceTextField,
selectAndAddDataSource,
@ -13,7 +13,8 @@ const data = {};
describe("Data source SMTP", () => {
beforeEach(() => {
cy.appUILogin();
cy.apiLogin();
cy.visit("/");
data.dataSourceName = fake.lastName
.toLowerCase()
.replaceAll("[^A-Za-z]", "");
@ -43,7 +44,25 @@ describe("Data source SMTP", () => {
postgreSqlText.allCloudStorage
);
selectAndAddDataSource("apis", "SMTP", data.dataSourceName);
cy.apiCreateGDS(
`${Cypress.env("server_host")}/api/data-sources`,
`cypress-${data.dataSourceName}-smtp`,
"smtp",
[
{ key: "host", value: "localhost", encrypted: false },
{ key: "port", value: 465, encrypted: false },
{ key: "user", value: "", encrypted: false },
{ key: "password", value: "", encrypted: true },
]
);
cy.reload();
cy.get(`[data-cy="cypress-${data.dataSourceName}-smtp-button"]`)
.should("be.visible")
.click();
cy.get(dataSourceSelector.dsNameInputField).should(
"have.value",
`cypress-${data.dataSourceName}-smtp`
);
cy.get(postgreSqlSelector.labelHost).verifyVisibleElement(
"have.text",
@ -86,7 +105,7 @@ describe("Data source SMTP", () => {
"have.text",
postgreSqlText.buttonTextSave
);
cy.get('[data-cy="connection-alert-text"]').should(
cy.get(dataSourceSelector.connectionAlertText).should(
"have.text",
"Invalid credentials"
);

Some files were not shown because too many files have changed in this diff Show more