How to use Testcafe Framework in aiTest

Language

  • JavaScript
Automation Framework
  • Testcafe

How to use Testcafe Automation Code in aiTest

By supporting the Testcafe Framework within aiTest, you can extend the platform’s capabilities and offer a more comprehensive testing solution. These features contribute to improved software quality, increased testing efficiency, and better user satisfaction.

  1. Sign up using your E-mail or Google account.
  2. Once you have reached the URL test dashboard, navigate to the left-side menu and select the Multi-Browser Test.
  3. Hit the Create Testrun button.
  4. Configure your test:
    • Name the testrun: Give the name of testrun whatever you want or which is related to your application, So that it will be easy to get that particular testrun details whenever you want. i.e. test-example.com, test-demo.com, etc.
    • Project: Select a project in which you want to run your test or you can create a project by clicking on the red colored plus sign(+) button.
    • Testrun Description: Write some testrun description to make your testrun more informative.
    • AUT URL: Application Under Test URL. e.g. https://example.com
    • Now here you can choose Repo Details or Your Automation Code.
    • Repo Details: Provide the repo details User’s Git Repository URL, User’s Git Username, User’s Git Token or Password, Report File Location and Testrun Command.
    • Your Automation Code: If you select “Your Automation Code” in the previous step, you will need to upload your automation code in a zip file.
    • Testrun Command: Write testrun Command to Run your testrun Testcases npx testcafe "chrome:headless --no-sandbox" tests/ -e --reporter json:reports/report.json.
    • Report Location: Write Report Location to Stored your testrun Testcases Report Files Report/Test_Report.html, Report/Test_Report.json and Report/Test_Report.xml
  5. Select Browsers: At the end select the browser on which you want to run your test. Currently, we have 3 browsers such as, Google Chrome, Mozilla Firefox and Microsoft Edge with their different browser versions.
  6. Once you are done with the above steps you can do either of the following:
    • Run It Now: Immediately run the automation code to test the browser compatibility of your apps with across browsers and versions.
    • Save: Save the configuration for later run as draft testrun.
    • Cancel: Reset and go back to previous page.
    • Update: Update the configurations of the test and run new.

Code Snippets for Reference

Use the code snippet provided below:

JavaScript

  
  import * as constants from "../resources/constants";
import * as userRoles from "../utils/roles.js";
import LoginPage from '../pages/login.js';

const loginPage = new LoginPage();

fixture('Dashboard')
    .page(constants.getLoginPageURL())
    .meta('regression', 'true');

// /**
//  * Dashboardpage Test Scenarios
//  *  1. DashboardPage with "Trending Blogs"
//  *  2. DashboardPage with Youtube.
//  *  3. DashboardPage with eBooks.
//  *  4. DashboardPage with AI Generated Blogs AI.
//  */

     test(`Youtube present on dashboard should  success`, async t => {
            await t.useRole(userRoles['Youtube']);
            await t.expect(loginPage.youtubeTitle.exists).ok('Youtube Title is present on page');
      });
     test(`Trending Blogs present on dashboard should  success`, async t => {
            await t.useRole(userRoles['TrendingBlogs']);
            await t.expect(loginPage.trendingBlogsTitle.exists).ok('Trending Blogs Title is present on page');
      });
     test(`AI Generated Blogs present on dashboard should  success`, async t => {
            await t.useRole(userRoles['AIGeneratedBlogsAI']);
            await t.expect(loginPage.aiGeneratedblogsTitle.exists).ok('AI Generated Blogs Title is present on page');
      });
     test(`eBooks present on dashboard should  success`, async t => {
            await t.useRole(userRoles['eBooks']);
            await t.expect(loginPage.eBooksTitle.exists).ok('eBooks Title is present on page');
      });
  

Note:

  1. First You have to check Anti Virus is Disabled or not and then Add C:\Windows\System32 path to the global PATH environment variable.

Questions Answered

  • How to Use Testcafe Automation Code in aiTest?
×

Subscribe

The latest tutorials sent straight to your inbox.