Skip to content

Commit

Permalink
Fix e2e test page selectors due to hds refactor (#2610)
Browse files Browse the repository at this point in the history
* chore: πŸ€– fix e2e broken tests due to hds refactor

* chore: πŸ€– remove unneeded change & fix another selector

* chore: πŸ€– upgrade playwright

* chore: πŸ€– remove unneeded dependency in desktop ui
  • Loading branch information
lisbet-alvarez authored Dec 11, 2024
1 parent 0b9c235 commit 0623d4a
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 53 deletions.
1 change: 0 additions & 1 deletion e2e-tests/admin/pages/auth-methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ export class AuthMethodsPage extends BaseResourcePage {

await this.page.getByRole('link', { name: 'Accounts' }).click();
await this.page
.getByRole('article')
.getByRole('link', { name: 'Create Account', exact: true })
.click();
await this.page.getByLabel('Name (Optional)').fill(accountName);
Expand Down
1 change: 0 additions & 1 deletion e2e-tests/admin/pages/groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export class GroupsPage extends BaseResourcePage {
async addMemberToGroup(userName) {
await this.page.getByRole('link', { name: 'Members', exact: true }).click();
await this.page
.getByRole('article')
.getByRole('link', { name: 'Add Members', exact: true })
.click();
await this.page.getByRole('checkbox', { name: userName }).click();
Expand Down
1 change: 0 additions & 1 deletion e2e-tests/admin/pages/roles.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export class RolesPage extends BaseResourcePage {
.getByRole('link', { name: 'Principals', exact: true })
.click();
await this.page
.getByRole('article')
.getByRole('link', { name: 'Add Principals', exact: true })
.click();
await this.page.getByRole('checkbox', { name: principalName }).click();
Expand Down
46 changes: 15 additions & 31 deletions e2e-tests/admin/pages/targets.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,18 +251,14 @@ export class TargetsPage extends BaseResourcePage {
).toBeVisible();

const emptyLinkIsVisible = await this.page
.getByRole('article')
.getByRole('link', { name: 'Add Host Sources', exact: true })
.isVisible();
if (emptyLinkIsVisible) {
await this.page
.getByRole('article')
.getByRole('link', { name: 'Add Host Sources', exact: true })
.click();
} else {
if (!emptyLinkIsVisible) {
await this.page.getByText('Manage').click();
await this.page.getByRole('link', { name: 'Add Host Sources' }).click();
}
await this.page
.getByRole('link', { name: 'Add Host Sources', exact: true })
.click();

await this.page
.getByRole('cell', { name: hostSourceName })
Expand Down Expand Up @@ -370,21 +366,15 @@ export class TargetsPage extends BaseResourcePage {
).toBeVisible();

const addBrokeredCredentialsButtonIsVisible = await this.page
.getByRole('article')
.getByRole('link', { name: 'Add Brokered Credentials', exact: true })
.isVisible();

if (addBrokeredCredentialsButtonIsVisible) {
await this.page
.getByRole('article')
.getByRole('link', { name: 'Add Brokered Credentials', exact: true })
.click();
} else {
if (!addBrokeredCredentialsButtonIsVisible) {
await this.page.getByText('Manage').click();
await this.page
.getByRole('link', { name: 'Add Brokered Credentials' })
.click();
}
await this.page
.getByRole('link', { name: 'Add Brokered Credentials', exact: true })
.click();

await this.page
.getByRole('cell', { name: credentialName })
Expand Down Expand Up @@ -427,27 +417,21 @@ export class TargetsPage extends BaseResourcePage {
).toBeVisible();

const addInjectedCredentialsButtonIsVisible = await this.page
.getByRole('article')
.getByRole('link', {
name: 'Add Injected Application Credentials',
exact: true,
})
.isVisible();

if (addInjectedCredentialsButtonIsVisible) {
await this.page
.getByRole('article')
.getByRole('link', {
name: 'Add Injected Application Credentials',
exact: true,
})
.click();
} else {
if (!addInjectedCredentialsButtonIsVisible) {
await this.page.getByText('Manage').click();
await this.page
.getByRole('link', { name: 'Add Injected Application' })
.click();
}
await this.page
.getByRole('link', {
name: 'Add Injected Application Credentials',
exact: true,
})
.click();

await this.page
.getByRole('cell', { name: credentialName })
Expand Down
1 change: 0 additions & 1 deletion e2e-tests/admin/pages/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export class UsersPage extends BaseResourcePage {
.getByRole('link', { name: 'Accounts', exact: true })
.click();
await this.page
.getByRole('article')
.getByRole('link', { name: 'Add Accounts', exact: true })
.click();
await this.page
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"devDependencies": {
"@babel/core": "^7.25.2",
"@babel/eslint-parser": "^7.21.3",
"@playwright/test": "^1.43.0",
"@playwright/test": "^1.49.0",
"concurrently": "^9.1.0",
"dotenv": "^16.4.5",
"eslint": "^8.54.0",
Expand Down
1 change: 0 additions & 1 deletion ui/admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
"@glimmer/component": "^1.1.2",
"@glimmer/tracking": "^1.1.2",
"@hashicorp/ember-asciinema-player": "https://github.com/hashicorp/ember-asciinema-player.git#e047a096039cff70234c232efe75dcad74c6358a",
"@playwright/test": "^1.43.0",
"babel-loader": "^9.2.1",
"broccoli-asset-rev": "^3.0.0",
"concurrently": "^9.1.0",
Expand Down
2 changes: 0 additions & 2 deletions ui/desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
"@faker-js/faker": "^8.0.2",
"@glimmer/component": "^1.1.2",
"@glimmer/tracking": "^1.1.2",
"@playwright/test": "^1.43.0",
"babel-loader": "^9.2.1",
"broccoli-asset-rev": "^3.0.0",
"concurrently": "^9.1.0",
Expand Down Expand Up @@ -99,7 +98,6 @@
"eslint-plugin-qunit": "^8.0.1",
"js-bexpr": "hashicorp/js-bexpr#9b4a4b54d85eba67fdfc0990133d1518d890b1e1",
"loader.js": "^4.7.0",
"playwright": "^1.43.0",
"prettier": "^3.0.0",
"qunit": "^2.22.0",
"qunit-dom": "^3.2.1",
Expand Down
28 changes: 14 additions & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4735,12 +4735,12 @@
mkdirp "^1.0.4"
rimraf "^3.0.2"

"@playwright/test@^1.43.0":
version "1.43.1"
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.43.1.tgz#16728a59eb8ce0f60472f98d8886d6cab0fa3e42"
integrity sha512-HgtQzFgNEEo4TE22K/X7sYTYNqEMMTZmFS8kTq6m8hXj+m1D8TgwgIbumHddJa9h4yl4GkKb8/bgAl2+g7eDgA==
"@playwright/test@^1.49.0":
version "1.49.0"
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.49.0.tgz#74227385b58317ee076b86b56d0e1e1b25cff01e"
integrity sha512-DMulbwQURa8rNIQrf94+jPJQ4FmOVdpE5ZppRNvWVjvhC+6sOeo28r8MgIpQRYouXRtt/FCCXU7zn20jnHR4Qw==
dependencies:
playwright "1.43.1"
playwright "1.49.0"

"@pnpm/constants@7.1.1":
version "7.1.1"
Expand Down Expand Up @@ -14919,17 +14919,17 @@ pkg-up@^3.1.0:
dependencies:
find-up "^3.0.0"

playwright-core@1.43.1:
version "1.43.1"
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.43.1.tgz#0eafef9994c69c02a1a3825a4343e56c99c03b02"
integrity sha512-EI36Mto2Vrx6VF7rm708qSnesVQKbxEWvPrfA1IPY6HgczBplDx7ENtx+K2n4kJ41sLLkuGfmb0ZLSSXlDhqPg==
playwright-core@1.49.0:
version "1.49.0"
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.49.0.tgz#8e69ffed3f41855b854982f3632f2922c890afcb"
integrity sha512-R+3KKTQF3npy5GTiKH/T+kdhoJfJojjHESR1YEWhYuEKRVfVaxH3+4+GvXE5xyCngCxhxnykk0Vlah9v8fs3jA==

playwright@1.43.1, playwright@^1.43.0:
version "1.43.1"
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.43.1.tgz#8ad08984ac66c9ef3d0db035be54dd7ec9f1c7d9"
integrity sha512-V7SoH0ai2kNt1Md9E3Gwas5B9m8KR2GVvwZnAI6Pg0m3sh7UvgiYhRrhsziCmqMJNouPckiOhk8T+9bSAK0VIA==
playwright@1.49.0:
version "1.49.0"
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.49.0.tgz#df6b9e05423377a99658202844a294a8afb95d0a"
integrity sha512-eKpmys0UFDnfNb3vfsf8Vx2LEOtflgRebl0Im2eQQnYMA4Aqd+Zw8bEOB+7ZKvN76901mRnqdsiOGKxzVTbi7A==
dependencies:
playwright-core "1.43.1"
playwright-core "1.49.0"
optionalDependencies:
fsevents "2.3.2"

Expand Down

0 comments on commit 0623d4a

Please sign in to comment.