0
votes

Current situation: We are using cypress for test automation. We have a folder named 'integration' which contains several 'spec' files. These spec files can contain one or more tests related to each other.

Problem: I want to organize the cypress test automation on bamboo properly. What I want to do is have test suites e.g.

Playground_suite contains: 1) slide_tests_spec.js 2) teeter_totters_tests_spec.js ...

Road_suite contains: 1) car_tests_spec.js 2) truck_tests_spec.js ...

The I have the option of running Playground_suite that will only run the spec files defined in this suite.

Is this possible in cypress, if yes, how? Please help.

1
Did you ever find a solution?Garuuk

1 Answers

1
votes

We had faced this same type of issue. What we had come up to solve the same issue was the following:

00_suite.example.js:
import Test01 from './e2e_test01.example.js';
import Test02 from './e2e_test02.example.js';
import Test03 from './e2e_test03.example.js';

describe('Cypress_PreTest_Configuration', function() {
    console.log(Cypress.config());
});

// This is an example suite running tests in a specified order - 
// All tests contained in each of these files will be run before the next
// file is processed.
describe('Example_E2E_Test_Suite', function() {
    Test01();
    Test02();
    Test03();
});

describe('Example_Reverse_Ordered_E2E_Test_Suite', function() {
    Test03();
    Test02();
    Test01();
});

The key in the actual test files is that they contain the "export default function() {}" option prior to the describe suite definition(s):

e2e_test01.example.js:
export default function() {
    describe('Example_Tests_01', function() {
        it('TC01 - Example Tiger Tests', function() {
            doNothingOne();
            console.log(this.test.parent.parent.title);
            cy.visit(this.commonURIs.loginURI);
        })
    })
}

When attempting to run the e2e_test*.example.js files within the Cypress UI, you will find that the UI will report that there are no tests found. You will have to execute the tests through through the suite definition files. We had approached this limitation with only using the 'suite' approach for E2E tests while we utilize the standard spec files for regression and minimum acceptance testing.

I hope that this example is helpful for you and perhaps someone else may have an other solution.