Merge pull request #701 from automatisch/fix-e2e-tests

test: replace Slack with DeepL
This commit is contained in:
Ömer Faruk Aydın
2022-11-08 23:34:22 +01:00
committed by GitHub
5 changed files with 37 additions and 32 deletions

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();
});