mirror of
https://github.com/ToolJet/ToolJet
synced 2026-04-21 13:37:28 +00:00
Merge pull request #7311 from ToolJet/test/add-automation-for-azure-blob-storage
Added automation for azure blob storage
This commit is contained in:
commit
c24a87d43a
3 changed files with 241 additions and 76 deletions
|
|
@ -1,88 +1,89 @@
|
|||
export const dataSourceSelector = {
|
||||
leftSidebarDatasourceButton: "[data-cy='left-sidebar-database-button']",
|
||||
labelDataSources: "[data-cy='label-datasources']",
|
||||
addDatasourceLink: "[data-cy='add-datasource-link']",
|
||||
leftSidebarDatasourceButton: "[data-cy='left-sidebar-database-button']",
|
||||
labelDataSources: "[data-cy='label-datasources']",
|
||||
addDatasourceLink: "[data-cy='add-datasource-link']",
|
||||
|
||||
allDatasourceLabelAndCount: '[data-rr-ui-event-key="#alldatasources"]',
|
||||
databaseLabelAndCount: '[data-rr-ui-event-key="#databases"]',
|
||||
apiLabelAndCount: '[data-rr-ui-event-key="#apis"]',
|
||||
cloudStorageLabelAndCount: '[data-rr-ui-event-key="#cloudstorage"]',
|
||||
dataSourceSearchInputField: '[data-cy="datasource-search-input"]',
|
||||
allDatasourceLabelAndCount: '[data-rr-ui-event-key="#alldatasources"]',
|
||||
databaseLabelAndCount: '[data-rr-ui-event-key="#databases"]',
|
||||
apiLabelAndCount: '[data-rr-ui-event-key="#apis"]',
|
||||
cloudStorageLabelAndCount: '[data-rr-ui-event-key="#cloudstorage"]',
|
||||
dataSourceSearchInputField: '[data-cy="datasource-search-input"]',
|
||||
|
||||
postgresDataSource: "[data-cy='data-source-postgresql']",
|
||||
dataSourceNameInputField: '[data-cy="data-source-name-input-filed"]',
|
||||
labelHost: '[data-cy="label-host"]',
|
||||
labelPort: '[data-cy="label-port"]',
|
||||
labelSsl: '[data-cy="label-ssl"]',
|
||||
labelDbName: '[data-cy="label-database-name"]',
|
||||
labelUserName: '[data-cy="label-username"]',
|
||||
labelPassword: '[data-cy="label-password"]',
|
||||
labelSSLCertificate: '[data-cy="ssl-certificate-dropdown-label"]',
|
||||
labelIpWhitelist: '[data-cy="white-list-ip-text"]',
|
||||
buttonCopyIp: '[data-cy="button-copy-ip"]',
|
||||
linkReadDocumentation: '[data-cy="link-read-documentation"]',
|
||||
buttonTestConnection: '[data-cy="test-connection-button"]',
|
||||
connectionFailedText: '[data-cy="test-connection-failed-text"]',
|
||||
buttonSave: '[data-cy="db-connection-save-button"]',
|
||||
dangerAlertNotSupportSSL: '.go3958317564',
|
||||
postgresDataSource: "[data-cy='data-source-postgresql']",
|
||||
dataSourceNameInputField: '[data-cy="data-source-name-input-filed"]',
|
||||
labelHost: '[data-cy="label-host"]',
|
||||
labelPort: '[data-cy="label-port"]',
|
||||
labelSsl: '[data-cy="label-ssl"]',
|
||||
labelDbName: '[data-cy="label-database-name"]',
|
||||
labelUserName: '[data-cy="label-username"]',
|
||||
labelPassword: '[data-cy="label-password"]',
|
||||
labelSSLCertificate: '[data-cy="ssl-certificate-dropdown-label"]',
|
||||
labelIpWhitelist: '[data-cy="white-list-ip-text"]',
|
||||
buttonCopyIp: '[data-cy="button-copy-ip"]',
|
||||
linkReadDocumentation: '[data-cy="link-read-documentation"]',
|
||||
buttonTestConnection: '[data-cy="test-connection-button"]',
|
||||
connectionFailedText: '[data-cy="test-connection-failed-text"]',
|
||||
buttonSave: '[data-cy="db-connection-save-button"]',
|
||||
dangerAlertNotSupportSSL: ".go3958317564",
|
||||
|
||||
passwordTextField: '[data-cy="password-text-field"]',
|
||||
textConnectionVerified: '[data-cy="test-connection-verified-text"]',
|
||||
datasourceLabelOnList: '[data-cy="datasource-Label"]',
|
||||
passwordTextField: '[data-cy="password-text-field"]',
|
||||
textConnectionVerified: '[data-cy="test-connection-verified-text"]',
|
||||
datasourceLabelOnList: '[data-cy="datasource-Label"]',
|
||||
|
||||
buttonAddNewQueries: '[data-cy="button-add-new-queries"]',
|
||||
addQueriesCard: '[data-cy="postgresql-add-query-card"]',
|
||||
headerQueryManager: '[data-cy="header-queries-on-query-manager"]',
|
||||
labelNoQuery: '[data-cy="no-query-text"]',
|
||||
createQueryButton: '[data-cy="query-create-and-run-button"]',
|
||||
querySearchBar: '[data-cy="home-page-search-bar"]',
|
||||
labelSelectDataSource: '[data-cy="label-select-datasource"]',
|
||||
queryTabGeneral: '[data-cy="query-tab-general"]',
|
||||
queryLabelInputField: '[data-cy="query-rename-input"]',
|
||||
queryPreviewButton: '[data-cy="query-preview-button"]',
|
||||
queryCreateAndRunButton: '[data-cy="query-run-button"]',
|
||||
queryCreateDropdown: '[data-cy="query-create-dropdown"]',
|
||||
queryCreateAndRunOption: '[data-cy="query-create-and-run-option"]',
|
||||
queryCreateOption: '[data-cy="query-create-option"]',
|
||||
queryInputField: '[data-cy="query-input-field"]',
|
||||
labelTransformation: '[data-cy="label-query-transformation"]',
|
||||
toggleTransformation: '[data-cy="transformation-toggle-switch"]',
|
||||
inputFieldTransformation: '[data-cy="transformation-input-input-field"]',
|
||||
buttonAddNewQueries: '[data-cy="button-add-new-queries"]',
|
||||
addQueriesCard: '[data-cy="postgresql-add-query-card"]',
|
||||
headerQueryManager: '[data-cy="header-queries-on-query-manager"]',
|
||||
labelNoQuery: '[data-cy="no-query-text"]',
|
||||
createQueryButton: '[data-cy="query-create-and-run-button"]',
|
||||
querySearchBar: '[data-cy="home-page-search-bar"]',
|
||||
labelSelectDataSource: '[data-cy="label-select-datasource"]',
|
||||
queryTabGeneral: '[data-cy="query-tab-general"]',
|
||||
queryLabelInputField: '[data-cy="query-rename-input"]',
|
||||
queryPreviewButton: '[data-cy="query-preview-button"]',
|
||||
queryCreateAndRunButton: '[data-cy="query-run-button"]',
|
||||
queryCreateDropdown: '[data-cy="query-create-dropdown"]',
|
||||
queryCreateAndRunOption: '[data-cy="query-create-and-run-option"]',
|
||||
queryCreateOption: '[data-cy="query-create-option"]',
|
||||
queryInputField: '[data-cy="query-input-field"]',
|
||||
labelTransformation: '[data-cy="label-query-transformation"]',
|
||||
toggleTransformation: '[data-cy="transformation-toggle-switch"]',
|
||||
inputFieldTransformation: '[data-cy="transformation-input-input-field"]',
|
||||
|
||||
headerQueryPreview: '.py-2',
|
||||
previewTabJson: '[data-cy="preview-tab-json"]',
|
||||
previewTabRaw: '[data-cy="preview-tab-raw"]',
|
||||
headerQueryPreview: ".py-2",
|
||||
previewTabJson: '[data-cy="preview-tab-json"]',
|
||||
previewTabRaw: '[data-cy="preview-tab-raw"]',
|
||||
|
||||
operationsDropDownLabel: '[data-cy="operation-dropdown-label"]',
|
||||
labelTableNameInputField: '[data-cy="label-table"]',
|
||||
labelPrimaryKeyColoumn: '[data-cy="label-primary-key-column"]',
|
||||
labelRecordsToUpdate: '[data-cy="label-records-to-update"]',
|
||||
operationsDropDownLabel: '[data-cy="operation-dropdown-label"]',
|
||||
labelTableNameInputField: '[data-cy="label-table"]',
|
||||
labelPrimaryKeyColoumn: '[data-cy="label-primary-key-column"]',
|
||||
labelRecordsToUpdate: '[data-cy="label-records-to-update"]',
|
||||
|
||||
queryTabAdvanced: '[data-cy="query-tab-advanced"]',
|
||||
queryTabAdvanced: '[data-cy="query-tab-advanced"]',
|
||||
|
||||
labelRunQueryOnPageLoad: '[data-cy="run-on-app-load-toggle-label"]',
|
||||
labelRequestConfirmationOnRun:
|
||||
'[data-cy="confirmation-before-run-toggle-label"]',
|
||||
labelShowNotification: '[data-cy="notification-on-success-toggle-label"]',
|
||||
toggleNotification: '[data-cy="notification-on-success-toggle-switch"]',
|
||||
labelSuccessMessageInput: '[data-cy="label-success-message-input"]',
|
||||
notificationDurationInput: '[data-cy="label-notification-duration-input"]',
|
||||
addEventHandler: '[data-cy="add-event-handler"]',
|
||||
noEventHandlerMessage: '[data-cy="no-event-handler-message"]',
|
||||
postgresqlQueryRunButton: '[data-cy="postgresql1-query-run-button"]',
|
||||
psqlQueryLabel: '[data-cy="postgresql1-query-label"]',
|
||||
psqlQueryDeleteButton: '[data-cy="postgresql1-query-delete-button"]',
|
||||
deleteModalMessage: '[data-cy="modal-message"]',
|
||||
deleteModalCancelButton: '[data-cy="modal-cancel-button"]',
|
||||
deleteModalConfirmButton: '[data-cy="modal-confirm-button"]',
|
||||
labelRunQueryOnPageLoad: '[data-cy="run-on-app-load-toggle-label"]',
|
||||
labelRequestConfirmationOnRun:
|
||||
'[data-cy="confirmation-before-run-toggle-label"]',
|
||||
labelShowNotification: '[data-cy="notification-on-success-toggle-label"]',
|
||||
toggleNotification: '[data-cy="notification-on-success-toggle-switch"]',
|
||||
labelSuccessMessageInput: '[data-cy="label-success-message-input"]',
|
||||
notificationDurationInput: '[data-cy="label-notification-duration-input"]',
|
||||
addEventHandler: '[data-cy="add-event-handler"]',
|
||||
noEventHandlerMessage: '[data-cy="no-event-handler-message"]',
|
||||
postgresqlQueryRunButton: '[data-cy="postgresql1-query-run-button"]',
|
||||
psqlQueryLabel: '[data-cy="postgresql1-query-label"]',
|
||||
psqlQueryDeleteButton: '[data-cy="postgresql1-query-delete-button"]',
|
||||
deleteModalMessage: '[data-cy="modal-message"]',
|
||||
deleteModalCancelButton: '[data-cy="modal-cancel-button"]',
|
||||
deleteModalConfirmButton: '[data-cy="modal-confirm-button"]',
|
||||
|
||||
querySelectDropdown: "[data-cy='query-select-dropdown']",
|
||||
opetionQuerySave: "[data-cy='query-save-option']",
|
||||
querySelectDropdown: "[data-cy='query-select-dropdown']",
|
||||
opetionQuerySave: "[data-cy='query-save-option']",
|
||||
|
||||
dataExistanceQuery: '[data-cy="existance_of_table-query-label"]',
|
||||
tableNameInputField: '[data-cy="table-input-field"]',
|
||||
primaryKeyColoumnInputField: '[data-cy="primary_key_column-input-field"]',
|
||||
recordsInputField: '[data-cy="records-input-field"]',
|
||||
dataExistanceQuery: '[data-cy="existance_of_table-query-label"]',
|
||||
tableNameInputField: '[data-cy="table-input-field"]',
|
||||
primaryKeyColoumnInputField: '[data-cy="primary_key_column-input-field"]',
|
||||
recordsInputField: '[data-cy="records-input-field"]',
|
||||
|
||||
eventQuerySelectionField: '[data-cy="query-selection-field"]',
|
||||
};
|
||||
eventQuerySelectionField: '[data-cy="query-selection-field"]',
|
||||
connectionAlertText: '[data-cy="connection-alert-text"]',
|
||||
};
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
export const azureBlobStorageText = {
|
||||
azureBlobStorage: "Azure Blob Storage",
|
||||
connectionStringPlaceholder: "Enter connection string",
|
||||
unableExtractAccountNameText:
|
||||
"Unable to extract accountName with provided information.",
|
||||
};
|
||||
|
|
@ -0,0 +1,158 @@
|
|||
import { fake } from "Fixtures/fake";
|
||||
import { postgreSqlSelector } from "Selectors/postgreSql";
|
||||
import { postgreSqlText } from "Texts/postgreSql";
|
||||
import { azureBlobStorageText } from "Texts/azureBlobStorage";
|
||||
import { mongoDbText } from "Texts/mongoDb";
|
||||
import { commonSelectors } from "Selectors/common";
|
||||
import {
|
||||
fillDataSourceTextField,
|
||||
selectDataSource,
|
||||
} from "Support/utils/postgreSql";
|
||||
import { commonText } from "Texts/common";
|
||||
import { dataSourceSelector } from "Selectors/dataSource";
|
||||
import { closeDSModal, deleteDatasource } from "Support/utils/dataSource";
|
||||
|
||||
const data = {};
|
||||
data.lastName = fake.lastName.toLowerCase().replaceAll("[^A-Za-z]", "");
|
||||
data.customText = fake.randomSentence;
|
||||
|
||||
describe("Data source Azure Blob Storage", () => {
|
||||
beforeEach(() => {
|
||||
cy.appUILogin();
|
||||
cy.intercept("GET", "/api/v2/data_sources");
|
||||
});
|
||||
|
||||
it("Should verify elements on Azure Blob Storage connection form", () => {
|
||||
cy.get(commonSelectors.globalDataSourceIcon).click();
|
||||
closeDSModal();
|
||||
cy.get(commonSelectors.addNewDataSourceButton)
|
||||
.verifyVisibleElement("have.text", commonText.addNewDataSourceButton)
|
||||
.click();
|
||||
|
||||
cy.get(postgreSqlSelector.allDatasourceLabelAndCount).should(
|
||||
"have.text",
|
||||
postgreSqlText.allDataSources
|
||||
);
|
||||
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.get(postgreSqlSelector.dataSourceSearchInputField).type(
|
||||
azureBlobStorageText.azureBlobStorage
|
||||
);
|
||||
cy.get("[data-cy*='data-source-']")
|
||||
.eq(1)
|
||||
.should("contain", azureBlobStorageText.azureBlobStorage);
|
||||
cy.get('[data-cy="data-source-azure blob storage"]').click();
|
||||
|
||||
cy.get(postgreSqlSelector.dataSourceNameInputField).should(
|
||||
"have.value",
|
||||
azureBlobStorageText.azureBlobStorage
|
||||
);
|
||||
|
||||
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).verifyVisibleElement(
|
||||
"have.text",
|
||||
postgreSqlText.couldNotConnect
|
||||
);
|
||||
cy.get(postgreSqlSelector.buttonSave).verifyVisibleElement(
|
||||
"have.text",
|
||||
postgreSqlText.buttonTextSave
|
||||
);
|
||||
cy.get(dataSourceSelector.connectionAlertText).verifyVisibleElement(
|
||||
"have.text",
|
||||
"Cannot read properties of undefined (reading 'startsWith')"
|
||||
);
|
||||
});
|
||||
|
||||
it("Should verify the functionality of Azure Blob Storage connection form.", () => {
|
||||
selectDataSource(azureBlobStorageText.azureBlobStorage);
|
||||
|
||||
cy.clearAndType(
|
||||
'[data-cy="data-source-name-input-filed"]',
|
||||
`cypress-${data.lastName}-azure-blob-storage`
|
||||
);
|
||||
|
||||
fillDataSourceTextField(
|
||||
mongoDbText.labelConnectionString,
|
||||
azureBlobStorageText.connectionStringPlaceholder,
|
||||
data.customText,
|
||||
"contain",
|
||||
{ parseSpecialCharSequences: false, delay: 0 }
|
||||
);
|
||||
cy.get(postgreSqlSelector.buttonTestConnection)
|
||||
.verifyVisibleElement(
|
||||
"have.text",
|
||||
postgreSqlText.buttonTextTestConnection
|
||||
)
|
||||
.click();
|
||||
cy.get(postgreSqlSelector.connectionFailedText).verifyVisibleElement(
|
||||
"have.text",
|
||||
postgreSqlText.couldNotConnect
|
||||
);
|
||||
cy.get(dataSourceSelector.connectionAlertText).verifyVisibleElement(
|
||||
"have.text",
|
||||
azureBlobStorageText.unableExtractAccountNameText
|
||||
);
|
||||
|
||||
fillDataSourceTextField(
|
||||
mongoDbText.labelConnectionString,
|
||||
azureBlobStorageText.connectionStringPlaceholder,
|
||||
Cypress.env("azure_blob_storage_connection_string"),
|
||||
"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.toastDSAdded
|
||||
);
|
||||
|
||||
cy.get(commonSelectors.globalDataSourceIcon).click();
|
||||
cy.get(
|
||||
`[data-cy="cypress-${data.lastName}-azure-blob-storage-button"]`
|
||||
).verifyVisibleElement(
|
||||
"have.text",
|
||||
`cypress-${data.lastName}-azure-blob-storage`
|
||||
);
|
||||
|
||||
deleteDatasource(`cypress-${data.lastName}-azure-blob-storage`);
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue