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.
This commit is contained in:
Simon Larsen 2024-06-13 18:49:19 +01:00
parent 3e2e581e52
commit 4fa9adfc7d
No known key found for this signature in database
GPG Key ID: 96C5DCA24769DBCA
5 changed files with 9 additions and 8 deletions

View File

@ -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;
}

8
E2E/package-lock.json generated
View File

@ -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",

View File

@ -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 <hello@oneuptime.com> (https://oneuptime.com/)",

View File

@ -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=

View File

@ -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}