From 4fa9adfc7d7b74b763db0ec8a2c5e6220be1496f Mon Sep 17 00:00:00 2001 From: Simon Larsen Date: Thu, 13 Jun 2024 18:49:19 +0100 Subject: [PATCH] refactor: Update login test to handle missing user credentials The login test in Login.spec.ts has been updated to handle cases where the user credentials (email and password) are missing. Previously, the test would only check if the user is registered, but now it also checks if the registered user email and password are available. This change ensures that the test behaves correctly in all scenarios and improves the reliability of the login functionality. --- E2E/Tests/Accounts/Login.spec.ts | 2 +- E2E/package-lock.json | 8 ++++---- E2E/package.json | 3 ++- config.example.env | 2 +- docker-compose.base.yml | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/E2E/Tests/Accounts/Login.spec.ts b/E2E/Tests/Accounts/Login.spec.ts index dbdb15a0d4..c9bc57160b 100644 --- a/E2E/Tests/Accounts/Login.spec.ts +++ b/E2E/Tests/Accounts/Login.spec.ts @@ -9,7 +9,7 @@ import URL from 'Common/Types/API/URL'; test.describe('Login', () => { test('should be able to login', async ({ page }: { page: Page }) => { - if (!IS_USER_REGISTERED) { + if (!IS_USER_REGISTERED || !REGISTERED_USER_EMAIL || !REGISTERED_USER_PASSWORD) { // pass this test if the user is not registered return; } diff --git a/E2E/package-lock.json b/E2E/package-lock.json index 158d51f54b..56b0428c24 100644 --- a/E2E/package-lock.json +++ b/E2E/package-lock.json @@ -1,11 +1,11 @@ { - "name": "@oneuptime/tests", + "name": "@oneuptime/e2e", "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "@oneuptime/tests", + "name": "@oneuptime/e2e", "version": "1.0.0", "hasInstallScript": true, "license": "Apache-2.0", @@ -26,12 +26,12 @@ "dependencies": { "@types/crypto-js": "^4.2.2", "@types/uuid": "^8.3.4", - "axios": "^1.6.8", + "axios": "^1.7.2", "crypto-js": "^4.1.1", "json5": "^2.2.3", "moment": "^2.30.1", "moment-timezone": "^0.5.45", - "posthog-js": "^1.116.6", + "posthog-js": "^1.133.0", "reflect-metadata": "^0.2.2", "slugify": "^1.6.5", "typeorm": "^0.3.20", diff --git a/E2E/package.json b/E2E/package.json index 28b9905ce6..645e0a70e2 100644 --- a/E2E/package.json +++ b/E2E/package.json @@ -8,7 +8,8 @@ "test": "playwright test || (curl $E2E_TESTS_FAILED_WEBHOOK_URL && exit 1)", "dep-check": "npm install -g depcheck && depcheck ./ --skip-missing=true", "clear-modules": "rm -rf node_modules && rm package-lock.json && npm install", - "compile": "tsc" + "compile": "tsc", + "debug-tests": "playwright test --debug" }, "keywords": [], "author": "OneUptime (https://oneuptime.com/)", diff --git a/config.example.env b/config.example.env index dd59c1e1d4..a865e87d2b 100644 --- a/config.example.env +++ b/config.example.env @@ -200,7 +200,7 @@ LOG_LEVEL=ERROR # Thse env vars are for E2E tests E2E_TEST_IS_USER_REGISTERED=false -E2E_TEST_REGISERED_USER_EMAIL= +E2E_TEST_REGISTERED_USER_EMAIL= E2E_TEST_REGISTERED_USER_PASSWORD= # If you want to run the E2E tests on a status page, then you need to fill in the URL. E2E_TEST_STATUS_PAGE_URL= diff --git a/docker-compose.base.yml b/docker-compose.base.yml index ec7cefe798..c2ba5bdcef 100644 --- a/docker-compose.base.yml +++ b/docker-compose.base.yml @@ -354,7 +354,7 @@ services: environment: <<: *common-variables E2E_TEST_IS_USER_REGISTERED: ${E2E_TEST_IS_USER_REGISTERED} - E2E_TEST_REGISERED_USER_EMAIL: ${E2E_TEST_REGISERED_USER_EMAIL} + E2E_TEST_REGISTERED_USER_EMAIL: ${E2E_TEST_REGISTERED_USER_EMAIL} E2E_TEST_REGISTERED_USER_PASSWORD: ${E2E_TEST_REGISTERED_USER_PASSWORD} E2E_TEST_STATUS_PAGE_URL: ${E2E_TEST_STATUS_PAGE_URL} E2E_TESTS_FAILED_WEBHOOK_URL: ${E2E_TESTS_FAILED_WEBHOOK_URL}