mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-12 15:44:06 -08:00
596c472ecc
Signed-off-by: Oleg Ivaniv <me@olegivaniv.com> Co-authored-by: Val <68596159+valya@users.noreply.github.com> Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in> Co-authored-by: Valya Bullions <valya@n8n.io> Co-authored-by: Danny Martini <danny@n8n.io> Co-authored-by: Danny Martini <despair.blue@gmail.com> Co-authored-by: Iván Ovejero <ivov.src@gmail.com> Co-authored-by: Omar Ajoue <krynble@gmail.com> Co-authored-by: oleg <me@olegivaniv.com> Co-authored-by: Michael Kret <michael.k@radency.com> Co-authored-by: Michael Kret <88898367+michael-radency@users.noreply.github.com> Co-authored-by: Elias Meire <elias@meire.dev> Co-authored-by: Giulio Andreini <andreini@netseven.it> Co-authored-by: Giulio Andreini <g.andreini@gmail.com> Co-authored-by: Ayato Hayashi <go12limchangyong@gmail.com>
79 lines
3.4 KiB
TypeScript
79 lines
3.4 KiB
TypeScript
import { BasePage } from '../base';
|
|
import { getVisibleSelect } from '../../utils';
|
|
|
|
export class CredentialsModal extends BasePage {
|
|
getters = {
|
|
newCredentialModal: () => cy.getByTestId('selectCredential-modal', { timeout: 5000 }),
|
|
editCredentialModal: () => cy.getByTestId('editCredential-modal', { timeout: 5000 }),
|
|
newCredentialTypeSelect: () => cy.getByTestId('new-credential-type-select'),
|
|
newCredentialTypeOption: (credentialType: string) =>
|
|
cy.getByTestId('new-credential-type-select-option').contains(credentialType),
|
|
newCredentialTypeButton: () => cy.getByTestId('new-credential-type-button'),
|
|
connectionParameters: () => cy.getByTestId('credential-connection-parameter'),
|
|
connectionParameter: (fieldName: string) =>
|
|
this.getters.connectionParameters().find(`:contains('${fieldName}') .n8n-input input`),
|
|
name: () => cy.getByTestId('credential-name'),
|
|
nameInput: () => cy.getByTestId('credential-name').find('input'),
|
|
// Saving of the credentials takes a while on the CI so we need to increase the timeout
|
|
saveButton: () => cy.getByTestId('credential-save-button', { timeout: 5000 }),
|
|
deleteButton: () => cy.getByTestId('credential-delete-button'),
|
|
closeButton: () => this.getters.editCredentialModal().find('.el-dialog__close').first(),
|
|
credentialsEditModal: () => cy.getByTestId('credential-edit-dialog'),
|
|
credentialsAuthTypeSelector: () => cy.getByTestId('node-auth-type-selector'),
|
|
credentialAuthTypeRadioButtons: () =>
|
|
this.getters.credentialsAuthTypeSelector().find('label.el-radio'),
|
|
credentialInputs: () => cy.getByTestId('credential-connection-parameter'),
|
|
menu: () => this.getters.editCredentialModal().get('.menu-container'),
|
|
menuItem: (name: string) => this.getters.menu().get('.n8n-menu-item').contains(name),
|
|
usersSelect: () => cy.getByTestId('project-sharing-select').filter(':visible'),
|
|
testSuccessTag: () => cy.getByTestId('credentials-config-container-test-success'),
|
|
};
|
|
actions = {
|
|
addUser: (email: string) => {
|
|
this.getters.usersSelect().click();
|
|
getVisibleSelect().contains(email.toLowerCase()).click();
|
|
},
|
|
setName: (name: string) => {
|
|
this.getters.name().click();
|
|
this.getters.nameInput().clear().type(name);
|
|
},
|
|
save: (test = false) => {
|
|
cy.intercept('POST', '/rest/credentials').as('saveCredential');
|
|
this.getters.saveButton().click({ force: true });
|
|
|
|
cy.wait('@saveCredential');
|
|
if (test) cy.wait('@testCredential');
|
|
this.getters.saveButton().should('contain.text', 'Saved');
|
|
},
|
|
saveSharing: (test = false) => {
|
|
cy.intercept('PUT', '/rest/credentials/*/share').as('shareCredential');
|
|
this.getters.saveButton().click({ force: true });
|
|
cy.wait('@shareCredential');
|
|
this.getters.saveButton().should('contain.text', 'Saved');
|
|
},
|
|
close: () => {
|
|
this.getters.closeButton().click();
|
|
},
|
|
fillCredentialsForm: () => {
|
|
this.getters.credentialsEditModal().should('be.visible');
|
|
this.getters.credentialInputs().should('have.length.greaterThan', 0);
|
|
this.getters
|
|
.credentialInputs()
|
|
.find('input[type=text], input[type=password]')
|
|
.each(($el) => {
|
|
cy.wrap($el).type('test');
|
|
});
|
|
this.getters.saveButton().click();
|
|
this.getters.closeButton().click();
|
|
},
|
|
renameCredential: (newName: string) => {
|
|
this.getters.nameInput().type('{selectall}');
|
|
this.getters.nameInput().type(newName);
|
|
this.getters.nameInput().type('{enter}');
|
|
},
|
|
changeTab: (tabName: string) => {
|
|
this.getters.menuItem(tabName).click();
|
|
},
|
|
};
|
|
}
|