-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src/stores: add action registerCoordinator to the register store + fo…
…rm updates (#639) * update FormRegisterCoordinator data structure * simplify router rules and add register_coordinator path * add loadOptions function to FormFieldCompany * add createOrganization function to FormFieldCompany * define new endpoint + tweak logic * rename subsidiary variable + fix FormFieldCompany tests * add FormFieldCompany add company test * fix tests for FormRegisterCoordinator * add registerCoordinator function to register stoer * FormFieldCoordinator - test submit request and response * cleanup * FormRegisterCoordinator - test store state after register * remove the Register as coordinator box from register form * simplify FormRegisterCoordinator * remove register cooordinator link from register screen e2e * function cleanup * update register coordinator endpoint * cleanup and refactor FormFieldCompany test * fix api body parameter vatId type with new fixture * cleanup * refactor test intercept * refactor company API calls intercept in component tests * refactor Organization types into a separate file * cleanup docs * rename isRegistrationComplete variable and add comments * fix getIsRegistrationCompleted variable in FormRegisterCoordinator test * add component FormFieldNewsletter * fix config endpoint * update docs * add e2e test to register_coordinator * remove unused code from FormPersonalDetails * secure clicking the checkbox element * break-up the language switcher test function chain * update the test command chain * update testLanguageSwitcher test * update sequence of actions before test * update then chaining of commands * register_coordinator beforeEach hook * fix register_coordinator e2e tests * update newsletter form test in FormPersonalDetails * components/coordinator: rename const countBranches to subsidiariesCount * src/components/global: fix logger level and log messages * src/components/types: rename PostOrganizationsBody TS interface to PostOrganizationPayload * src/composables: simplify using ternary operator * update FormFieldCompany docs --------- Co-authored-by: Šimon Macek <simon.macek@proficio.cz> Co-authored-by: Tomas Zigo <tomas.zigo@slovanet.sk>
- Loading branch information
1 parent
4d78eea
commit 839dd97
Showing
47 changed files
with
1,122 additions
and
423 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,109 @@ | ||
import { nextTick, ref } from 'vue'; | ||
import FormFieldNewsletter from 'components/form/FormFieldNewsletter.vue'; | ||
import { i18n } from '../../boot/i18n'; | ||
import { NewsletterType } from '../../components/types/Newsletter'; | ||
import { vModelAdapter } from '../../../test/cypress/utils'; | ||
|
||
// selectors | ||
const selectorNewsletterContainer = 'form-field-newsletter'; | ||
const selectorNewsletterLabel = 'newsletter-label'; | ||
const selectorNewsletterAll = 'newsletter-option-all'; | ||
const selectorNewsletterOptions = 'newsletter-options'; | ||
const selectorNewsletterOption = 'newsletter-option'; | ||
|
||
const model = ref([]); | ||
|
||
describe('<FormFieldNewsletter>', () => { | ||
it('has translation for all strings', () => { | ||
cy.testLanguageStringsInContext( | ||
[ | ||
'titleNewsletter', | ||
'labelNewsletterAll', | ||
'labelNewsletterChallenges', | ||
'labelNewsletterEvents', | ||
'labelNewsletterMobility', | ||
], | ||
'form.personalDetails', | ||
i18n, | ||
); | ||
}); | ||
|
||
context('desktop', () => { | ||
beforeEach(() => { | ||
cy.viewport('macbook-16'); | ||
cy.mount(FormFieldNewsletter, { | ||
props: { | ||
...vModelAdapter(model), | ||
}, | ||
}); | ||
}); | ||
|
||
coreTests(); | ||
}); | ||
|
||
context('mobile', () => { | ||
beforeEach(() => { | ||
cy.viewport('iphone-6'); | ||
cy.mount(FormFieldNewsletter, { | ||
props: { | ||
...vModelAdapter(model), | ||
}, | ||
}); | ||
}); | ||
|
||
coreTests(); | ||
}); | ||
}); | ||
|
||
function coreTests() { | ||
it('renders component', () => { | ||
cy.dataCy(selectorNewsletterContainer).should('be.visible'); | ||
cy.dataCy(selectorNewsletterLabel).should('be.visible'); | ||
cy.dataCy(selectorNewsletterAll).should('be.visible'); | ||
cy.dataCy(selectorNewsletterOptions).should('be.visible'); | ||
}); | ||
|
||
it('renders all newsletter options', () => { | ||
cy.dataCy(selectorNewsletterOption).should('have.length', 3); | ||
}); | ||
|
||
it('updates v-model when options are selected', () => { | ||
model.value = []; | ||
nextTick().then(() => { | ||
cy.dataCy(selectorNewsletterOption).eq(0).click(); | ||
cy.wrap(model) | ||
.its('value') | ||
.should('deep.equal', [NewsletterType.challenge]); | ||
}); | ||
}); | ||
|
||
it('selects all options when "all" is clicked', () => { | ||
model.value = []; | ||
nextTick().then(() => { | ||
cy.dataCy(selectorNewsletterAll).click(); | ||
cy.wrap(model).its('value').should('have.length', 3); | ||
}); | ||
}); | ||
|
||
it('deselects all options when "all" is unclicked', () => { | ||
model.value = [ | ||
NewsletterType.challenge, | ||
NewsletterType.event, | ||
NewsletterType.mobility, | ||
]; | ||
nextTick().then(() => { | ||
cy.dataCy(selectorNewsletterAll).click(); | ||
cy.wrap(model).its('value').should('have.length', 0); | ||
}); | ||
}); | ||
|
||
it('selects "all" when all options are manually selected', () => { | ||
model.value = []; | ||
nextTick().then(() => { | ||
cy.dataCy(selectorNewsletterOption).each(($el) => { | ||
cy.wrap($el).click(); | ||
}); | ||
cy.dataCy(selectorNewsletterAll).should('be.checked'); | ||
}); | ||
}); | ||
} |
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.