Skip to content

Commit

Permalink
updated the yml file to run UI and Api tests parallely
Browse files Browse the repository at this point in the history
  • Loading branch information
mishal.alexander committed Jan 5, 2024
1 parent 9d41891 commit f1cf2cb
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 28 deletions.
29 changes: 4 additions & 25 deletions .github/workflows/parallel-test-build.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:
Expand All @@ -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

2 changes: 1 addition & 1 deletion cypress/e2e/tests/addToCartTest.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/tests/registerTest.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion cypress/reports/html/index.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<!doctype html>
<html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>Mochawesome Report</title><link rel="stylesheet" href="assets\app.css"/></head><body data-raw="{&quot;stats&quot;:{&quot;suites&quot;:1,&quot;tests&quot;:2,&quot;passes&quot;:2,&quot;pending&quot;:0,&quot;failures&quot;:0,&quot;testsRegistered&quot;:2,&quot;passPercent&quot;:100,&quot;pendingPercent&quot;:0,&quot;other&quot;:0,&quot;hasOther&quot;:false,&quot;skipped&quot;:0,&quot;hasSkipped&quot;:false,&quot;start&quot;:&quot;2024-01-05T13:24:48.573Z&quot;,&quot;end&quot;:&quot;2024-01-05T13:24:51.203Z&quot;,&quot;duration&quot;:2630},&quot;results&quot;:[{&quot;uuid&quot;:&quot;b1840e48-6f01-44fe-af5b-931591d8d150&quot;,&quot;title&quot;:&quot;&quot;,&quot;fullFile&quot;:&quot;cypress\\e2e\\api-tests\\simpleBearerTokenTests.cy.js&quot;,&quot;file&quot;:&quot;cypress\\e2e\\api-tests\\simpleBearerTokenTests.cy.js&quot;,&quot;beforeHooks&quot;:[],&quot;afterHooks&quot;:[],&quot;tests&quot;:[],&quot;suites&quot;:[{&quot;uuid&quot;:&quot;3805fcd5-9868-4787-98fe-6c71041582c6&quot;,&quot;title&quot;:&quot;Bearer token api tests&quot;,&quot;fullFile&quot;:&quot;cypress\\e2e\\api-tests\\simpleBearerTokenTests.cy.js&quot;,&quot;file&quot;:&quot;cypress\\e2e\\api-tests\\simpleBearerTokenTests.cy.js&quot;,&quot;beforeHooks&quot;:[],&quot;afterHooks&quot;:[],&quot;tests&quot;:[{&quot;title&quot;:&quot;Create a new order using the bearer token created&quot;,&quot;fullTitle&quot;:&quot;Bearer token api tests Create a new order using the bearer token created&quot;,&quot;timedOut&quot;:null,&quot;duration&quot;:2262,&quot;state&quot;:&quot;passed&quot;,&quot;speed&quot;:&quot;fast&quot;,&quot;pass&quot;:true,&quot;fail&quot;:false,&quot;pending&quot;:false,&quot;context&quot;:null,&quot;code&quot;:&quot;cy.request({\n method: &#x27;POST&#x27;,\n url: &#x27;https://simple-books-api.glitch.me/orders/&#x27;,\n headers: {\n &#x27;Content-Type&#x27;: &#x27;application/json&#x27;,\n &#x27;Authorization&#x27;: authenticationToken\n },\n body: {\n bookId: 1,\n customerName: Math.random().toString(5).substring(2)\n }\n}).then(response =&gt; {\n orderId = response.body.orderId;\n expect(response.status).to.eq(201);\n expect(response.body.created).to.eq(true);\n});&quot;,&quot;err&quot;:{},&quot;uuid&quot;:&quot;0058deeb-0aed-4b16-a7b4-cc3b7f37667a&quot;,&quot;parentUUID&quot;:&quot;3805fcd5-9868-4787-98fe-6c71041582c6&quot;,&quot;isHook&quot;:false,&quot;skipped&quot;:false},{&quot;title&quot;:&quot;Get all orders for the user and count the number of orders created which should be one.&quot;,&quot;fullTitle&quot;:&quot;Bearer token api tests Get all orders for the user and count the number of orders created which should be one.&quot;,&quot;timedOut&quot;:null,&quot;duration&quot;:309,&quot;state&quot;:&quot;passed&quot;,&quot;speed&quot;:&quot;fast&quot;,&quot;pass&quot;:true,&quot;fail&quot;:false,&quot;pending&quot;:false,&quot;context&quot;:null,&quot;code&quot;:&quot;cy.request({\n method: &#x27;GET&#x27;,\n url: &#x27;https://simple-books-api.glitch.me/orders/&#x27;,\n headers: {\n &#x27;Content-Type&#x27;: &#x27;application/json&#x27;,\n &#x27;Authorization&#x27;: authenticationToken\n },\n cookies: {\n &#x27;cookieName&#x27;: &#x27;optional_cookie&#x27;\n }\n}).then(response =&gt; {\n expect(response.status).to.eq(200);\n expect(response.body).has.length(1);\n});&quot;,&quot;err&quot;:{},&quot;uuid&quot;:&quot;b33fa633-e3fc-4456-a5a3-6d945ec02ffb&quot;,&quot;parentUUID&quot;:&quot;3805fcd5-9868-4787-98fe-6c71041582c6&quot;,&quot;isHook&quot;:false,&quot;skipped&quot;:false}],&quot;suites&quot;:[],&quot;passes&quot;:[&quot;0058deeb-0aed-4b16-a7b4-cc3b7f37667a&quot;,&quot;b33fa633-e3fc-4456-a5a3-6d945ec02ffb&quot;],&quot;failures&quot;:[],&quot;pending&quot;:[],&quot;skipped&quot;:[],&quot;duration&quot;:2571,&quot;root&quot;:false,&quot;rootEmpty&quot;:false,&quot;_timeout&quot;:2000}],&quot;passes&quot;:[],&quot;failures&quot;:[],&quot;pending&quot;:[],&quot;skipped&quot;:[],&quot;duration&quot;:0,&quot;root&quot;:true,&quot;rootEmpty&quot;:true,&quot;_timeout&quot;:2000}],&quot;meta&quot;:{&quot;mocha&quot;:{&quot;version&quot;:&quot;7.0.1&quot;},&quot;mochawesome&quot;:{&quot;options&quot;:{&quot;quiet&quot;:false,&quot;reportFilename&quot;:&quot;mochawesome&quot;,&quot;saveHtml&quot;:false,&quot;saveJson&quot;:true,&quot;consoleReporter&quot;:&quot;spec&quot;,&quot;useInlineDiffs&quot;:false,&quot;code&quot;:true},&quot;version&quot;:&quot;7.1.3&quot;},&quot;marge&quot;:{&quot;options&quot;:{&quot;overwrite&quot;:false,&quot;html&quot;:false,&quot;json&quot;:true,&quot;reportDir&quot;:&quot;cypress\\reports\\html\\.jsons&quot;},&quot;version&quot;:&quot;6.2.0&quot;}}}" data-config="{&quot;reportFilename&quot;:&quot;index.html&quot;,&quot;reportDir&quot;:&quot;C:\\Users\\Mishal\\Desktop\\cypress-e2e-framework\\cypress\\reports\\html&quot;,&quot;reportTitle&quot;:&quot;cypress-e2e-framework&quot;,&quot;reportPageTitle&quot;:&quot;Mochawesome Report&quot;,&quot;inline&quot;:false,&quot;inlineAssets&quot;:false,&quot;cdn&quot;:false,&quot;charts&quot;:false,&quot;enableCharts&quot;:false,&quot;code&quot;:true,&quot;enableCode&quot;:true,&quot;autoOpen&quot;:false,&quot;overwrite&quot;:true,&quot;timestamp&quot;:false,&quot;ts&quot;:false,&quot;showPassed&quot;:true,&quot;showFailed&quot;:true,&quot;showPending&quot;:true,&quot;showSkipped&quot;:false,&quot;showHooks&quot;:&quot;failed&quot;,&quot;saveJson&quot;:false,&quot;saveHtml&quot;:true,&quot;dev&quot;:false,&quot;assetsDir&quot;:&quot;C:\\Users\\Mishal\\Desktop\\cypress-e2e-framework\\cypress\\reports\\html\\assets&quot;,&quot;htmlFile&quot;:&quot;C:\\Users\\Mishal\\Desktop\\cypress-e2e-framework\\cypress\\reports\\html\\index.html&quot;}"><div id="report"></div><script src="assets\app.js"></script></body></html>
<html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>Mochawesome Report</title><link rel="stylesheet" href="assets\app.css"/></head><body data-raw="{&quot;stats&quot;:{&quot;suites&quot;:2,&quot;tests&quot;:2,&quot;passes&quot;:2,&quot;pending&quot;:0,&quot;failures&quot;:0,&quot;testsRegistered&quot;:2,&quot;passPercent&quot;:100,&quot;pendingPercent&quot;:0,&quot;other&quot;:0,&quot;hasOther&quot;:false,&quot;skipped&quot;:0,&quot;hasSkipped&quot;:false,&quot;start&quot;:&quot;2024-01-05T13:32:41.686Z&quot;,&quot;end&quot;:&quot;2024-01-05T13:32:55.208Z&quot;,&quot;duration&quot;:13522},&quot;results&quot;:[{&quot;uuid&quot;:&quot;94233c28-e0b5-47e7-9a7d-f50d5949e0e8&quot;,&quot;title&quot;:&quot;&quot;,&quot;fullFile&quot;:&quot;cypress\\e2e\\tests\\registerTest.cy.js&quot;,&quot;file&quot;:&quot;cypress\\e2e\\tests\\registerTest.cy.js&quot;,&quot;beforeHooks&quot;:[],&quot;afterHooks&quot;:[],&quot;tests&quot;:[],&quot;suites&quot;:[{&quot;uuid&quot;:&quot;8a6a836a-9cf2-4c7c-92c1-0cf1544605db&quot;,&quot;title&quot;:&quot;Cypress Test Automation Suite&quot;,&quot;fullFile&quot;:&quot;cypress\\e2e\\tests\\registerTest.cy.js&quot;,&quot;file&quot;:&quot;cypress\\e2e\\tests\\registerTest.cy.js&quot;,&quot;beforeHooks&quot;:[],&quot;afterHooks&quot;:[],&quot;tests&quot;:[{&quot;title&quot;:&quot;register a new user&quot;,&quot;fullTitle&quot;:&quot;Cypress Test Automation Suite register a new user&quot;,&quot;timedOut&quot;:null,&quot;duration&quot;:4866,&quot;state&quot;:&quot;passed&quot;,&quot;speed&quot;:&quot;fast&quot;,&quot;pass&quot;:true,&quot;fail&quot;:false,&quot;pending&quot;:false,&quot;context&quot;:null,&quot;code&quot;:&quot;registerObject.openUrl();\nregisterObject.enterFirstName(_registerData.default.firstname);\nregisterObject.enterLastName(_registerData.default.lastName);\nregisterObject.enterEmail(_registerData.default.email);\nregisterObject.enterTelephone(_registerData.default.telephone);\nregisterObject.enterPasswordAndConfirmPassword(_registerData.default.password);\nregisterObject.checkPrivacyPolicy();\nregisterObject.clickOnContinue();&quot;,&quot;err&quot;:{},&quot;uuid&quot;:&quot;c9437348-2277-4c7d-9a0b-b3433330f3d7&quot;,&quot;parentUUID&quot;:&quot;8a6a836a-9cf2-4c7c-92c1-0cf1544605db&quot;,&quot;isHook&quot;:false,&quot;skipped&quot;:false}],&quot;suites&quot;:[],&quot;passes&quot;:[&quot;c9437348-2277-4c7d-9a0b-b3433330f3d7&quot;],&quot;failures&quot;:[],&quot;pending&quot;:[],&quot;skipped&quot;:[],&quot;duration&quot;:4866,&quot;root&quot;:false,&quot;rootEmpty&quot;:false,&quot;_timeout&quot;:2000}],&quot;passes&quot;:[],&quot;failures&quot;:[],&quot;pending&quot;:[],&quot;skipped&quot;:[],&quot;duration&quot;:0,&quot;root&quot;:true,&quot;rootEmpty&quot;:true,&quot;_timeout&quot;:2000},{&quot;uuid&quot;:&quot;f7712ec1-3a02-46b2-9af0-888e80164115&quot;,&quot;title&quot;:&quot;&quot;,&quot;fullFile&quot;:&quot;cypress\\e2e\\tests\\addToCartTest.cy.js&quot;,&quot;file&quot;:&quot;cypress\\e2e\\tests\\addToCartTest.cy.js&quot;,&quot;beforeHooks&quot;:[],&quot;afterHooks&quot;:[],&quot;tests&quot;:[],&quot;suites&quot;:[{&quot;uuid&quot;:&quot;574fe714-8aa5-4138-9e8d-c5cfeca17e24&quot;,&quot;title&quot;:&quot; test automation&quot;,&quot;fullFile&quot;:&quot;cypress\\e2e\\tests\\addToCartTest.cy.js&quot;,&quot;file&quot;:&quot;cypress\\e2e\\tests\\addToCartTest.cy.js&quot;,&quot;beforeHooks&quot;:[],&quot;afterHooks&quot;:[],&quot;tests&quot;:[{&quot;title&quot;:&quot;Add To Cart flow&quot;,&quot;fullTitle&quot;:&quot; test automation Add To Cart flow&quot;,&quot;timedOut&quot;:null,&quot;duration&quot;:6751,&quot;state&quot;:&quot;passed&quot;,&quot;speed&quot;:&quot;medium&quot;,&quot;pass&quot;:true,&quot;fail&quot;:false,&quot;pending&quot;:false,&quot;context&quot;:null,&quot;code&quot;:&quot;homePageObj.searchProduct(_testData.default.product.productName);\nhomePageObj.addToCart();\nhomePageObj.verifySucessMessage().should(&#x27;contain&#x27;, _testData.default.message.successMessage).and(&#x27;contain&#x27;, _testData.default.product.productName);&quot;,&quot;err&quot;:{},&quot;uuid&quot;:&quot;4309ac62-e043-4869-8c83-6ec0b314be85&quot;,&quot;parentUUID&quot;:&quot;574fe714-8aa5-4138-9e8d-c5cfeca17e24&quot;,&quot;isHook&quot;:false,&quot;skipped&quot;:false}],&quot;suites&quot;:[],&quot;passes&quot;:[&quot;4309ac62-e043-4869-8c83-6ec0b314be85&quot;],&quot;failures&quot;:[],&quot;pending&quot;:[],&quot;skipped&quot;:[],&quot;duration&quot;:6751,&quot;root&quot;:false,&quot;rootEmpty&quot;:false,&quot;_timeout&quot;:2000}],&quot;passes&quot;:[],&quot;failures&quot;:[],&quot;pending&quot;:[],&quot;skipped&quot;:[],&quot;duration&quot;:0,&quot;root&quot;:true,&quot;rootEmpty&quot;:true,&quot;_timeout&quot;:2000}],&quot;meta&quot;:{&quot;mocha&quot;:{&quot;version&quot;:&quot;7.0.1&quot;},&quot;mochawesome&quot;:{&quot;options&quot;:{&quot;quiet&quot;:false,&quot;reportFilename&quot;:&quot;mochawesome&quot;,&quot;saveHtml&quot;:false,&quot;saveJson&quot;:true,&quot;consoleReporter&quot;:&quot;spec&quot;,&quot;useInlineDiffs&quot;:false,&quot;code&quot;:true},&quot;version&quot;:&quot;7.1.3&quot;},&quot;marge&quot;:{&quot;options&quot;:{&quot;overwrite&quot;:false,&quot;html&quot;:false,&quot;json&quot;:true,&quot;reportDir&quot;:&quot;cypress\\reports\\html\\.jsons&quot;},&quot;version&quot;:&quot;6.2.0&quot;}}}" data-config="{&quot;reportFilename&quot;:&quot;index.html&quot;,&quot;reportDir&quot;:&quot;C:\\Users\\Mishal\\Desktop\\cypress-e2e-framework\\cypress\\reports\\html&quot;,&quot;reportTitle&quot;:&quot;cypress-e2e-framework&quot;,&quot;reportPageTitle&quot;:&quot;Mochawesome Report&quot;,&quot;inline&quot;:false,&quot;inlineAssets&quot;:false,&quot;cdn&quot;:false,&quot;charts&quot;:false,&quot;enableCharts&quot;:false,&quot;code&quot;:true,&quot;enableCode&quot;:true,&quot;autoOpen&quot;:false,&quot;overwrite&quot;:true,&quot;timestamp&quot;:false,&quot;ts&quot;:false,&quot;showPassed&quot;:true,&quot;showFailed&quot;:true,&quot;showPending&quot;:true,&quot;showSkipped&quot;:false,&quot;showHooks&quot;:&quot;failed&quot;,&quot;saveJson&quot;:false,&quot;saveHtml&quot;:true,&quot;dev&quot;:false,&quot;assetsDir&quot;:&quot;C:\\Users\\Mishal\\Desktop\\cypress-e2e-framework\\cypress\\reports\\html\\assets&quot;,&quot;htmlFile&quot;:&quot;C:\\Users\\Mishal\\Desktop\\cypress-e2e-framework\\cypress\\reports\\html\\index.html&quot;}"><div id="report"></div><script src="assets\app.js"></script></body></html>
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit f1cf2cb

Please sign in to comment.