-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When we first started this project we were also new to Cypress. We added an initial implementation of page objects and got some basic scenarios working. Since then our understanding Cypress has improved plus our newest page objects are not consistent with how we did the original ones. We've also brought the concept of menus in. Finally, we're using our page objects inconsistently. Some scenarios depend on them. Others like the legacy tests ignore them completely. Updating the scenarios to be consistent is for another change. But this one focuses on getting the page objects sorted in readiness. We'll get them consistent and reduce some duplication by introducing some base page objects. ** Notes * Update deprecated use of cy.server() Cypress replaced this with `cy.intercept()` in its latest versions. Plus it's what we use elsewhere in suite. * Fix transactions feature cust reference We think the previous reference was just something we had found in all our AWS environments. We now use a reference that we know is included in our test import files. * Add a BasePage and extend all from it We start by creating a `BasePage` which we then extend all other pages from. It takes over duties for the `mainHeading()`. We also move to some conventions. - elements will feature their type in the name, for example, `cancelButton` - rather than refer to the main submit button on each page by its display name we go with one that is consistent. This also means we can declare it once in our `BasePage` - we expect all pages to provide a `confirm()` method. This will replace checks on `mainHeading()` littered throughout the test to confirm we're in the right place. Our convention now will be to ask the page object to confirm we're where we are supposed to be These changes mean a number of edits to the steps. Along the way whilst retesting we found some broken elements. So, scattered throughout the changes will be ones related to fixing a test rather than the switch to a base page. * Add BaseAppPage The base app page represents what you see once you have authenticated. This means the various menus. The intention is to access the menus through the page object that represents where you are rather than referencing menus separartly in the steps. We create a base class for it to remove duplication. We want to try and get referencing them out of the steps because we think it will help make them cleaner and clearer. * Add annual billing menu Whilst working on a scenario spotted that we were accessing the annual billing menu but had yet to wrap it in a 'menu'. * Move alert checking to a Cypress command Went with this option for the reasons set out in the method comments. Again, we're holding off touching the legacy tests and will deal with them separately.
- Loading branch information
1 parent
cf48d75
commit 25c2c98
Showing
32 changed files
with
368 additions
and
331 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
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,10 @@ | ||
import { When } from 'cypress-cucumber-preprocessor/steps' | ||
import TransactionsPage from '../../pages/transactions_page' | ||
|
||
When('I select the {string} regime', (regimeName) => { | ||
cy.task('regime', regimeName).then((regime) => { | ||
cy.wrap(regime).as('regime') | ||
|
||
TransactionsPage.regimeMenu.getOption(regime.name).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
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 |
---|---|---|
@@ -1,22 +1,15 @@ | ||
import { When, Then, And } from 'cypress-cucumber-preprocessor/steps' | ||
import { Then, And } from 'cypress-cucumber-preprocessor/steps' | ||
import ExportDataPage from '../../pages/export_data_page' | ||
import TransactionsPage from '../../pages/transactions_page' | ||
|
||
When('I select the {string} regime', (regime) => { | ||
TransactionsPage.regimeMenu().click() | ||
TransactionsPage.regimeMenuItem(regime).click() | ||
}) | ||
|
||
And('I proceed to view file download details', () => { | ||
TransactionsPage.transactionMenu().click() | ||
TransactionsPage.downloadTransactionDataMenuItem().click() | ||
TransactionsPage.transactionsMenu.getOption('Download Transaction Data').click() | ||
}) | ||
|
||
Then('I can view the Data Protection Notice', () => { | ||
ExportDataPage.dataProtectionNotice().should('be.visible') | ||
}) | ||
|
||
And('I can download transaction data', () => { | ||
ExportDataPage.downloadBtn().should('have.attr', 'href', '/regimes/pas/data_export/download') | ||
// DownloadTransactionFilePage.downloadBtn().click() | ||
ExportDataPage.downloadButton().should('have.attr', 'href', '/regimes/pas/data_export/download') | ||
}) |
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
Oops, something went wrong.