Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

funtion OpenAiChat #175

Merged
merged 1 commit into from
Jul 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 86 additions & 4 deletions pages/flowGenie.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export class FlowGenie {
cy.get(selectors.tabFlowGenie).should('exist');
}

//Create New FlowGenie
CreateFlowGenie(nameFlowGenie, description) {
//Create New FlowGenie from list
CreateFlowGenie(nameFlowGenie,description) {
this.ClickAddFlowGenie();
cy.get(selectors.modalNewFlowGenie).should('be.visible');
cy.get(selectors.inputNameFlowGenie).type(nameFlowGenie,{timeout: 200});
Expand All @@ -35,11 +35,11 @@ export class FlowGenie {
cy.get(selectors.addFlowGenie).should('be.visible').click();
}

//Save FlowGenie
//Save FlowGenie and Save settings FlowGenie
ClickSaveFlowGenie(){
cy.xpath(selectors.saveFlowGenie).should('be.visible').click({force: true}, {timeout: 500});
}

//Search FlowGenie and select options
searchFlowGenieAndSelectOptions(nameFlowGenie, option) {
this.SearchFlowGenie(nameFlowGenie);
Expand Down Expand Up @@ -85,6 +85,7 @@ export class FlowGenie {
cy.get(selectors.searchBox).first().type(nameFlowGenie,{delay: 100}).should('have.value',nameFlowGenie);
}

//Complete the data for a copied genie
copyFlowGenie(nameFlowGenie, newNameFlowGenie) {
this.searchFlowGenieAndSelectOptions(nameFlowGenie, 'copy');
cy.xpath(selectors.modalCopy).should('be.visible');
Expand All @@ -105,6 +106,87 @@ export class FlowGenie {
});
}

//Settings for flowGenie
//Select Response format
selectResposeFormat(responseFormat){
cy.xpath("//label[contains(text(),'Response Format')]").should('be.visible');
cy.get('select').first().select(responseFormat).should('have.value', responseFormat);
}

//Cancel FlowGenie
ClickCancelFlowGenie(){
cy.xpath(selectors.cancelFlowGenie).should('be.visible').click({force: true}, {timeout: 500});
}

//Run FlowGenie
ClickRunBtn(){
cy.xpath(selectors.runBtn).should('be.visible').click({force: true}, {timeout: 500});
}

//Add FlowGenie
ClickAddBtn(){
cy.xpath(selectors.addBtn).should('be.visible').click({force: true}, {timeout: 1000});
}

//Add text in Chat
addMessageSystem(messageS){
cy.get(selectors.systemMessage).type(messageS, {delay: 50});
}

//Add User text
addUserText(messageU){
cy.get(selectors.usertext).type(messageU, {delay: 50});
}

//add message in OpenAi Chat
addMessageText(messageS,messageU){
this.addMessageSystem(messageS);
this.addUserText(messageU);
this.ClickAddBtn();
cy.get('textarea[class="message-textarea"]').should('be.visible');
}
//Funtion for Attach Menu
attachMenuFile(option,file) {
cy.get(selectors.attachFileBtn).should('be.visible').click();
switch (option) {
case "image":
this.attachImage(file);
break;
case "pdf":
this.attachPdf(file);
break;
case "csv":
this.attachCsv();
break;
case "url":
this.attachUrl();
break;
}
}

//Option Image
attachImage(file){
cy.xpath("//span[contains(text(),'Image')]").should('exist');
cy.get('[class="custom-file b-form-file mr-1"] input').eq(0).attachFile(file,{timeout: 10000});
cy.wait(1000);
this.ClickAddBtn();
}
//Option Pdf
attachPdf(file){
cy.xpath("//span[contains(text(),'PDF')]").should('exist');
cy.get('[class="custom-file b-form-file mr-1"] input').eq(1).attachFile(file,{timeout: 10000});
cy.wait(2000);
this.ClickAddBtn();
}
//Option CSV
attachCsv(){
cy.xpath(selectors.editFlowGenie).first().should('be.visible').click();
}
//Option Url Link
attachUrl(){
cy.xpath(selectors.editFlowGenie).first().should('be.visible').click();
}

//Verify and import FlowGenie

//Create Category FlowGenie
Expand Down
6 changes: 6 additions & 0 deletions selectors/flowGenie.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ inputNameFlowGenie: 'input[name="name"]',
textareaDescription: 'textarea[name="description"]',
addFlowGenie: 'button[aria-label="Create Genie"]',
saveFlowGenie: "//button[contains(text(),'Save')]",
cancelFlowGenie:"//button[contains(text(),'Cancel')]",
runBtn:"//button[contains(text(),'Run')]",
addBtn:"//button[contains(text(),'Add')]",
loading: '.jumbotron.jumbotron-fluid',
buttonOptions: 'button[class="btn dropdown-toggle btn-outlined-secondary static-header contracted-menu dropdown-toggle-no-caret"]',
editFlowGenie: "//span[contains(text(),'Edit')]",
Expand All @@ -24,6 +27,9 @@ tableBody:'//div[@class="data-table"]//div[2]//tbody',

//Inside FlowGenie
flowGenieStudio: '[class="card-header bg-white text-primary py-3 h5 font-weight-bold d-flex align-items-center"]',
systemMessage: 'textarea[class="message-textarea system-message"]',
usertext: 'textarea[class="add-message-textarea"]',
attachFileBtn: 'button[class="btn btn-sm btn-outline-light-blue"]',

//Modeler

Expand Down
Loading