mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-26 21:19:43 -08:00
1c36c37a12
* test(editor): Fix default-owner and credentials saving e2e specs * test(editor): fix webhook node test * test(editor): add cy command for browser permissions * test(editor): add cy command for reading clipboard * Fix 3-default-owner spec * Resolve review comments * Merge spec * Fix http node and expression editor modal specs * Add optional param to credentials modal saving action to wait for the test endpoint * Improve sidebar items clicking and increase credentials saving timeout * Rename http e2e spec to fix ordering * Fix pasting and copying of nodes e2e spec * Make sure to only access error.cause if it exists * Wait longer for the keyboard press * Make sure to focus the body when typing * Try type delay * Use meta key based on the running platform * Fix flaky workflowTagElements getter Co-authored-by: Csaba Tuncsik <csaba@n8n.io>
42 lines
1.7 KiB
TypeScript
42 lines
1.7 KiB
TypeScript
import { BasePage } from "../base";
|
|
|
|
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().contains(fieldName)
|
|
.parents('[data-test-id="credential-connection-parameter"]')
|
|
.find('.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 }),
|
|
closeButton: () => this.getters.editCredentialModal().find('.el-dialog__close').first(),
|
|
};
|
|
actions = {
|
|
setName: (name: string) => {
|
|
this.getters.name().click();
|
|
this.getters.nameInput().clear().type(name);
|
|
},
|
|
save: (test = false) => {
|
|
cy.intercept('POST', '/rest/credentials').as('saveCredential');
|
|
if(test) {
|
|
cy.intercept('POST', '/rest/credentials/test').as('testCredential');
|
|
}
|
|
|
|
this.getters.saveButton().click();
|
|
|
|
cy.wait('@saveCredential');
|
|
if(test) cy.wait('@testCredential')
|
|
this.getters.saveButton().should('contain.text', 'Saved');
|
|
},
|
|
close: () => {
|
|
this.getters.closeButton().click();
|
|
},
|
|
};
|
|
}
|