-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogin.component.spec.ts
More file actions
33 lines (27 loc) · 1.07 KB
/
Copy pathlogin.component.spec.ts
File metadata and controls
33 lines (27 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { TestBed } from '@angular/core/testing';
import { testSetup } from 'core/utils/test/setup';
import { describe, expect, test } from 'vitest';
import { Locator, page } from 'vitest/browser';
import { LoginComponent } from './login.component';
describe('LoginComponent', () => {
let emailLocator: Locator;
let passwordLocator: Locator;
let submitButtonLocator: Locator;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [LoginComponent],
}).compileComponents();
testSetup(LoginComponent);
emailLocator = page.getByTestId('email');
passwordLocator = page.getByTestId('password');
submitButtonLocator = page.getByTestId('submit');
});
test('submit button should not be clickable if email or password is empty', async () => {
await expect.element(submitButtonLocator).toBeDisabled();
});
test('submit button should be clickable if email and password are provided', async () => {
await emailLocator.fill('test@example.com');
await passwordLocator.fill('password123');
await expect.element(submitButtonLocator).toBeEnabled();
});
});