chore: add e2e-tests package
This commit is contained in:
23
packages/e2e-tests/cypress.config.js
Normal file
23
packages/e2e-tests/cypress.config.js
Normal file
@@ -0,0 +1,23 @@
|
||||
const { defineConfig } = require("cypress");
|
||||
|
||||
const TO_BE_PROVIDED = 'HAS_TO_BE_PROVIDED_IN_cypress.env.json';
|
||||
|
||||
module.exports = defineConfig({
|
||||
e2e: {
|
||||
baseUrl: 'http://localhost:3001',
|
||||
env: {
|
||||
login_email: "user@automatisch.io",
|
||||
login_password: "sample",
|
||||
twitter_api_key: TO_BE_PROVIDED,
|
||||
twitter_api_secret: TO_BE_PROVIDED,
|
||||
slack_user_token: TO_BE_PROVIDED,
|
||||
},
|
||||
specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
|
||||
excludeSpecPattern: [
|
||||
'**/1-getting-started/**',
|
||||
'**/2-advanced-examples/**'
|
||||
],
|
||||
viewportWidth: 1280,
|
||||
viewportHeight: 768
|
||||
},
|
||||
});
|
45
packages/e2e-tests/cypress/support/commands.js
Normal file
45
packages/e2e-tests/cypress/support/commands.js
Normal file
@@ -0,0 +1,45 @@
|
||||
Cypress.Commands.add('og', { prevSubject: 'optional' }, (subject, selector, suffix = '') => {
|
||||
if (subject) {
|
||||
return cy.wrap(subject).get(`[data-test="${selector}"]${suffix}`);
|
||||
}
|
||||
|
||||
return cy.get(`[data-test="${selector}"]${suffix}`);
|
||||
});
|
||||
|
||||
Cypress.Commands.add('login', () => {
|
||||
cy.visit('/login');
|
||||
|
||||
cy.og('email-text-field').type(Cypress.env('login_email'));
|
||||
cy.og('password-text-field').type(Cypress.env('login_password'));
|
||||
|
||||
cy
|
||||
.intercept('/graphql')
|
||||
.as('graphqlCalls');
|
||||
cy
|
||||
.intercept('https://notifications.automatisch.io/notifications.json')
|
||||
.as('notificationsCall');
|
||||
cy.og('login-button').click();
|
||||
|
||||
cy.wait(['@graphqlCalls', '@notificationsCall']);
|
||||
});
|
||||
|
||||
Cypress.Commands.add('logout', () => {
|
||||
cy.og('profile-menu-button').click();
|
||||
|
||||
cy.og('logout-item').click();
|
||||
});
|
||||
|
||||
Cypress.Commands.add('ss', (name, opts = {}) => {
|
||||
return cy.screenshot(
|
||||
name,
|
||||
{
|
||||
overwrite: true,
|
||||
capture: 'viewport',
|
||||
...opts,
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
Cypress.Commands.add('clickOutside', () => {
|
||||
return cy.get('body').click(0, 0);
|
||||
});
|
20
packages/e2e-tests/cypress/support/e2e.js
Normal file
20
packages/e2e-tests/cypress/support/e2e.js
Normal file
@@ -0,0 +1,20 @@
|
||||
// ***********************************************************
|
||||
// This example support/e2e.js is processed and
|
||||
// loaded automatically before your test files.
|
||||
//
|
||||
// This is a great place to put global configuration and
|
||||
// behavior that modifies Cypress.
|
||||
//
|
||||
// You can change the location of this file or turn off
|
||||
// automatically serving support files with the
|
||||
// 'supportFile' configuration option.
|
||||
//
|
||||
// You can read more here:
|
||||
// https://on.cypress.io/configuration
|
||||
// ***********************************************************
|
||||
|
||||
// Import commands.js using ES2015 syntax:
|
||||
import './commands'
|
||||
|
||||
// Alternatively you can use CommonJS syntax:
|
||||
// require('./commands')
|
28
packages/e2e-tests/package.json
Normal file
28
packages/e2e-tests/package.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "@automatisch/e2e-tests",
|
||||
"version": "0.1.4",
|
||||
"license": "AGPL-3.0",
|
||||
"private": true,
|
||||
"description": "The open source Zapier alternative. Build workflow automation without spending time and money.",
|
||||
"scripts": {
|
||||
"cypress:open": "cypress open"
|
||||
},
|
||||
"dependencies": {},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "automatisch contributors",
|
||||
"url": "https://github.com/automatisch/automatisch/graphs/contributors"
|
||||
}
|
||||
],
|
||||
"homepage": "https://github.com/automatisch/automatisch#readme",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/automatisch/automatisch.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/automatisch/automatisch/issues"
|
||||
},
|
||||
"devDependencies": {
|
||||
"cypress": "^10.9.0"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user