Merge branch 'main' into dependabot/npm_and_yarn/loader-utils-1.4.1

This commit is contained in:
Ömer Faruk Aydın
2022-11-08 23:34:46 +01:00
committed by GitHub
20 changed files with 88 additions and 97 deletions

View File

@@ -2,12 +2,8 @@ import { IGlobalVariable } from '@automatisch/types';
import verifyCredentials from './verify-credentials';
const isStillVerified = async ($: IGlobalVariable) => {
try {
await verifyCredentials($);
return true;
} catch (error) {
return false;
}
await verifyCredentials($);
return true;
};
export default isStillVerified;

View File

@@ -2,13 +2,9 @@ import { IGlobalVariable } from '@automatisch/types';
import getCurrentUser from '../common/get-current-user';
const isStillVerified = async ($: IGlobalVariable) => {
try {
await getCurrentUser($);
await getCurrentUser($);
return true;
} catch (error) {
return false;
}
return true;
};
export default isStillVerified;

View File

@@ -1,17 +1,13 @@
import { IGlobalVariable } from '@automatisch/types';
const isStillVerified = async ($: IGlobalVariable) => {
try {
const params = {
method: 'flickr.test.login',
format: 'json',
nojsoncallback: 1,
};
const response = await $.http.get('/rest', { params });
return !!response.data.user.id;
} catch (error) {
return false;
}
const params = {
method: 'flickr.test.login',
format: 'json',
nojsoncallback: 1,
};
const response = await $.http.get('/rest', { params });
return !!response.data.user.id;
};
export default isStillVerified;

View File

@@ -2,12 +2,8 @@ import { IGlobalVariable } from '@automatisch/types';
import getCurrentUser from '../common/get-current-user';
const isStillVerified = async ($: IGlobalVariable) => {
try {
const user = await getCurrentUser($);
return !!user.id;
} catch (error) {
return false;
}
const user = await getCurrentUser($);
return !!user.id;
};
export default isStillVerified;

View File

@@ -2,12 +2,8 @@ import { IGlobalVariable } from '@automatisch/types';
import getCurrentUser from '../common/get-current-user';
const isStillVerified = async ($: IGlobalVariable) => {
try {
const user = await getCurrentUser($);
return !!user;
} catch (error) {
return false;
}
const user = await getCurrentUser($);
return !!user;
};
export default isStillVerified;

View File

@@ -2,12 +2,8 @@ import { IGlobalVariable } from '@automatisch/types';
import getCurrentUser from '../common/get-current-user';
const isStillVerified = async ($: IGlobalVariable) => {
try {
const user = await getCurrentUser($);
return !!user.id;
} catch (error) {
return false;
}
const user = await getCurrentUser($);
return !!user.id;
};
export default isStillVerified;

View File

@@ -2,12 +2,8 @@ import { IGlobalVariable } from '@automatisch/types';
import verifyCredentials from './verify-credentials';
const isStillVerified = async ($: IGlobalVariable) => {
try {
await verifyCredentials($);
return true;
} catch (error) {
return false;
}
await verifyCredentials($);
return true;
};
export default isStillVerified;

View File

@@ -2,12 +2,8 @@ import { IGlobalVariable } from '@automatisch/types';
import verifyCredentials from './verify-credentials';
const isStillVerified = async ($: IGlobalVariable) => {
try {
await verifyCredentials($);
return true;
} catch (error) {
return false;
}
await verifyCredentials($);
return true;
};
export default isStillVerified;

View File

@@ -2,12 +2,8 @@ import { IGlobalVariable } from '@automatisch/types';
import getCurrentUser from '../common/get-current-user';
const isStillVerified = async ($: IGlobalVariable) => {
try {
const user = await getCurrentUser($);
return !!user;
} catch (error) {
return false;
}
const user = await getCurrentUser($);
return !!user;
};
export default isStillVerified;

View File

