-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into remove-plugins-legacy-message
- Loading branch information
Showing
83 changed files
with
2,089 additions
and
520 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"saleor-dashboard": patch | ||
--- | ||
|
||
Add results to testmo, add notification on slack after tests run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"saleor-dashboard": minor | ||
--- | ||
|
||
Add playwright tests for edit and remove product types |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"saleor-dashboard": minor | ||
--- | ||
|
||
Introduce view for manual refund transaction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"saleor-dashboard": minor | ||
--- | ||
|
||
Fixing assertions in flaky Playwright tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"saleor-dashboard": minor | ||
--- | ||
|
||
Show all transaction in manual refund view, disabled those that are not refundable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
"saleor-dashboard": minor | ||
--- | ||
|
||
# Optimizing playwright setup and playwright.config.ts files | ||
|
||
-Adding a conditioning to auth.setup.ts file to use existing auth json file if it's applicable | ||
-Added some optimizations to playwright config file | ||
-Cleaned up gh action for playwright tests (removed Cypress references) | ||
-Updating gh workflow for PR automation with extra test sharding | ||
-General cleanup of redundant code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
57 changes: 57 additions & 0 deletions
57
.github/actions/testmo/testmo-threads-submit-playwright/action.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: submit-run-results-to-testmo | ||
description: "Sends tests results from run to testmo" | ||
inputs: | ||
testmoUrl: | ||
description: "Testmo project URL" | ||
required: true | ||
testmoToken: | ||
description: "Testmo token" | ||
required: true | ||
testmoRunId: | ||
description: "Parallelized job Testmo run id" | ||
required: true | ||
runs: | ||
using: composite | ||
steps: | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: ".nvmrc" | ||
cache: npm | ||
- name: Cache node modules | ||
uses: actions/cache@v3 | ||
env: | ||
cache-name: cache-node-modules | ||
with: | ||
path: ~/.npm | ||
key: ${{ runner.os }}-qa-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-qa-${{ env.cache-name }}- | ||
${{ runner.os }}-qa- | ||
${{ runner.os }}- | ||
- name: Install Dependencies | ||
if: steps.cache-node-modules.outputs.cache-hit != 'true' | ||
shell: bash | ||
run: NODE_OPTIONS=--max_old_space_size=4096 npm install | ||
|
||
- name: Install dependencies | ||
if: ${{ ! cancelled() }} | ||
working-directory: .github/workflows | ||
shell: bash | ||
run: npm ci | ||
|
||
- name: Submit results | ||
working-directory: .github/workflows | ||
shell: bash | ||
run: | | ||
npx testmo automation:run:submit-thread \ | ||
--instance "$TESTMO_URL" \ | ||
--run-id "$TESTMO_RUN_ID" \ | ||
--results ../../testmo/testmo.xml | ||
env: | ||
TESTMO_URL: ${{ inputs.testmoUrl }} | ||
TESTMO_TOKEN: ${{ inputs.testmoToken }} | ||
TESTMO_RUN_ID: ${{ inputs.testmoRunId}} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
const { Command } = require("commander"); | ||
const program = new Command(); | ||
const { Octokit } = require("@octokit/core"); | ||
|
||
program | ||
.name("Send tests results") | ||
.description( | ||
"Get tests results from testmo and post message to slack or on release PR", | ||
) | ||
.option("--run_id <run_id>", "Testmo run id") | ||
.option( | ||
"--testmo_token <testmo_token>", | ||
"Bearer token for authorization in testmo", | ||
) | ||
.option( | ||
"--slack_webhook_url <slack_webhook_url>", | ||
"Should send notification on slack", | ||
) | ||
.option("--environment <environment>", "Environment") | ||
.option("--url_to_action <url_to_action>", "Url to enter github action") | ||
.option("--ref_name <ref_name>", "Ref to point where tests where run") | ||
.action(async options => { | ||
const runId = options.run_id; | ||
const testmoAuthToken = options.testmo_token; | ||
const testsResults = await getTestsStatus(runId, testmoAuthToken); | ||
const testsStatus = convertResults( | ||
testsResults, | ||
options.environment, | ||
options.ref_name, | ||
); | ||
|
||
await sendMessageOnSlack( | ||
testsStatus, | ||
options.slack_webhook_url, | ||
options.url_to_action, | ||
); | ||
}) | ||
.parse(); | ||
|
||
async function getTestsStatus(runId, testmoToken) { | ||
const runResult = await fetch( | ||
`https://saleor.testmo.net/api/v1/automation/runs/${runId}`, | ||
{ | ||
headers: { | ||
Authorization: `Bearer ${testmoToken}`, | ||
}, | ||
}, | ||
); | ||
return await runResult.json(); | ||
} | ||
|
||
function convertResults(results, environment, refName) { | ||
let status = results?.result?.status === 2 ? "SUCCESS" : "FAILURE"; | ||
let message = `Tests run on environment: \n${environment}\n`; | ||
const linkToResults = `https:\/\/saleor.testmo.net\/automation\/runs\/view\/${results.result.id}`; | ||
const threads = results.result.threads; | ||
|
||
if (Array.isArray(threads)) { | ||
const failureCount = threads | ||
.map(thread => thread.failure_count) | ||
.reduce((accumulator, currentValue) => accumulator + currentValue, 0); | ||
|
||
const successCount = threads | ||
.map(thread => thread.success_count) | ||
.reduce((accumulator, currentValue) => accumulator + currentValue, 0); | ||
|
||
const skippedCount = threads | ||
.map(thread => thread.total_count - thread.completed_count) | ||
.reduce((accumulator, currentValue) => accumulator + currentValue, 0); | ||
|
||
if (failureCount > 0) { | ||
message += `${failureCount} tests failed. `; | ||
} | ||
if (successCount > 0) { | ||
message += `${successCount} tests passed. `; | ||
} | ||
if (skippedCount > 0) { | ||
message += `${skippedCount} tests skipped. `; | ||
} | ||
} else { | ||
status = "FAILURE"; | ||
message = "Empty test run. "; | ||
} | ||
|
||
message += `See results at ${linkToResults}`; | ||
|
||
return { | ||
status, | ||
message, | ||
title: `Playwright tests run on ${refName}`, | ||
linkToResults, | ||
}; | ||
} | ||
|
||
async function sendMessageOnSlack(testsStatus, webhookUrl, urlToAction) { | ||
const JOB_STATUS_COLOR_MAP = { | ||
SUCCESS: "#5DC292", | ||
FAILURE: "#FE6E76", | ||
}; | ||
|
||
const messageData = { | ||
attachments: [ | ||
{ | ||
fallback: testsStatus.message, | ||
pretext: testsStatus.status, | ||
title: testsStatus.title, | ||
title_link: urlToAction, | ||
text: testsStatus.message, | ||
color: JOB_STATUS_COLOR_MAP[testsStatus.status], | ||
}, | ||
], | ||
}; | ||
await fetch(webhookUrl, { | ||
body: JSON.stringify(messageData), | ||
method: "post", | ||
headers: { "content-type": "application/json" }, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.