Skip to content

Commit

Permalink
Merge pull request #863 from sjinks/refactor-tests
Browse files Browse the repository at this point in the history
test: refactor tests
  • Loading branch information
sjinks authored Sep 9, 2024
2 parents 05acf40 + 9b1e966 commit 95413f4
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 16 deletions.
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

0 comments on commit 95413f4

Please sign in to comment.