Test script to run login script with muiltple users in cypress


Test script to run login script with muiltple users in cypress
  
Following is example test  
  
01_multiple_user_login.cy.ts

import { action, commonElements} from "../../constants/selectors";
import "../../support/commands";
const testUsers = require('../../fixtures/userList.json')

describe("Verify and check login functionality", () => {
    it('Verify and check login functionality for all users',async function(){
        testUsers.forEach(user => { 
            let userEmail = user.user_email;
            let userPassword = user.password;
            cy.login(userEmail,userPassword)
  			cy.loginVerification()
   			cy.logout(userEmail,userPassword)
  			cy.logoutVerification()
        });
   });
});

Need to create following file under fixture folder
userList.json

[
    {
        "user_email": "abc@testmail.com",
        "password": "abc@123"
    },
   {
       	"user_email": "abc1@testmail.com",
        "password": "abc1@123"
    },
    {
        "user_email": "abc2@testmail.com",
        "password": "abc2@123"
    }
]