Skip to content

Commit

Permalink
fix: avoid the nullsy values & fix assertions time
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio Florez authored and Sergio Florez committed Feb 3, 2025
1 parent 25b45f0 commit 4f93c2a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
4 changes: 2 additions & 2 deletions tests/helpers/loginUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export async function loginUser(
password: string
) {
await goToPage(page, 'login');
await page.fill('input[id="username"]', username);
await page.fill('input[id="passwordInput"]', password);
await page.fill('input[id="username"]', username!);
await page.fill('input[id="passwordInput"]', password!);

let totp = new OTPAuth.TOTP({
issuer: 'ACME',
Expand Down
24 changes: 18 additions & 6 deletions tests/initialInquiry/initialInquiry.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect, test } from '@playwright/test';
import { registerUser } from '../helpers/registerUser';
import { loginUser } from '../helpers/loginUser';

test.describe.serial('Run tests in sequence', () => {
test.describe.serial('Create initial inquiry', () => {
test('Send initial msg request', async ({ page }) => {
await registerUser(page);

Expand Down Expand Up @@ -39,14 +39,21 @@ test.describe.serial('Run tests in sequence', () => {
await page.locator('rect').click();
await page.locator('button.button__autoClose').click();

// assert further steps info
// assert further steps info & msg
await expect(page.locator('div.e2eeActivatedMessage')).toBeVisible();
await expect(page.locator('div.furtherSteps')).toBeVisible();
await expect(page.locator('ul.furtherSteps__steps')).toBeVisible();
await expect(
page.locator('p.furtherSteps__infoText').first()
).toBeVisible();

const messageText = await page.locator(
'.messageItem__message.messageItem__message--myMessage p'
);
await expect(messageText).toBeVisible();
await expect(messageText).not.toBeEmpty();

// logout
await page
.locator(
'div.navigation__item__bottom div.navigation__item:last-of-type'
Expand All @@ -69,7 +76,12 @@ test.describe.serial('Run tests in sequence', () => {

await page.locator('a.navigation__item:first-of-type').click();

const sessionItems = page.locator('div.sessionsListItem');
await page.waitForSelector('.listInfo__illustration');
await page.waitForSelector('div[data-cy="session-list-item"]');

const sessionItems = await page.locator(
'div[data-cy="session-list-item"]'
);

if ((await sessionItems.count()) > 0) {
await sessionItems.last().click();
Expand All @@ -80,9 +92,9 @@ test.describe.serial('Run tests in sequence', () => {
await expect(acceptRequestButton).toBeVisible();
await acceptRequestButton.click();
await page.waitForSelector('div.overlay');
await page.locator(
'div.overlay button.button__item.button__primary'
);
await page
.locator('div.overlay button.button__item.button__primary')
.click();
} else {
throw new Error('No initial messages found for this consultant!');
}
Expand Down

0 comments on commit 4f93c2a

Please sign in to comment.