The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Playwright tests - stage 1 - login with email and password test (#8988)
BOHEUS182ebb639413
diff --git a/packages/twenty-e2e-testing/.env.example b/packages/twenty-e2e-testing/.env.exampleindex 29209f8c8d4..e0fbc4a3227 100644--- a/packages/twenty-e2e-testing/.env.example+++ b/packages/twenty-e2e-testing/.env.example@@ -1,5 +1,5 @@# Note that provide always without trailing forward slash to have expected behaviour-FRONTEND_BASE_URL=http://localhost:3001+FRONTEND_BASE_URL=http://app.localhost:3001CI_DEFAULT_BASE_URL=https://demo.twenty.comdiff --git a/packages/twenty-e2e-testing/lib/pom/loginPage.ts b/packages/twenty-e2e-testing/lib/pom/loginPage.tsindex dc60d3f7a79..15aa1ca2227 100644--- a/packages/twenty-e2e-testing/lib/pom/loginPage.ts+++ b/packages/twenty-e2e-testing/lib/pom/loginPage.ts@@ -10,7 +10,7 @@ export class LoginPage {private readonly forgotPasswordButton: Locator;private readonly passwordField: Locator;private readonly revealPasswordButton: Locator;- private readonly signInButton: Locator;+ readonly signInButton: Locator;private readonly signUpButton: Locator;private readonly previewImageButton: Locator;private readonly uploadImageButton: Locator;diff --git a/packages/twenty-e2e-testing/playwright.config.ts b/packages/twenty-e2e-testing/playwright.config.tsindex 964b31e3210..f3aafad006f 100644--- a/packages/twenty-e2e-testing/playwright.config.ts+++ b/packages/twenty-e2e-testing/playwright.config.ts@@ -16,12 +16,12 @@ export default defineConfig({fullyParallel: true, // false only for specific tests, overwritten in specific projects or global setups of projectsforbidOnly: !!process.env.CI,retries: process.env.CI ? 2 : 0,- workers: process.env.CI ? 1 : undefined, // undefined = amount of projects * amount of tests+ workers: 1, // 1 worker = 1 test at the time, tests can't be parallelizedtimeout: 30 * 1000, // timeout can be changeduse: {baseURL: process.env.CI? process.env.CI_DEFAULT_BASE_URL- : (process.env.FRONTEND_BASE_URL ?? 'http://localhost:3001'),+ : (process.env.FRONTEND_BASE_URL ?? 'http://app.localhost:3001'),trace: 'retain-on-failure', // trace takes EVERYTHING from page source, records every single step, should be used only when normal debugging won't workscreenshot: 'on', // either 'on' here or in different method in modules, if 'on' all screenshots are overwritten each time the test is runheadless: true, // instead of changing it to false, run 'yarn test:e2e:debug' or 'yarn test:e2e:ui'@@ -56,6 +56,10 @@ export default defineConfig({},dependencies: ['Login setup'],},+ {+ name: 'Authentication',+ testMatch: /authentication\/.*\.spec\.ts/,+ },//{// name: 'webkit',diff --git a/packages/twenty-e2e-testing/tests/authentication/login.spec.ts b/packages/twenty-e2e-testing/tests/authentication/login.spec.tsnew file mode 100644index 00000000000..a898cf0d933--- /dev/null+++ b/packages/twenty-e2e-testing/tests/authentication/login.spec.ts@@ -0,0 +1,17 @@+import { test as base, expect } from '../../lib/fixtures/screenshot';+import { LoginPage } from '../../lib/pom/loginPage';++// fixture+const test = base.extend<{ loginPage: LoginPage }>({+ loginPage: async ({ page }, use) => {+ await use(new LoginPage(page));+ },+});++test('Check login with email', async ({ loginPage }) => {+ await loginPage.typeEmail(process.env.DEFAULT_LOGIN);+ await loginPage.clickContinueButton();+ await loginPage.typePassword(process.env.DEFAULT_PASSWORD);+ await loginPage.clickSignInButton();+ await expect(loginPage.signInButton).not.toBeVisible();+});