-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
36 changed files
with
2,139 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { $ } from '@wdio/globals' | ||
|
||
/** appBanner component */ | ||
class BannerComponent { | ||
content(content) { | ||
return $('[data-testid="app-banner-content"]*=' + content) | ||
} | ||
} | ||
|
||
export default new BannerComponent() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { $ } from '@wdio/globals' | ||
|
||
/** appEntityList component */ | ||
class EntityListComponent { | ||
content(content) { | ||
return $('[data-testid="app-entity-list"]*=' + content) | ||
} | ||
|
||
entityLink(content) { | ||
return $('[data-testid="app-entity-link"]*=' + content) | ||
} | ||
} | ||
|
||
export default new EntityListComponent() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { $ } from '@wdio/globals' | ||
|
||
/** | ||
* Form helper component | ||
*/ | ||
class FormComponent { | ||
form() { | ||
return $('form') | ||
} | ||
|
||
legend(content) { | ||
return $('legend*=' + content) | ||
} | ||
|
||
inputLabel(content) { | ||
return $('label*=' + content) | ||
} | ||
|
||
submitButton(content) { | ||
return $('button*=' + content) | ||
} | ||
} | ||
|
||
export default new FormComponent() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { $ } from '@wdio/globals' | ||
|
||
/** | ||
* govukSummaryList helper component | ||
*/ | ||
class GovukSummaryListComponent { | ||
content() { | ||
return $('[data-testid="govuk-summary-list"]') | ||
} | ||
|
||
row(testId) { | ||
return $(`[data-testid="govuk-summary-list"] [data-testid="${testId}"]`) | ||
} | ||
} | ||
|
||
export default new GovukSummaryListComponent() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { $ } from '@wdio/globals' | ||
|
||
/** @deprecated appHeading component */ | ||
class HeadingComponent { | ||
banner(content) { | ||
return $('[data-testid="app-banner-content"]*=' + content) | ||
} | ||
|
||
title(content) { | ||
return $('[data-testid="app-heading-title"]*=' + content) | ||
} | ||
|
||
caption(content) { | ||
return $( | ||
'[data-testid="app-heading-caption"]' + (content ? '*=' + content : '') | ||
) | ||
} | ||
} | ||
|
||
export default new HeadingComponent() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { $ } from '@wdio/globals' | ||
|
||
/** | ||
* Link helper component | ||
*/ | ||
class LinkComponent { | ||
/** | ||
* @param {string }testId | ||
* @param {string }content | ||
* @returns {*} | ||
*/ | ||
link(testId, content) { | ||
return $(`a[data-testid="${testId}"]*=` + content) | ||
} | ||
} | ||
|
||
export default new LinkComponent() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { $ } from '@wdio/globals' | ||
|
||
/** appPageHeading component */ | ||
class PageHeadingComponent { | ||
title(content) { | ||
return $('[data-testid="app-page-heading-title"]*=' + content) | ||
} | ||
|
||
caption(content) { | ||
return $( | ||
'[data-testid="app-page-heading-caption"]' + | ||
(content ? '*=' + content : '') | ||
) | ||
} | ||
|
||
cta(content) { | ||
return $('[data-testid="app-page-heading-cta"]*=' + content) | ||
} | ||
} | ||
|
||
export default new PageHeadingComponent() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { $ } from '@wdio/globals' | ||
|
||
/** appSplitPane component */ | ||
class SplitPaneComponent { | ||
content() { | ||
return $('[data-testid="app-split-pane"]') | ||
} | ||
|
||
subNavItem(navItemName) { | ||
return $(`[data-testid="app-subnav-item-${navItemName}"]`) | ||
} | ||
|
||
subNavItemLink(navItemName) { | ||
return $(`[data-testid="app-subnav-link-${navItemName}"]`) | ||
} | ||
|
||
async subNavIsActive(navItemName) { | ||
const subNavItemElem = await this.subNavItem(navItemName) | ||
const className = await subNavItemElem.getAttribute('class') | ||
|
||
return className.includes('app-subnav__section-item--current') | ||
} | ||
} | ||
|
||
export default new SplitPaneComponent() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { $ } from '@wdio/globals' | ||
|
||
/** appTabs component */ | ||
class TabsComponent { | ||
activeTab() { | ||
return $('[data-testid*="app-tabs-list-item--selected"]') | ||
} | ||
|
||
secondTab() { | ||
return $('[data-testid="app-tabs-list-item-2"]') | ||
} | ||
} | ||
|
||
export default new TabsComponent() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { browser } from '@wdio/globals' | ||
|
||
import AdminPage from 'page-objects/admin.page' | ||
import FormComponent from 'components/form.component' | ||
import LinkComponent from 'components/link.component' | ||
import LoginStubPage from 'page-objects/login-stub.page' | ||
|
||
async function createUser(searchTerm) { | ||
await LoginStubPage.loginAsAdmin() | ||
|
||
await AdminPage.open('/users/create') | ||
|
||
// AAD user | ||
await FormComponent.inputLabel('AAD users name or email').click() | ||
await browser.keys(searchTerm) | ||
await FormComponent.inputLabel(searchTerm).click() | ||
await FormComponent.submitButton('Next').click() | ||
|
||
// GitHub user | ||
await FormComponent.inputLabel('GitHub username').click() | ||
await browser.keys(searchTerm) | ||
await FormComponent.inputLabel(searchTerm).click() | ||
await FormComponent.submitButton('Next').click() | ||
|
||
// Skip user details | ||
await FormComponent.submitButton('Skip').click() | ||
|
||
// Create | ||
await FormComponent.submitButton('Create').click() | ||
|
||
await LoginStubPage.logOut() | ||
} | ||
|
||
async function deleteUser(username) { | ||
await LoginStubPage.loginAsAdmin() | ||
|
||
await AdminPage.open('/users') | ||
|
||
// Go to users page, then delete confirm page, then press delete | ||
await LinkComponent.link('app-entity-link', username).click() | ||
await LinkComponent.link('admin-delete-user', 'Delete user').click() | ||
await FormComponent.submitButton('Delete user').click() | ||
|
||
await LoginStubPage.logOut() | ||
} | ||
|
||
export { createUser, deleteUser } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { Page } from 'page-objects/page' | ||
import SplitPaneComponent from 'components/split-pane.component' | ||
import { $ } from '@wdio/globals' | ||
|
||
class AdminTeamPage extends Page { | ||
/** | ||
* Check if the user sub nav link is active | ||
* @returns {Promise<boolean>} | ||
*/ | ||
async subNavIsActive() { | ||
return await SplitPaneComponent.subNavIsActive('teams') | ||
} | ||
|
||
teamMembers() { | ||
return $('[data-testid="admin-team-members"]') | ||
} | ||
|
||
removeButton(name) { | ||
const listItem = $$('[data-testid="admin-team-members"] li').find( | ||
async (li) => { | ||
const textContent = await li.getText() | ||
|
||
return textContent.includes(name) | ||
} | ||
) | ||
|
||
return listItem.$('a[data-testid="app-link"]*=Remove') | ||
} | ||
} | ||
|
||
export default new AdminTeamPage() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Page } from 'page-objects/page' | ||
import SplitPaneComponent from 'components/split-pane.component' | ||
|
||
class AdminTeamsPage extends Page { | ||
/** | ||
* Check if the user sub nav link is active | ||
* @returns {Promise<boolean>} | ||
*/ | ||
async subNavIsActive() { | ||
return await SplitPaneComponent.subNavIsActive('teams') | ||
} | ||
|
||
open() { | ||
return super.open('/admin/teams') | ||
} | ||
} | ||
|
||
export default new AdminTeamsPage() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Page } from 'page-objects/page' | ||
|
||
class AdminPage extends Page { | ||
/** | ||
* Check if the admin nav link is active | ||
* @returns {Promise<boolean>} | ||
*/ | ||
navIsActive() { | ||
return super.navIsActive('admin') | ||
} | ||
|
||
open(value = '') { | ||
return super.open('/admin' + value) | ||
} | ||
} | ||
|
||
export default new AdminPage() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Page } from 'page-objects/page' | ||
|
||
class CreatePage extends Page { | ||
/** | ||
* Check if the create nav link is active | ||
* @returns {Promise<boolean>} | ||
*/ | ||
navIsActive() { | ||
return super.navIsActive('create') | ||
} | ||
|
||
open() { | ||
return super.open('/create') | ||
} | ||
} | ||
|
||
export default new CreatePage() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Page } from 'page-objects/page' | ||
|
||
class DeployPage extends Page { | ||
/** | ||
* Check if the deploy service nav link is active | ||
* @returns {Promise<boolean>} | ||
*/ | ||
navIsActive() { | ||
return super.navIsActive('deploy-service') | ||
} | ||
|
||
open() { | ||
return super.open('/deploy-service') | ||
} | ||
} | ||
|
||
export default new DeployPage() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Page } from 'page-objects/page' | ||
|
||
class DeploymentsPage extends Page { | ||
/** | ||
* Check if the deployments nav link is active | ||
* @returns {Promise<boolean>} | ||
*/ | ||
navIsActive() { | ||
return super.navIsActive('deployments') | ||
} | ||
|
||
open() { | ||
return super.open('/deployments') | ||
} | ||
} | ||
|
||
export default new DeploymentsPage() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { $ } from '@wdio/globals' | ||
|
||
import { Page } from 'page-objects/page' | ||
import HeadingComponent from 'components/heading.component' | ||
|
||
class ErrorPage extends Page { | ||
title(content) { | ||
return HeadingComponent.title(content) | ||
} | ||
|
||
message() { | ||
return $('[data-testid="error-message"]') | ||
} | ||
} | ||
|
||
export default new ErrorPage() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Page } from 'page-objects/page' | ||
import { $, browser, expect } from '@wdio/globals' | ||
|
||
class LoginStubPage extends Page { | ||
adminUserLink() { | ||
return $('a[id="admin"]*=' + 'Admin User') | ||
} | ||
|
||
nonAdminUserLink() { | ||
return $('a[id="nonAdmin"]*=' + 'Non-Admin User') | ||
} | ||
|
||
async loginAsAdmin() { | ||
await super.login() | ||
await this.onLoginStubsPage() | ||
return await this.adminUserLink().click() | ||
} | ||
|
||
async loginAsNonAdmin() { | ||
await super.login() | ||
await this.onLoginStubsPage() | ||
return await this.nonAdminUserLink().click() | ||
} | ||
|
||
onLoginStubsPage() { | ||
return expect(browser).toHaveTitle('CDP-Portal-Stubs - Login Stub') | ||
} | ||
} | ||
|
||
export default new LoginStubPage() |
Oops, something went wrong.