Skip to content

Commit

Permalink
chore: improve docs
Browse files Browse the repository at this point in the history
  • Loading branch information
owen2345 committed Jun 8, 2021
1 parent 02f32d1 commit 364b69e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions docs/backend_connector.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// ****** Copied from 'e2e_tests_connector' gem ********
export {};

//********* INTEGRATE CONNECTOR COMMANDS ON CYPRESS
// ********* INTEGRATE CONNECTOR COMMANDS ON CYPRESS
declare namespace Cypress {
interface Chainable<Subject> {
serverCommand(kind: string, commands: string|string[], params?: object): Chainable<any>
Expand All @@ -11,14 +12,14 @@ declare namespace Cypress {
}
}

//********* DEFINE CONNECTOR COMMANDS
// ********* DEFINE CONNECTOR COMMANDS
// Backend server connector
Cypress.Commands.add('serverCommand', (kind: string, commands: string|string[], params = {}) => {
const body = Object.assign(params, { kind, commands });
cy.log('Running command...: ', body);
return cy.request({
method: 'POST',
url: `${Cypress.env('BACKEND_URL')}/cypress/call.json`,
url: `${Cypress.env('BACKEND_URL')}/e2e_tests_connector/call.json`,
body: JSON.stringify(body),
log: true,
failOnStatusCode: true,
Expand All @@ -44,6 +45,6 @@ Cypress.Commands.add('resetDb', () => cy.serverCommand('reset_db', ''));
// Initialize all defined custom mocks on server side before starting to run all tests
Cypress.Commands.add('initCustomMocks', () => cy.serverCommand('init_custom_mocks', ''));

//********* SETUP INITIALIZATIONS
// ********* SETUP INITIALIZATIONS
beforeEach(() => cy.resetDb()); // reset database for each test
before(() => cy.initCustomMocks()); // init custom e2e mocks before running tests
before(() => cy.initCustomMocks()); // init custom e2e mocks before running tests

0 comments on commit 364b69e

Please sign in to comment.