Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: refactor tests #863

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/e2e/lib/genericadminpage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Locator, Page } from '@playwright/test';
import type { Locator, Page } from '@playwright/test';

const selectors = {
menuBarMyAccount: '#wp-admin-bar-my-account',
Expand Down
10 changes: 1 addition & 9 deletions tests/e2e/lib/loginpage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Locator, Page } from '@playwright/test';
import type { Locator, Page } from '@playwright/test';

const selectors = {
userField: '#user_login',
Expand Down Expand Up @@ -37,16 +37,8 @@ export class LoginPage {
}

public async login(username: string, password: string): Promise<void> {
await this.userFieldLocator.click();
// eslint-disable-next-line playwright/no-wait-for-timeout
await this.page.waitForTimeout(60);
await this.userFieldLocator.fill(username);
await this.passwordFieldLocator.click();
// eslint-disable-next-line playwright/no-wait-for-timeout
await this.page.waitForTimeout(60);
await this.passwordFieldLocator.fill(password);
// eslint-disable-next-line playwright/no-wait-for-timeout
await this.page.waitForTimeout(60);
await this.submitButtonLocator.click();
await this.page.waitForLoadState('domcontentloaded');
}
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/lib/profilepage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Locator, Page, Response } from '@playwright/test';
import type { Locator, Page, Response } from '@playwright/test';

const selectors = {
twoFactorOptions: '#two-factor-options',
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/lib/test-helpers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Page, CDPSession, expect } from '@playwright/test';
import { type Page, type CDPSession, expect } from '@playwright/test';
import { LoginPage } from './loginpage';
import type { Protocol } from 'playwright-core/types/protocol';
import { ProfilePage } from './profilepage';
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/lib/webauthsettingspage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Locator, Page } from '@playwright/test';
import type { Locator, Page } from '@playwright/test';

const selectors = {
authenticatorAttachment: '#authenticator_attachment',
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/specs/login.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, expect, CDPSession } from '@playwright/test';
import { test, expect, type CDPSession } from '@playwright/test';
import { LoginPage } from '../lib/loginpage';
import { ProfilePage } from '../lib/profilepage';
import { GenericAdminPage } from '../lib/genericadminpage';
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/specs/rename.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, expect, CDPSession } from '@playwright/test';
import { test, expect, type CDPSession } from '@playwright/test';
import settings from '../e2e-settings';
import { addVirtualAuthenticator, clearCredentials, removeVirtualAuthenticator } from '../lib/webauthn-helpers';
import { login, registerKey } from '../lib/test-helpers';
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/specs/revoke.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, expect, CDPSession } from '@playwright/test';
import { test, expect, type CDPSession } from '@playwright/test';
import settings from '../e2e-settings';
import { addVirtualAuthenticator, removeVirtualAuthenticator } from '../lib/webauthn-helpers';
import { login, registerKey } from '../lib/test-helpers';
Expand Down
Loading