mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-09 22:24:05 -08:00
8c008f5d22
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
66 lines
2.8 KiB
TypeScript
66 lines
2.8 KiB
TypeScript
import { randFirstName, randLastName } from '@ngneat/falso';
|
|
import { DEFAULT_USER_EMAIL, DEFAULT_USER_PASSWORD } from '../constants';
|
|
import { WorkflowPage, NDV, CredentialsModal } from '../pages';
|
|
|
|
const workflowPage = new WorkflowPage();
|
|
const ndv = new NDV();
|
|
const credentialsModal = new CredentialsModal();
|
|
|
|
const NO_CREDENTIALS_MESSAGE = 'Please add your credential';
|
|
const INVALID_CREDENTIALS_MESSAGE = 'Please check your credential';
|
|
|
|
const email = DEFAULT_USER_EMAIL;
|
|
const password = DEFAULT_USER_PASSWORD;
|
|
const firstName = randFirstName();
|
|
const lastName = randLastName();
|
|
|
|
describe('Resource Locator', () => {
|
|
before(() => {
|
|
cy.setup({ email, firstName, lastName, password });
|
|
});
|
|
|
|
beforeEach(() => {
|
|
cy.signin({ email, password });
|
|
workflowPage.actions.visit();
|
|
});
|
|
|
|
it('should render both RLC components in google sheets', () => {
|
|
workflowPage.actions.addInitialNodeToCanvas('Manual');
|
|
workflowPage.actions.addNodeToCanvas('Google Sheets', true, true);
|
|
ndv.getters.resourceLocator('documentId').should('be.visible');
|
|
ndv.getters.resourceLocator('sheetName').should('be.visible');
|
|
});
|
|
|
|
it('should show appropriate error when credentials are not set', () => {
|
|
workflowPage.actions.addInitialNodeToCanvas('Manual');
|
|
workflowPage.actions.addNodeToCanvas('Google Sheets', true, true);
|
|
ndv.getters.resourceLocator('documentId').should('be.visible');
|
|
ndv.getters.resourceLocatorInput('documentId').click();
|
|
ndv.getters.resourceLocatorErrorMessage().should('contain', NO_CREDENTIALS_MESSAGE);
|
|
});
|
|
|
|
it('should show appropriate error when credentials are not valid', () => {
|
|
workflowPage.actions.addInitialNodeToCanvas('Manual');
|
|
workflowPage.actions.addNodeToCanvas('Google Sheets', true, true);
|
|
workflowPage.getters.nodeCredentialsSelect().click();
|
|
// Add oAuth credentials
|
|
workflowPage.getters.nodeCredentialsSelect().find('li').last().click();
|
|
credentialsModal.getters.credentialsEditModal().should('be.visible');
|
|
credentialsModal.getters.credentialAuthTypeRadioButtons().should('have.length', 2);
|
|
credentialsModal.getters.credentialAuthTypeRadioButtons().first().click();
|
|
credentialsModal.actions.fillCredentialsForm();
|
|
cy.get('.el-message-box').find('button').contains('Close').click();
|
|
ndv.getters.resourceLocatorInput('documentId').click();
|
|
ndv.getters.resourceLocatorErrorMessage().should('contain', INVALID_CREDENTIALS_MESSAGE);
|
|
});
|
|
|
|
it('should reset resource locator when dependent field is changed', () => {
|
|
workflowPage.actions.addInitialNodeToCanvas('Manual');
|
|
workflowPage.actions.addNodeToCanvas('Google Sheets', true, true);
|
|
ndv.actions.setRLCValue('documentId', '123');
|
|
ndv.actions.setRLCValue('sheetName', '123');
|
|
ndv.actions.setRLCValue('documentId', '321');
|
|
ndv.getters.resourceLocatorInput('sheetName').should('have.value', '');
|
|
});
|
|
});
|