diff --git a/.github/workflows/testomatio b/.github/workflows/testomatio deleted file mode 100644 index 1475c0c2..00000000 --- a/.github/workflows/testomatio +++ /dev/null @@ -1,27 +0,0 @@ -# used for Testomatio CI functionality testing - -name: testomatio-ci-test - -on: - workflow_dispatch: - inputs: - grep: - description: 'tests to grep' - required: false - default: '' - run: - required: false - testomatio: - required: false - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - - run: npm ci - - run: npx playwright test --grep "${{ github.event.inputs.grep }}" - env: - TESTOMATIO: "${{ github.event.inputs.testomatio }}" - TESTOMATIO_RUN: "${{ github.event.inputs.run }}" diff --git a/.github/workflows/testomatio.yml b/.github/workflows/testomatio.yml new file mode 100644 index 00000000..1b9bbc86 --- /dev/null +++ b/.github/workflows/testomatio.yml @@ -0,0 +1,37 @@ +# used for Testomatio CI functionality testing + +name: testomatio-ci-test + +on: + workflow_dispatch: + inputs: + grep: + description: 'tests to grep' + required: false + default: '' + run: + required: false + default: '' + testomatio: + required: false + default: '' + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + + - run: npm ci + + - run: npx playwright install --with-deps + + - run: npx playwright test --grep "${{ github.event.inputs.grep }}" + env: + TESTOMATIO: "${{ github.event.inputs.testomatio }}" + TESTOMATIO_RUN: "${{ github.event.inputs.run }}" \ No newline at end of file diff --git a/ci-test/.gitignore b/ci-test/.gitignore new file mode 100644 index 00000000..8461164f --- /dev/null +++ b/ci-test/.gitignore @@ -0,0 +1,7 @@ +node_modules/ +test-results/ +playwright-report/ +.env +/test-results/ +/playwright-report/ +/playwright/.cache/ diff --git a/ci-test/package.json b/ci-test/package.json new file mode 100644 index 00000000..70c5cd2f --- /dev/null +++ b/ci-test/package.json @@ -0,0 +1,15 @@ +{ + "name": "Playwright tests with TESTOMATIO", + "version": "1.1.1", + "description": "Running and Monitoring Playwright tests with TESTOMATIO Reporter and Bitbucket Pipeline", + "main": "index.js", + "scripts": { + "test": "npx playwright test" + }, + "license": "ISC", + "dependencies": { + "@playwright/test": "^1.46.1", + "@testomatio/reporter": "^2.6.0", + "dotenv": "^16.4.5" + } +} diff --git a/ci-test/playwright.config.ts b/ci-test/playwright.config.ts new file mode 100644 index 00000000..59416026 --- /dev/null +++ b/ci-test/playwright.config.ts @@ -0,0 +1,34 @@ +import { PlaywrightTestConfig, devices } from '@playwright/test'; +import 'dotenv/config' + +// Reference: https://playwright.dev/docs/test-configuration +const config: PlaywrightTestConfig = { + timeout: 300 * 1000, + retries: process.env.CI ? 0 : 0, + fullyParallel: true, + reporter: [ + ['list'], + ['json'], + ['@testomatio/reporter/playwright', { + apiKey: process.env.TESTOMATIO, + }] + ], + + use: { + trace: 'retain-on-failure', + contextOptions: { + ignoreHTTPSErrors: true, + }, + + screenshot: 'on', + }, + projects: [ + { + name: 'Desktop Chrome', + use: { + ...devices['Desktop Chrome'], + }, + }, + ] +}; +export default config; diff --git a/ci-test/tests/shard.test.ts b/ci-test/tests/shard.test.ts new file mode 100644 index 00000000..a9ec8f27 --- /dev/null +++ b/ci-test/tests/shard.test.ts @@ -0,0 +1,28 @@ +import { test, expect } from '@playwright/test' + +test.describe("Suite 1 @Sff5e0016", () => { + test('Test 1 (10 seconds) @Tbd91a4a2', async () => { + console.log('Test 1 (10 seconds) started: ' + new Date().toLocaleString()); + // await new Promise(resolve => setTimeout(resolve, 10_000)); + expect(1 + 1).toBe(2) + console.log('Test 1 (10 seconds) finished: ' + new Date().toLocaleString()); + }); + test('Test 2 (110 seconds) @Tec827edd', async () => { + console.log('Test 2 (110 seconds) started: ' + new Date().toLocaleString()); + // await new Promise(resolve => setTimeout(resolve, 110_000)); + expect(1 + 1).toBe(2) + console.log('Test 2 (110 seconds) finished: ' + new Date().toLocaleString()); + }); + test('Test 3 (120 seconds) @T0cbac05e', async () => { + console.log('Test 3 (120 seconds) started: ' + new Date().toLocaleString()); + // await new Promise(resolve => setTimeout(resolve, 120_000)); + expect(1 + 1).toBe(2) + console.log('Test 3 (120 seconds) finished: ' + new Date().toLocaleString()); + }); + test('Test 4 (150 seconds) @T96632266', async () => { + console.log('Test 4 (150 seconds) started: ' + new Date().toLocaleString()); + // await new Promise(resolve => setTimeout(resolve, 150_000)); + expect(1 + 1).toBe(2) + console.log('Test 4 (150 seconds) finished: ' + new Date().toLocaleString()); + }); +});