Skip to content

Commit

Permalink
Merge branch 'main' into 4133-fix-missing-pagination-on-warehouse
Browse files Browse the repository at this point in the history
  • Loading branch information
poulch committed Aug 29, 2023
2 parents 8512c2e + a88fc1c commit 589eaf6
Show file tree
Hide file tree
Showing 8 changed files with 2,156 additions and 767 deletions.
36 changes: 26 additions & 10 deletions .github/workflows/test-env-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v3

- name: Get API_URI
id: api_uri
Expand Down Expand Up @@ -241,8 +241,10 @@ jobs:
- name: Install Dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: NODE_OPTIONS=--max_old_space_size=4096 npm install

- name: Cypress run critical
uses: cypress-io/github-action@v4
if: ${{ ! cancelled() }}
uses: cypress-io/github-action@v5
env:
API_URI: ${{ steps.api_uri.outputs.custom_api_uri }}
APP_MOUNT_URI: ${{ secrets.APP_MOUNT_URI }}
Expand All @@ -251,26 +253,40 @@ jobs:
CYPRESS_SECOND_USER_NAME: ${{ secrets.CYPRESS_SECOND_USER_NAME }}
CYPRESS_USER_PASSWORD: ${{ secrets.CYPRESS_USER_PASSWORD }}
CYPRESS_PERMISSIONS_USERS_PASSWORD: ${{ secrets.CYPRESS_PERMISSIONS_USERS_PASSWORD }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
CYPRESS_MAILPITURL: ${{ secrets.CYPRESS_MAILPITURL }}
COMMIT_INFO_MESSAGE: ${{github.event.inputs.tags}} tests triggered on PR - https://github.com/${{ github.repository }}/pull/${{ github.ref_name }}
CYPRESS_grepTags: ${{ needs.prepare-tests.outputs.tags }}
SPLIT: ${{ strategy.job-total }}
SPLIT_INDEX: ${{ strategy.job-index }}
- name: Create reports dir
if: ${{ ! cancelled() }}
run: npm run qa:create-artifacts-dirs
- name: Move screenshots into reports dir
if: ${{ ! cancelled() }}
run: npm run qa:move-screenshots
- name: Move videos into reports dir
if: ${{ ! cancelled() }}
run: npm run qa:move-videos
- name: Merge report files
if: ${{ ! cancelled() }}
run: npm run qa:generate-html-report
- name: Upload reports
uses: actions/upload-artifact@v3
if: always()
with:
parallel: true
group: "UI - Chrome"
record: true
tag: Critical, ${{github.event.action}}
name: mochawesome-${{ strategy.job-index }}
path: ./cypress/reports/mochareports
- name: Install dependencies
if: ${{ ! cancelled() }}
working-directory: .github/workflows
run: npm ci
- name: Testmo threads submit
if: github.event.pull_request.head.repo.fork == false
if: github.event.pull_request.head.repo.fork == false && !cancelled()
working-directory: .github/workflows
run: |
npx testmo automation:run:submit-thread \
--instance "$TESTMO_URL" \
--run-id "$TESTMO_RUN_ID" \
--results ../../results/*.xml
--results ../../cypress/reports/junit/*.xml
env:
TESTMO_URL: ${{ secrets.TESTMO_URL }}
TESTMO_TOKEN: ${{ secrets.TESTMO_TOKEN }}
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ webpack-bundle.json
/templates/templated_email/compiled/*
!/templates/templated_email/compiled/.gitkeep
cypress/reports

cypress/TestResults
mochawesome.json
# Exported results file
django-queries-results.html

Expand Down
26 changes: 8 additions & 18 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ module.exports = defineConfig({
requestTimeout: 20000,
viewportWidth: 1400,
viewportHeight: 660,
screenshotsFolder: "cypress/reports/mochareports",
screenshotOnRunFailure: true,
retries: {
runMode: 1,
openMode: 0,
},
reporter: "junit",
reporter: "cypress-multi-reporters",
screenshotOnRunFailure: true,
reporterOptions: {
mochaFile: "results/test-output-[hash].xml",
jenkinsMode: true,
outputs: true,
testCaseSwitchClassnameAndName: true,
configFile: "reporter-config.json",
},
e2e: {
env: {
Expand All @@ -28,20 +28,10 @@ module.exports = defineConfig({
numTestsKeptInMemory: 10,
experimentalMemoryManagement: true,
},
setupNodeEvents(on, config) {
async setupNodeEvents(on, config) {
config = require("./cypress/support/cypress-grep/plugin")(config);
config = require("./cypress/plugins/index.js")(on, config);
on("after:spec", (spec, results) => {
if (results && results.video) {
return fs.unlink(results.video, function (err) {
if (err) {
console.warn(`Could not remove video - ${err}`);
} else {
console.log("File removed:", results.video);
}
});
}
});
config = await require("./cypress/plugins/index.js")(on, config);
config = require("cypress-split")(on, config);
return config;
},
specPattern: "cypress/e2e/**/*.{js,jsx,ts,tsx}",
Expand Down
2 changes: 0 additions & 2 deletions cypress/e2e/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
PERMISSION_GROUP_LIST_SELECTORS,
PLUGINS_LIST_SELECTORS,
PRODUCT_TYPES_LIST_SELECTORS,
SALES_SELECTORS,
SHIPPING_ZONES_LIST_SELECTORS,
STAFF_MEMBERS_LIST_SELECTORS,
VOUCHERS_SELECTORS,
Expand All @@ -43,7 +42,6 @@ describe("As a staff user I want to navigate through shop using different permis
cy.addAliasToGraphRequest("SaleList")
.clickOnElement(MENU_SELECTORS.MENU.discounts)
.waitForRequestAndCheckIfNoErrors("@SaleList");
cy.checkIfElementIsVisible(SALES_SELECTORS.createSaleButton);
},
);
it(
Expand Down
21 changes: 18 additions & 3 deletions cypress/support/e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@ import "./customCommands/softAssertions";
import "./customCommands/user";

import { commandTimings } from "cypress-timings";
import addContext from "mochawesome/addContext";

import {
BUTTON_SELECTORS,
CATEGORY_DETAILS_SELECTORS,
SHARED_ELEMENTS,
} from "../elements";
import { urlList } from "../fixtures/urlList";
import {
ensureCanvasStatic,
} from "../support/customCommands/sharedElementsOperations/canvas";
import { ensureCanvasStatic } from "../support/customCommands/sharedElementsOperations/canvas";
import cypressGrep from "../support/cypress-grep/support";

commandTimings();
Expand Down Expand Up @@ -168,3 +167,19 @@ Cypress.on(
// failing the test
false,
);

const titleToFileName = title => title.replace(/[:\/]/g, "");

Cypress.on("test:after:run", (test, runnable) => {
if (test.state === "failed") {
let parent = runnable.parent;
let filename = "";
while (parent && parent.title) {
filename = `${titleToFileName(parent.title)} -- ${filename}`;
parent = parent.parent;
}
filename += `${titleToFileName(test.title)} (failed).png`;
addContext({ test }, `${Cypress.spec.name}/${filename}`);
addContext({ test }, `videos/${Cypress.spec.name}.mp4`);
}
});
Loading

0 comments on commit 589eaf6

Please sign in to comment.