New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@processmaker/cypress-utils

Package Overview
Dependencies
Maintainers
0
Versions
409
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@processmaker/cypress-utils - npm Package Compare versions

Comparing version 1.0.365 to 1.0.366

2

package.json
{
"name": "@processmaker/cypress-utils",
"version": "1.0.365",
"version": "1.0.366",
"description": "ProcessMaker Cypress Testing Utilities",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -104,2 +104,105 @@ //import selectors from "#selectors/dataValidation";

/**
* Initiates the import process for a collection by clicking the import button,
* attaching the specified file, and ensuring that the loading spinner and alerts are not visible.
* @param {string} filePath - The path to the file to be imported.
*/
importCollection(filePath) {
cy.get("[id='import_collection']").click();
cy.get("[id='import_collection']").should('be.visible');
cy.get("[type='file']").attachFile(filePath);
cy.get("[id='import_collection']").click();
cy.get("[class='fas fa-circle-notch fa-spin']").should('not.exist');
cy.get('[class="alert d-none d-lg-block alertBox alert-dismissible alert-danger"]').should('not.exist');
}
/**
* Imports a collection via API using the provided file path.
* Converts the file to a Blob and sends it as form data to the API.
* @param {string} filePath - The path to the file to be imported.
* @returns {Promise} - A promise that resolves with the response data.
*/
importCollectionAPI(filePath) {
let formData = new FormData();
let win;
return cy.fixture(filePath, null)
.then(Cypress.Blob.arrayBufferToBlob)
.then(fileBlob => {
formData.append('file', fileBlob);
return cy.window();
})
.then((win) => {
const options = {};
const optionsBlob = new Blob([JSON.stringify(options)], {
type: 'application/json'
});
formData.append('options', optionsBlob);
return win.ProcessMaker.apiClient.post('/collections/import', formData);
})
.then(response => {
return response.data;
});
}
/**
* Retrieves a collection by its UUID and name via API.
* @param {string} collection_uuid - The UUID of the collection to retrieve.
* @param {string} collection_name - The name of the collection to filter by.
* @returns {Promise} - A promise that resolves with the found collection.
*/
getCollectionByUuidAPI(collection_uuid, collection_name){
return cy.window().then(win => {
return win.ProcessMaker.apiClient.get('/collections', { params: {filter: collection_name,order_by:"id",order_direction:"asc", per_page:100} }).then(response => {
const collection = response.data.data.find(collection => collection.uuid === collection_uuid);
return collection;
});
});
}
/**
* Deletes a collection by its ID via API.
* @param {string} collectionID - The ID of the collection to delete.
* @returns {Promise} - A promise that resolves with a confirmation message.
*/
deleteCollectionByIdAPI(collectionID){
return cy.window().then(win => {
return win.ProcessMaker.apiClient.delete('/collections/'+collectionID).then(response => {
//console.log(JSON.stringify(response));
return "collection " + collectionID + " was deleted";
});
});
}
/**
* Retrieves a group by its name via API.
* @param {string} groupName - The name of the group to retrieve.
* @returns {Promise} - A promise that resolves with the found group.
*/
getGroupByGroupNameAPI(groupName){
return cy.window().then(win => {
return win.ProcessMaker.apiClient.get('/groups', { params: {filter: groupName} }).then(response => {
const group = response.data.data.find(group => group.name === groupName);
return group;
});
});
}
/**
* Verifies the presence of a collection by its name and imports it if found.
* @param {string} collectionName - The name of the collection to search for.
* @param {string} filePath - The path to the file to be imported if the collection is found.
*/
verifyPresenceOfCollectionAndImportCollection(collectionName, filePath) {
cy.get('[id="search"] input]').should('be.visible').type(collectionName).should('have.value', collectionName);
cy.wait(5000);
cy.xpath('div[id="collectionIndex"] [class="data-table"] table tbody tr', { timeout: 10000 })
.find('td')
.then(($loadedTable) => {
if ($loadedTable.length === 1) {
this.importCollection(filePath);
}
else return;
});
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc