ADDITIONAL RESOURCES

Importing tests into Relicx

4min
our customers, usually have tests written in cypress, selenium and other testing frameworks that they want to import into relicx for various reasons importing these manually authored tests into relicx from other frameworks is fairly simple and straighforward in the section below we will show you how these tests can be seemlessly migrated we have a test written for the cypress testing framework that tests the deposit flow in our sample digital bank application describe('dbank app test', function() { it('successfully logs in and makes a deposit', function() { cy visit('http //prod dbank staging apps relicx ai 8080/bank/login') // assert that the login page has loaded by checking visibility of the username input field cy get('#username') should('be visible') // enter username and password cy get('#username') type('jsmith\@demo io') should('have value', 'jsmith\@demo io') // assert that the username has been correctly entered cy get('#password') type('demo123!') should('have value', 'demo123!') // assert that the password has been correctly entered cy get('#submit') click() // assert that the login was successful by checking the url of the page cy url() should('eq','http //prod dbank staging apps relicx ai 8080/bank/home') // navigate to deposit page cy get('#deposit menu item') click() // select the account cy get('#selectedaccount') select('95') // option value for 'family checking' should('have value', '95') // assert that the correct account has been selected // input the deposit amount cy get('#amount') type('312') should('have value', '312') // assert that the correct deposit amount has been entered // submit the deposit cy get(' btn btn primary btn sm') click() // assert that the deposit was successful cy url() should('have string','http //prod dbank staging apps relicx ai 8080/bank/account/checking view') }) }) to import this test into relicx, we need to add couple of lines of code that will automatically import this test into relicx when it is executed in cypress describe('dbank app test', function() { it('successfully logs in and makes a deposit', function() { cy visit('http //prod dbank staging apps relicx ai 8080/bank/login') // assert that the login page has loaded by checking visibility of the username input field cy get('#username') should('be visible') // // call relicx api to name this test // cy window() then((win) => { win relicxsdk sessionvars({ testname "deposit test from cypress", }); }) cy get('#username') type('jsmith\@demo io') should('have value', 'jsmith\@demo io') // assert that the username has been correctly entered cy get('#password') type('demo123!') should('have value', 'demo123!') // assert that the password has been correctly entered cy get('#submit') click() // assert that the login was successful by checking the url of the page cy url() should('eq','http //prod dbank staging apps relicx ai 8080/bank/home') // navigate to deposit page cy get('#deposit menu item') click() // select the account cy get('#selectedaccount') select('95') // option value for 'family checking' should('have value', '95') // assert that the correct account has been selected // input the deposit amount cy get('#amount') type('312') should('have value', '312') // assert that the correct deposit amount has been entered // submit the deposit cy get(' btn btn primary btn sm') click() // assert that the deposit was successful cy url() should('have string','http //prod dbank staging apps relicx ai 8080/bank/account/checking view') // // optional tell relicx to stop recording (relicx times out on its own after inactivity) // cy window() then((win) => { win relicx? getcollector() stop(); }) }) }) the two blocks of code that we added are as follows the first block adds a test name i e the name of the test in relicx // call relicx api to name this test cy window() then((win) => { win relicxsdk sessionvars({ testname "deposit test imported from cypress", }); }) the second block, an optional steps, stops the recording once the test execution is done cy window() then((win) => { win relicx? getcollector() stop(); }) once the test is executed n cypress, a corresponding test is automatically created in relicx video demo