Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UTOPIA-1403] MPO Review E2E #1529

Merged
merged 4 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/frontend/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ coverage/*
/src/types/

.eslintrc.js
wdio.conf.js
37,383 changes: 9,392 additions & 27,991 deletions src/frontend/package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
"@wdio/local-runner": "8.16.4",
"@wdio/mocha-framework": "8.16.3",
"@wdio/spec-reporter": "8.16.3",
"chromedriver": "116.0.0",
"eslint": "8.48.0",
"eslint-config-airbnb": "19.0.4",
"eslint-config-airbnb-typescript": "17.1.0",
Expand All @@ -58,6 +57,7 @@
"eslint-plugin-prettier": "5.0.0",
"eslint-plugin-react": "7.33.2",
"eslint-plugin-react-hooks": "4.6.0",
"geckodriver": "4.2.0",
"husky": "8.0.3",
"lint-staged": "13.0.3",
"multiple-cucumber-html-reporter": "3.4.0",
Expand All @@ -69,7 +69,7 @@
"stylelint-scss": "5.1.0",
"typescript": "4.6.4",
"vite": "3.2.7",
"wdio-chromedriver-service": "8.1.1",
"wdio-geckodriver-service": "5.0.2",
"wdio-cucumberjs-json-reporter": "5.1.7",
"wdio-wait-for": "3.0.6"
},
Expand Down
19 changes: 19 additions & 0 deletions src/frontend/test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Locally running the E2E Tests

To run all the tests specified in your WDIO configuration, you can use the following command:

```bash
npm run wdio
```

## Running a Single Feature File

To run a single feature file, follow these steps:

1. Identify the feature file you want to run, located in the ./test/features/featurefiles/e2e/ directory.

2. Use the following command, replacing your-feature-file.feature with the name of the specific feature file you want to run:

```bash
npm run wdio -- --spec ./test/features/featurefiles/e2e/your-feature-file.feature
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love this! Thanks for adding :)

```
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ Feature: UTOPIA-631 MPO:View PIA details
| username | role |
| DORGALE | MPO |


Scenario Outline: As <role> user, I am able to submit a valid form with all fields filled

Given I am on the login page
Expand Down Expand Up @@ -99,13 +98,19 @@ Scenario Outline: As <role> user, I am able to submit a valid form with all fiel
Then I click on "Save" button
Then I click on "Submit" button
Then I click on "Yes, submit" button
And I am able to click link "Review"
Then I click on "Add a role" button
And I enter "role"
Then I click on "Add" button
And I click with name "Review Acknowledgement" checkbox
And I enter "Review Note"
Then I click on "Confirm" button
Then I click on "Submit" button
Then I click on "Yes, submit" button
And I click on "Active PIAs" tab
And Search with title
And Verify if the status is only "CPO Review"




Examples:
Expand Down
99 changes: 44 additions & 55 deletions src/frontend/test/features/pageobjects/fillPPQ.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,82 +2,71 @@ const Page = require('./page');
const link = "//a[contains(text(),'";
const randomLink = "(//label[contains(text(),'')])[";


/**
* sub page containing specific selectors and methods for a specific page
*/
class fillPPQ extends Page {
/**
* define selectors using getter methods
*/
get datePicker () {
return $('//input[@placeholder="yyyy/mm/dd"]');
}
/**
* define selectors using getter methods
*/
get datePicker() {
return $('//input[@placeholder="yyyy/mm/dd"]');
}

get selectDate () {
get selectDate() {
return $("//div[contains(text(),'10')]");
}

get textArea () {
return $("//textarea");
}
}


get textArea() {
return $('//textarea');
}

/**
* a method to encapsule automation code to interact with the page
* e.g. to login using username and password
*/
/**
* a method to encapsule automation code to interact with the page
* e.g. to login using username and password
*/

async selectCheckbox(checkName) {
BradyMitch marked this conversation as resolved.
Show resolved Hide resolved
const h1 = link + checkName + "')]/../input";
const headerElement = await $(h1);
await headerElement.waitForDisplayed();
}



async selectCheckbox (checkName) {
const h1=link + checkName + "')]/../input";
const headerElement=await $(h1);
await headerElement.waitForDisplayed();
async clickCheckbox() {
BradyMitch marked this conversation as resolved.
Show resolved Hide resolved
function getRandomNumber() {
// Generate a random number between min (inclusive) and max (inclusive)
return Math.floor(Math.random() * (13 - 3 + 1) + 3);
}
var random = getRandomNumber();
console.log('Random number is : ' + random);
for (var i = 3; i <= random; i++) {
var newlink = randomLink + i + ']/../label/input';
const buttonElement = await $(newlink);
await buttonElement.waitForClickable();
await buttonElement.click();
}

async clickCheckbox () {
function getRandomNumber() {
// Generate a random number between min (inclusive) and max (inclusive)
return Math.floor(Math.random() * (13 - 3 + 1) + 3);
}
var random = getRandomNumber();
console.log("Random number is : " +random )
for(var i=3;i<=random;i++)
{
var newlink=randomLink+i+"]/../label/input";
const buttonElement= await $(newlink);
await buttonElement.waitForClickable();
await buttonElement.click();

}
}


async selectData() {

await this.datePicker.waitForClickable();
await this.datePicker.click();
await this.selectDate.waitForClickable();
await this.selectDate.click();

}
}

async AddText() {

await this.textArea.waitForExist();
await this.textArea.setValue("Is there anything else the CPO should consider when reviewing this PIA? PIA?123#$%");
}


/**
* overwrite specific options to adapt it to page object
*/
open () {
return super.open('fillPPQ');
}
await this.textArea.setValue(
'Is there anything else the CPO should consider when reviewing this PIA? PIA?123#$%',
);
}

/**
* overwrite specific options to adapt it to page object
*/
open() {
return super.open('fillPPQ');
}
}

module.exports = new fillPPQ();
Loading
Loading