From f1cf2cba7fe2685b97da4d07dd43706028d464d1 Mon Sep 17 00:00:00 2001 From: "mishal.alexander" Date: Fri, 5 Jan 2024 19:05:32 +0530 Subject: [PATCH] updated the yml file to run UI and Api tests parallely --- .github/workflows/parallel-test-build.yml | 29 ++++------------------- cypress/e2e/tests/addToCartTest.cy.js | 2 +- cypress/e2e/tests/registerTest.cy.js | 2 +- cypress/reports/html/index.html | 2 +- package.json | 1 + 5 files changed, 8 insertions(+), 28 deletions(-) diff --git a/.github/workflows/parallel-test-build.yml b/.github/workflows/parallel-test-build.yml index ebcd96f..d575974 100644 --- a/.github/workflows/parallel-test-build.yml +++ b/.github/workflows/parallel-test-build.yml @@ -1,7 +1,7 @@ name: Parallel Test Run on: push jobs: - add-to-cart-run: + ui-tests-run: runs-on: ubuntu-22.04 steps: - name: Checkout @@ -13,34 +13,13 @@ jobs: - name: Cypress run uses: cypress-io/github-action@v5 with: - command: npm run test:addToCart + command: npm run test:uiTests - name: Add to cart Test Report if: always() uses: actions/upload-artifact@v4 with: - name: Mochawesome html report - Add to cart - path: cypress/reports/html - - register-flow-run: - runs-on: ubuntu-22.04 - steps: - - name: Checkout - uses: actions/checkout@v3 - - # Install npm dependencies, cache them correctly - # and run all Cypress tests - - - name: Cypress run - uses: cypress-io/github-action@v5 - with: - command: npm run test:registerTest - - - name: Register Test Report - if: always() - uses: actions/upload-artifact@v4 - with: - name: Mochawesome html report - Register + name: Mochawesome html report - All UI Tests path: cypress/reports/html api-tests-run: @@ -61,6 +40,6 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: - name: Mochawesome html report - Apis + name: Mochawesome html report - All Api Tests path: cypress/reports/html diff --git a/cypress/e2e/tests/addToCartTest.cy.js b/cypress/e2e/tests/addToCartTest.cy.js index 0beab56..ddb8cd3 100644 --- a/cypress/e2e/tests/addToCartTest.cy.js +++ b/cypress/e2e/tests/addToCartTest.cy.js @@ -3,7 +3,7 @@ const homePageObj = new homePage() import testData from '../../fixtures/testData.json' -describe(' test automation', () => { +describe('Adding a new product to cart tests', () => { before(() => { cy.login(testData.login.username, testData.login.password) }) diff --git a/cypress/e2e/tests/registerTest.cy.js b/cypress/e2e/tests/registerTest.cy.js index 388ee37..13b8089 100644 --- a/cypress/e2e/tests/registerTest.cy.js +++ b/cypress/e2e/tests/registerTest.cy.js @@ -2,7 +2,7 @@ import {registerPage} from "../../pages/registerPage"; import registerData from "../../fixtures/registerData.json"; const registerObject = new registerPage() -describe('Cypress Test Automation Suite',() => { +describe('Register a new user tests',() => { it('register a new user',()=>{ registerObject.openUrl(); registerObject.enterFirstName(registerData.firstname); diff --git a/cypress/reports/html/index.html b/cypress/reports/html/index.html index ec1731b..20c05c8 100644 --- a/cypress/reports/html/index.html +++ b/cypress/reports/html/index.html @@ -1,2 +1,2 @@ -Mochawesome Report
\ No newline at end of file +Mochawesome Report
\ No newline at end of file diff --git a/package.json b/package.json index 30bc8c9..5fc1105 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "test:simpleApiTest": "npx cypress run --spec cypress/e2e/api-tests/simpleApiTest.cy.js", "test:bearertokentest": "npx cypress run --spec cypress/e2e/api-tests/simpleBearerTokenTests.cy.js", "test:apiTests": "npx cypress run --spec cypress/e2e/api-tests/", + "test:uiTests": "npx cypress run --spec cypress/e2e/tests/", "test:all": "npx cypress run" }, "author": "Mishal Alexander",