@@ -22,7 +22,12 @@ const testConnection = async (
const app = await App.findOneByKey(connection.key, false);
const $ = await globalVariable({ connection, app });
const isStillVerified = await app.auth.isStillVerified($);
let isStillVerified;
try {
isStillVerified = !!(await app.auth.isStillVerified($));
} catch {
isStillVerified = false;
}
connection = await connection.$query().patchAndFetch({
formattedData: connection.formattedData,

View File

@@ -8,7 +8,7 @@ module.exports = defineConfig({
env: {
login_email: 'user@automatisch.io',
login_password: 'sample',
slack_user_token: TO_BE_PROVIDED,
deepl_auth_key: TO_BE_PROVIDED,
},
specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
viewportWidth: 1280,

View File

@@ -20,7 +20,9 @@ describe('Apps page', () => {
context('can add connection', () => {
before(() => {
cy.og('add-connection-button').click();
cy
.og('add-connection-button')
.click({ force: true });
});
it('lists applications', () => {
@@ -28,14 +30,14 @@ describe('Apps page', () => {
});
it('searches an application', () => {
cy.og('search-for-app-text-field').type('Slack');
cy.og('search-for-app-text-field').type('DeepL');
cy.og('app-list-item').should('have.length', 1);
});
it('goes to app page to create a connection', () => {
cy.og('app-list-item').first().click();
cy.location('pathname').should('equal', '/app/slack/connections/add');
cy.location('pathname').should('equal', '/app/deepl/connections/add');
cy.og('add-app-connection-dialog').should('be.visible');
});
@@ -43,7 +45,7 @@ describe('Apps page', () => {
it('closes the dialog on backdrop click', () => {
cy.clickOutside();
cy.location('pathname').should('equal', '/app/slack/connections');
cy.location('pathname').should('equal', '/app/deepl/connections');
cy.og('add-app-connection-dialog').should('not.exist');
});
});

View File

@@ -5,41 +5,44 @@ describe('Connections page', () => {
cy.login();
cy.og('apps-page-drawer-link').click();
cy.visit('/app/deepl/connections');
});
after(() => {
cy.logout();
});
it('opens via applications page', () => {
it('shows connections if any', () => {
cy.og('apps-loader').should('not.exist');
cy.og('app-row').contains('Slack').click();
cy.og('app-connection-row').should('be.visible');
cy.ss('Slack connections before creating a connection');
cy.ss('DeepL connections before creating a connection');
});
context('can add connection', () => {
it('has a button to open add connection dialog', () => {
cy.og('add-connection-button').scrollIntoView().should('be.visible');
cy.scrollTo('top', { ensureScrollable: false });
cy
.og('add-connection-button')
.should('be.visible');
});
it('add connection button takes user to add connection page', () => {
cy.og('add-connection-button').click({ force: true });
cy.og('add-connection-button').click();
cy.location('pathname').should('equal', '/app/slack/connections/add');
cy.location('pathname').should('equal', '/app/deepl/connections/add');
});
it('shows add connection dialog to create a new connection', () => {
cy.get('input[name="accessToken"]').type(Cypress.env('slack_user_token'));
cy.get('input[name="screenName"]').type('e2e-test connection!');
cy.get('input[name="authenticationKey"]').type(Cypress.env('deepl_auth_key'));
cy.og('create-connection-button').click();
cy.og('create-connection-button').should('not.exist');
cy.ss('Slack connections after creating a connection');
cy.ss('DeepL connections after creating a connection');
});
});
});

View File

@@ -26,9 +26,7 @@ describe('Execution page', () => {
cy.ss('Execution - data out');
});
it('displays error', () => {
cy.og('error-tab').click({ multiple: true, force: true });
cy.ss('Execution - error');
it('does not display error', () => {
cy.og('error-tab').should('not.exist');
});
});

View File

@@ -77,19 +77,19 @@ describe('Flow editor page', () => {
});
});
context('arrange Slack action', () => {
context('arrange DeepL action', () => {
context('choose app and event substep', () => {
it('choose application', () => {
cy.og('choose-app-autocomplete').click();
cy.get('li[role="option"]:contains("Slack")').click();
cy.get('li[role="option"]:contains("DeepL")').click();
});
it('choose an event', () => {
cy.og('choose-event-autocomplete').should('be.visible').click();
cy.get(
'li[role="option"]:contains("Send a message to channel")'
'li[role="option"]:contains("Translate Text")'
).click();
});
@@ -120,13 +120,7 @@ describe('Flow editor page', () => {
});
context('set up action', () => {
it('choose channel', () => {
cy.og('parameters.channel-autocomplete').click();
cy.get('li[role="option"]').last().click();
});
it('arrange message text', () => {
it('arrange text', () => {
cy.og('power-input', ' [contenteditable]')
.click()
.type(
@@ -141,7 +135,15 @@ describe('Flow editor page', () => {
cy.clickOutside();
cy.ss('Slack action message text');
cy.ss('DeepL action text');
});
it('set target language', () => {
cy.og('parameters.targetLanguage-autocomplete').click();
cy.get(
'li[role="option"]:contains("Turkish")'
).first().click();
});
it('continue to next step', () => {
@@ -161,7 +163,7 @@ describe('Flow editor page', () => {
cy.og('flow-test-substep-output').should('be.visible');
cy.ss('Slack action test output');
cy.ss('DeepL action test output');
cy.og('flow-substep-continue-button').click();
});

View File

@@ -40,6 +40,7 @@ export interface IExecution {
flowId: string;
flow: IFlow;
testRun: boolean;
status: 'success' | 'failure';
executionSteps: IExecutionStep[];
updatedAt: string;
createdAt: string;

View File

@@ -57,6 +57,16 @@ export default function ExecutionRow(
/>
)}
<Chip
size="small"
color={execution.status === 'success' ? 'success' : 'error'}
label={formatMessage(
execution.status === 'success'
? 'execution.statusSuccess'
: 'execution.statusFailure'
)}
/>
<ArrowForwardIosIcon
sx={{ color: (theme) => theme.palette.primary.main }}
/>

View File

@@ -51,6 +51,7 @@ export default function ExecutionStep(
const validationStatusIcon =
executionStep.status === 'success' ? validIcon : errorIcon;
const hasError = !!executionStep.errorDetails;
return (
<Wrapper elevation={1} data-test="execution-step">
@@ -86,7 +87,7 @@ export default function ExecutionStep(
>
<Tab label="Data in" data-test="data-in-tab" />
<Tab label="Data out" data-test="data-out-tab" />
<Tab label="Error" data-test="error-tab" />
{hasError && <Tab label="Error" data-test="error-tab" />}
</Tabs>
</Box>
@@ -98,9 +99,11 @@ export default function ExecutionStep(
<JSONViewer data={executionStep.dataOut} />
</TabPanel>
<TabPanel value={activeTabIndex} index={2}>
<JSONViewer data={executionStep.errorDetails} />
</TabPanel>
{hasError && (
<TabPanel value={activeTabIndex} index={2}>
<JSONViewer data={executionStep.errorDetails} />
</TabPanel>
)}
</Content>
</Wrapper>
);

View File

@@ -13,6 +13,7 @@ export const GET_EXECUTIONS = gql`
testRun
createdAt
updatedAt
status
flow {
id
name

View File

@@ -74,6 +74,8 @@
"executions.noExecutions": "There is no execution data point to show.",
"execution.executedAt": "executed {datetime}",
"execution.test": "Test run",
"execution.statusSuccess": "Success",
"execution.statusFailure": "Failure",
"execution.noDataTitle": "No data",
"execution.noDataMessage": "We successfully ran the execution, but there was no new data to process.",
"profileSettings.title": "My Profile",
@@ -86,4 +88,4 @@
"profileSettings.updatePassword": "Update password",
"notifications.title": "Notifications",
"notification.releasedAt": "Released {relativeDate}"
}
}