-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CLD-637] E2E test install app happy path (#252)
- Loading branch information
Showing
14 changed files
with
255 additions
and
32 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 @@ | ||
export default { | ||
actions: { | ||
clickAppCardWithName(name: string) { | ||
return cy.get(`div[data-test-app-name="${name}"]`).click() | ||
}, | ||
clickAppCardSettingWithId(id: string) { | ||
return cy.get(`div[data-test="app-settings_${id}"]`).click() | ||
} | ||
} | ||
} |
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,13 @@ | ||
export default { | ||
selectors: { | ||
buttonInstallApp: 'button[data-test="detail-modal-install-button"]', | ||
buttonUninstallApp: 'button[data-test="detail-modal-uninstall-button"]', | ||
buttonEditDetail: 'button[data-test="detail-modal-edit-button"]', | ||
buttonAgree: 'button[data-test="agree-btn"]', | ||
buttonDisagree: 'button[data-test="disagree-btn"]', | ||
buttonSuccess: 'button[data-test="installations-success-button"]', | ||
|
||
divInstalled: 'div[data-test="detail-modal-installed"]', | ||
divSuccessMessage: 'div[data-test="installations-success-message"]' | ||
} | ||
} |
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,5 @@ | ||
export default { | ||
selectors: { | ||
buttonAceptWelcome: 'button[data-test="button-accept-welcome-message-modal"]' | ||
} | ||
} |
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
118 changes: 118 additions & 0 deletions
118
cypress/integration/flow-install-app-happy-path.test.ts
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,118 @@ | ||
import loginPage from '../pages/login-page' | ||
import apiRoutes from '../fixtures/routes' | ||
import appRequest from '../requests/app' | ||
import developerAppsPage from '../pages/developer-apps-page' | ||
import adminApprovalsPage from '../pages/admin-approvals-page' | ||
import installedAppsPage from '../pages/installed-apps-page' | ||
import manageAppsPage from '../pages/manage-apps-page' | ||
|
||
import clientWelcomeModal from '../components/client-welcome-modal' | ||
import appDetailModal from '../components/app-detail-modal' | ||
import appCard from '../components/app-card' | ||
import nanoid from 'nanoid' | ||
|
||
const { | ||
actions: { loginUsingClientAccount, loginUsingDeveloperAccount, loginUsingAdminAccount } | ||
} = loginPage | ||
|
||
const { | ||
selectors: { buttonAceptWelcome } | ||
} = clientWelcomeModal | ||
|
||
const { | ||
actions: { listedAppWithName } | ||
} = developerAppsPage | ||
|
||
const { | ||
actions: { approveAppWithId } | ||
} = adminApprovalsPage | ||
|
||
const { url: installedAppsPageUrl } = installedAppsPage | ||
|
||
const { url: manageAppsPageUrl } = manageAppsPage | ||
|
||
const { | ||
selectors: { buttonAgree, buttonInstallApp, buttonUninstallApp, buttonSuccess, divSuccessMessage } | ||
} = appDetailModal | ||
|
||
const { | ||
actions: { clickAppCardSettingWithId } | ||
} = appCard | ||
|
||
const appName = `E2E Test App - ${nanoid()}` | ||
let appId = '' | ||
|
||
describe('Install app happy path', () => { | ||
before(() => { | ||
cy.server() | ||
appRequest.createApp(appName) | ||
}) | ||
|
||
after(() => { | ||
cy.server() | ||
appRequest.deleteApp(appId) | ||
}) | ||
|
||
it('Log into developer and listed app successfully', () => { | ||
cy.server() | ||
loginUsingDeveloperAccount() | ||
listedAppWithName(appName, res => { | ||
appId = res | ||
}) | ||
}) | ||
|
||
it('Log into admin and approve app successfully', () => { | ||
cy.server() | ||
loginUsingAdminAccount() | ||
approveAppWithId(appId) | ||
}) | ||
|
||
it('Log into client and install and uninstall app successfully', () => { | ||
cy.server() | ||
cy.clearCookies() | ||
|
||
cy.route('GET', apiRoutes.manageApps).as('getManageApps') | ||
cy.route('GET', apiRoutes.installedApps).as('getInstalledApps') | ||
cy.route('POST', apiRoutes.installations).as('installApp') | ||
cy.route('POST', apiRoutes.terminateApp).as('uninstallApp') | ||
|
||
loginUsingClientAccount() | ||
|
||
cy.get(buttonAceptWelcome).click() | ||
|
||
cy.get(`div[data-test-app-name="${appName}"]`).click() | ||
|
||
cy.get(buttonInstallApp).should('have.length', 1) | ||
cy.get(buttonInstallApp).click() | ||
cy.get(buttonAgree).click() | ||
|
||
cy.wait('@installApp') | ||
|
||
cy.route('GET', apiRoutes.appDetail).as('getAppDetail') | ||
|
||
cy.get(divSuccessMessage).should('have.length', 1) | ||
cy.get(buttonSuccess).click() | ||
|
||
cy.wait('@getAppDetail') | ||
|
||
cy.visit(installedAppsPageUrl) | ||
|
||
cy.wait('@getInstalledApps') | ||
|
||
cy.visit(manageAppsPageUrl) | ||
|
||
cy.wait('@getManageApps') | ||
|
||
clickAppCardSettingWithId(appId) | ||
|
||
cy.get(buttonUninstallApp).click() | ||
cy.get(buttonAgree).click() | ||
|
||
cy.wait('@uninstallApp') | ||
|
||
cy.get(divSuccessMessage).should('have.length', 1) | ||
cy.get(buttonSuccess).click() | ||
|
||
cy.wait('@getManageApps') | ||
}) | ||
}) |
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
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
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,5 @@ | ||
import routes from '@/constants/routes' | ||
|
||
export default { | ||
url: routes.INSTALLED_APPS | ||
} |
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,5 @@ | ||
import routes from '@/constants/routes' | ||
|
||
export default { | ||
url: routes.MY_APPS | ||
} |
35 changes: 20 additions & 15 deletions
35
src/components/ui/__tests__/__snapshots__/installed-app-card.tsx.snap
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 |
---|---|---|
@@ -1,20 +1,25 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`InstalledAppCard should match a snapshot 1`] = ` | ||
<Tile | ||
heading="test" | ||
image={ | ||
<img | ||
alt="test" | ||
className="image" | ||
src="https://reapit-app-store-app-media.s3.eu-west-2.amazonaws.com/d10e790c-2bf2-40ae-9c43-82c1534bde31.png" | ||
/> | ||
} | ||
onClick={[MockFunction]} | ||
subHeading="Pete's Proptech World Ltd" | ||
<div | ||
data-test-app-id="09043eb8-9e5e-4650-b7f1-f0cb62699027" | ||
data-test-app-name="test" | ||
> | ||
<p> | ||
nXXT2zaK807ysWgy8F0WEhIYRP3TgosAtfuiLtQCImoSx0kynxbIF0nkGHU36Oz13kM3DG0Bcsicr8L6eWFKLBg4axlmiOEWcvwHAbBP9LRvoFkCl58k1wjhOExnpaZItEyOT1AXVKv8PE44aMGtVz | ||
</p> | ||
</Tile> | ||
<Tile | ||
heading="test" | ||
image={ | ||
<img | ||
alt="test" | ||
className="image" | ||
src="https://reapit-app-store-app-media.s3.eu-west-2.amazonaws.com/d10e790c-2bf2-40ae-9c43-82c1534bde31.png" | ||
/> | ||
} | ||
onClick={[MockFunction]} | ||
subHeading="Pete's Proptech World Ltd" | ||
> | ||
<p> | ||
nXXT2zaK807ysWgy8F0WEhIYRP3TgosAtfuiLtQCImoSx0kynxbIF0nkGHU36Oz13kM3DG0Bcsicr8L6eWFKLBg4axlmiOEWcvwHAbBP9LRvoFkCl58k1wjhOExnpaZItEyOT1AXVKv8PE44aMGtVz | ||
</p> | ||
</Tile> | ||
</div> | ||
`; |
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
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
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
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