Skip to content

Commit

Permalink
fix: update crf e2e scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
mirovladimitrovski committed Oct 24, 2023
1 parent 960e068 commit 3574a16
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
7 changes: 0 additions & 7 deletions test-e2e/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,6 @@ export default {
customRegFields: {
topContainerSelector: 'div[data-testid="custom-reg-fields"]',
termsAndConditionsField: 'input[type="checkbox"][name="terms"]',
dropdownField: '[data-testid="crf-select"]',
countryField: '[data-testid="crf-country"]',
usStateField: '[data-testid="crf-us_state"]',
textInputField: '[data-testid="crf-input"]',
datepickerField: '[data-testid="crf-datepicker"]',
radioField: '[data-testid="crf-radio"]',
checkboxField: '[data-testid="crf-checkbox"]',
},
offers: {
monthlyOffer: {
Expand Down
31 changes: 27 additions & 4 deletions test-e2e/utils/steps_file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,36 @@ const stepsObj = {
return;
}

if (!(await this.hasTermsAndConditionField())) {
return;
if (await this.hasTermsAndConditionField()) {
this.checkOption(constants.customRegFields.termsAndConditionsField);
}

return tryTo(() => {
this.checkOption(constants.customRegFields.termsAndConditionsField);
// Dropdown select field ("select")
this.selectOption('select[name="Pol"]', 'Female');

// US State select field ("us_state")
this.selectOption('select[name="us_state"]', 'Idaho');

// Text input field ("input")
this.fillField('input[name="text123"]', 'Random test text');

// Radio field ("radio")
within('div[label="rb test"]', () => {
this.checkOption('input[type="radio"][value="rb2"]');
});

// Country select field ("country")
this.selectOption('select[name="country"]', 'Australia');

// Date picker ("datepicker")
within('[data-testid="crf-datepicker"]', () => {
this.fillField('[name="date"]', '25');
this.fillField('[name="month"]', '06');
this.fillField('[name="year"]', '2050');
});

this.checkOption('Yes, I want to receive Blender updates by email');
this.checkOption('Check me');
},
submitForm: function (this: CodeceptJS.I, loaderTimeout: number | false = normalTimeout) {
this.click('button[type="submit"]');
Expand Down

0 comments on commit 3574a16

Please sign in to comment.