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'; import verifyCredentials from './verify-credentials';
const isStillVerified = async ($: IGlobalVariable) => { const isStillVerified = async ($: IGlobalVariable) => {
try { await verifyCredentials($);
await verifyCredentials($); return true;
return true;
} catch (error) {
return false;
}
}; };
export default isStillVerified; export default isStillVerified;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -22,7 +22,12 @@ const testConnection = async (
const app = await App.findOneByKey(connection.key, false); const app = await App.findOneByKey(connection.key, false);
const $ = await globalVariable({ connection, app }); 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({ connection = await connection.$query().patchAndFetch({
formattedData: connection.formattedData, formattedData: connection.formattedData,

View File

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

View File

@@ -20,7 +20,9 @@ describe('Apps page', () => {
context('can add connection', () => { context('can add connection', () => {
before(() => { before(() => {
cy.og('add-connection-button').click(); cy
.og('add-connection-button')
.click({ force: true });
}); });
it('lists applications', () => { it('lists applications', () => {
@@ -28,14 +30,14 @@ describe('Apps page', () => {
}); });
it('searches an application', () => { 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); cy.og('app-list-item').should('have.length', 1);
}); });
it('goes to app page to create a connection', () => { it('goes to app page to create a connection', () => {
cy.og('app-list-item').first().click(); 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'); cy.og('add-app-connection-dialog').should('be.visible');
}); });
@@ -43,7 +45,7 @@ describe('Apps page', () => {
it('closes the dialog on backdrop click', () => { it('closes the dialog on backdrop click', () => {
cy.clickOutside(); 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'); cy.og('add-app-connection-dialog').should('not.exist');
}); });
}); });

View File

@@ -5,41 +5,44 @@ describe('Connections page', () => {
cy.login(); cy.login();
cy.og('apps-page-drawer-link').click(); cy.og('apps-page-drawer-link').click();
cy.visit('/app/deepl/connections');
}); });
after(() => { after(() => {
cy.logout(); cy.logout();
}); });
it('opens via applications page', () => { it('shows connections if any', () => {
cy.og('apps-loader').should('not.exist'); cy.og('apps-loader').should('not.exist');
cy.og('app-row').contains('Slack').click(); cy.ss('DeepL connections before creating a connection');
cy.og('app-connection-row').should('be.visible');
cy.ss('Slack connections before creating a connection');
}); });
context('can add connection', () => { context('can add connection', () => {
it('has a button to open add connection dialog', () => { 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', () => { 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', () => { 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').click();
cy.og('create-connection-button').should('not.exist'); 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'); cy.ss('Execution - data out');
}); });
it('displays error', () => { it('does not display error', () => {
cy.og('error-tab').click({ multiple: true, force: true }); cy.og('error-tab').should('not.exist');
cy.ss('Execution - error');
}); });
}); });

View File

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

View File

@@ -40,6 +40,7 @@ export interface IExecution {
flowId: string; flowId: string;
flow: IFlow; flow: IFlow;
testRun: boolean; testRun: boolean;
status: 'success' | 'failure';
executionSteps: IExecutionStep[]; executionSteps: IExecutionStep[];
updatedAt: string; updatedAt: string;
createdAt: 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 <ArrowForwardIosIcon
sx={{ color: (theme) => theme.palette.primary.main }} sx={{ color: (theme) => theme.palette.primary.main }}
/> />

View File

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

View File

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

View File

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