Skip to content

Commit

Permalink
add job matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
shashwatahalder01 committed Dec 12, 2024
1 parent 98d3958 commit 5290512
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/e2e_api_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ jobs:
tests:
name: e2e_api tests
runs-on: ubuntu-latest
strategy:
matrix:
test_group: [e2e_1, e2e_2]

steps:
- name: Checkout testing repo
Expand Down Expand Up @@ -161,13 +164,17 @@ jobs:
# npm run pw:deps-only

# Run e2e tests
- name: 🧪 Run e2e tests
- name: 🧪 Run e2e tests ${{ matrix.group }}
id: e2e-test
if: success() && (github.event_name != 'workflow_dispatch' || ( github.event_name == 'workflow_dispatch' && (github.event.inputs.testsuite == 'E2E' || github.event.inputs.testsuite == 'All')))
timeout-minutes: 40
working-directory: tests/pw
run: |
npm run test:e2e
if [[ "${{ matrix.group }}" == e2e_1 ]]; then
npx playwright test --project=${{ matrix.group }} --config=e2e.config.ts
elif [[ "${{ matrix.group }}" == a2e_2 ]]; then
npx playwright test --project=${{ matrix.group }} --config=e2e.config.ts
fi
# Run e2e coverage
- name: 🧪 Run e2e coverage
Expand Down
18 changes: 18 additions & 0 deletions tests/pw/e2e.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,24 @@ export default defineConfig({
// teardown: NO_SETUP ? undefined : 'coverage_report',
},


// e2e_tests
{
name: 'e2e_1',
testMatch: /.*\.spec\.ts/,
grep: [/@e2e_1/],
dependencies: NO_SETUP ? [] : ['e2e_setup'],
},


// e2e_tests
{
name: 'e2e_2',
testMatch: /.*\.spec\.ts/,
grep: [/@e2e_2/],
dependencies: NO_SETUP ? [] : ['e2e_setup'],
},

// coverage_report
{
name: 'coverage_report',
Expand Down
4 changes: 2 additions & 2 deletions tests/pw/tests/e2e/admin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { LoginPage } from '@pages/loginPage';
import { data } from '@utils/testData';

test.describe('Admin functionality test', () => {
test('admin can login', { tag: ['@lite', '@admin'] }, async ({ page }) => {
test('admin can login', { tag: ['@lite', '@admin', '@e2e_1'] }, async ({ page }) => {
const loginPage = new LoginPage(page);
await loginPage.adminLogin(data.admin);
});

test('admin can logout', { tag: ['@lite', '@admin'] }, async ({ page }) => {
test('admin can logout', { tag: ['@lite', '@admin', '@e2e_2'] }, async ({ page }) => {
const loginPage = new LoginPage(page);
await loginPage.adminLogin(data.admin);
await loginPage.logoutBackend();
Expand Down

0 comments on commit 5290512

Please sign in to comment.