From 841a51a7a07cb6176ceed776c88ebfb3077b480a Mon Sep 17 00:00:00 2001 From: Sergey Tatarintsev Date: Fri, 10 May 2024 12:49:29 +0200 Subject: [PATCH] Ensure that test actually fails when things are broken Test could never actually fail, because the only thing it doess is checks that `test_indicator` element exists and that element was shown regardless of test result. Fixed that by giving different test ids to success and failure indicators. At the moment, tests deliberately fail because custom databases are not supported. --- .github/workflows/update-and-publish.yml | 14 ++++++++++---- example/e2e/starter.test.js | 2 +- example/src/App.tsx | 4 ++-- example/src/db.ts | 1 + 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/update-and-publish.yml b/.github/workflows/update-and-publish.yml index a079545..ed00f03 100644 --- a/.github/workflows/update-and-publish.yml +++ b/.github/workflows/update-and-publish.yml @@ -7,7 +7,7 @@ on: type: string required: true version: - description: npm version to publish + description: client version to update to and publish type: string required: true secrets: @@ -19,10 +19,14 @@ on: inputs: npmTag: description: npm tag to publish to - type: string + type: choice + options: + - latest + - dev + - integration required: true version: - description: npm version to publish + description: client version to update to and publish type: string required: true @@ -93,7 +97,9 @@ jobs: run: yarn npm publish --tag "$NPM_TAG" - name: Push - run: git push origin main + env: + GITHUB_REF: ${{ github.ref }} + run: git push origin "$GITHUB_REF" notify-on-failure: name: Notify on publish failure diff --git a/example/e2e/starter.test.js b/example/e2e/starter.test.js index a1c5c14..876f7b0 100644 --- a/example/e2e/starter.test.js +++ b/example/e2e/starter.test.js @@ -9,6 +9,6 @@ describe('Example', () => { }); it('Show basic test passed indicator', async () => { - await expect(element(by.id('test_indicator'))).toBeVisible(); + await expect(element(by.id('test_indicator_success'))).toBeVisible(); }); }); diff --git a/example/src/App.tsx b/example/src/App.tsx index 88a7319..8b5e9ac 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -80,12 +80,12 @@ export default function App() { {e2eSuccess ? ( ) : ( )} diff --git a/example/src/db.ts b/example/src/db.ts index 0e331a2..f7c0b13 100644 --- a/example/src/db.ts +++ b/example/src/db.ts @@ -8,6 +8,7 @@ import Chance from 'chance'; const chance = new Chance(); const basePrisma = new PrismaClient({ + datasourceUrl: 'file:./my-custom.db', log: [{ emit: 'event', level: 'query' }], });