Skip to content
Merged
8 changes: 3 additions & 5 deletions apps/meteor/tests/e2e/01-forgot-password.spec.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import { Page, test, expect } from '@playwright/test';
import { test, expect } from '@playwright/test';

import { Auth } from './page-objects';

test.describe('Forgot Password', () => {
let page: Page;
let pageAuth: Auth;

test.beforeAll(async ({ browser }) => {
page = await browser.newPage();
test.beforeEach(async ({ page }) => {
pageAuth = new Auth(page);
});

test.beforeAll(async () => {
test.beforeEach(async ({ page }) => {
await page.goto('/');
await pageAuth.btnForgotPassword.click();
});
Expand Down
8 changes: 3 additions & 5 deletions apps/meteor/tests/e2e/02-register.spec.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
import { Page, test, expect } from '@playwright/test';
import { test, expect } from '@playwright/test';
import { faker } from '@faker-js/faker';

import { Auth } from './page-objects';

test.describe('Register', () => {
let page: Page;
let pageAuth: Auth;

test.beforeAll(async ({ browser }) => {
page = await browser.newPage();
test.beforeEach(async ({ page }) => {
pageAuth = new Auth(page);
});

test.beforeEach(async () => {
test.beforeEach(async ({ page }) => {
await page.goto('/');
await pageAuth.btnRegister.click();
});
Expand Down
9 changes: 3 additions & 6 deletions apps/meteor/tests/e2e/03-login.spec.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
import { Page, test, expect } from '@playwright/test';
import { test, expect } from '@playwright/test';
import { faker } from '@faker-js/faker';

import { Auth } from './page-objects';

test.describe('Login', () => {
let page: Page;
let pageAuth: Auth;

test.beforeAll(async ({ browser }) => {
page = await browser.newPage();
test.beforeEach(async ({ page }) => {
pageAuth = new Auth(page);
await page.goto('/');
});

test('expect to show a toast if the provided password is incorrect', async () => {
await page.goto('/');

await pageAuth.inputEmailOrUsername.type(faker.internet.email());
await pageAuth.inputPassword.type('any_password');
await pageAuth.btnSubmit.click();
Expand Down
12 changes: 5 additions & 7 deletions apps/meteor/tests/e2e/05-channel-creation.spec.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
import { Page, test, expect } from '@playwright/test';
import { test, expect } from '@playwright/test';
import { faker } from '@faker-js/faker';

import { HomeChannel, Auth } from './page-objects';

test.describe('Channel Creation', () => {
let page: Page;
let pageAuth: Auth;
let pageHomeChannel: HomeChannel;

test.beforeAll(async ({ browser }) => {
page = await browser.newPage();
test.beforeEach(async ({ page }) => {
pageAuth = new Auth(page);
pageHomeChannel = new HomeChannel(page);
});

test.beforeAll(async () => {
test.beforeEach(async () => {
await pageAuth.doLogin();
});

test('expect create public channel', async () => {
test('expect create public channel', async ({ page }) => {
const name = faker.animal.type() + Date.now();

await pageHomeChannel.sidenav.btnCreate.click();
Expand All @@ -30,7 +28,7 @@ test.describe('Channel Creation', () => {
await expect(page).toHaveURL(`/channel/${name}`);
});

test('expect create private channel', async () => {
test('expect create private channel', async ({ page }) => {
const name = faker.animal.type() + Date.now();

await pageHomeChannel.sidenav.btnCreate.click();
Expand Down
Loading