Read data from json file #18812
Unanswered
FadelOj
asked this question in
Component Testing
Replies: 2 comments 2 replies
-
You can use cy.readFile or cy.fixture commands or directly import the json file from the spec
…Sent from my iPhone
On Nov 7, 2021, at 08:17, Fadooool ***@***.***> wrote:
Hello everyone,
I wanted to make a test case that will read the properties of the user (username, name, password, email ..... ) from the users.json file and fill them in the corresponsive field in the website that I am testing.
cy.get('#IndividualDetailViewModel_EnglishFullName').invoke('val', 'englishName') cy.get('#IndividualDetailViewModel_PhoneNumber').invoke('val', '000000000') cy.get('#IndividualDetailViewModel_IdNumber').invoke('val', '00000000000') cy.get('#IndividualDetailViewModel_UserName').invoke('val', 'XXXXXXXXXX') cy.get('#IndividualDetailViewModel_Email').invoke('val', ***@***.***') cy.get('#IndividualDetailViewModel_Password').invoke('val', ***@***.***') cy.get('#IndividualDetailViewModel_ConfirmPassword').invoke('val', ***@***.***')
I have read the documentation already, so if someone can help me with the code directly, thanks in advance.
users.txt
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Beta Was this translation helpful? Give feedback.
2 replies
-
Ok. In that case search for json and fixture keywords at https://cypress.tips/search and read the search results and watch the videos
…Sent from my iPhone
On Nov 8, 2021, at 00:10, Fadel Oujan ***@***.***> wrote:
I have tried cy.fixture commands, but they didn't mention how can retrieve the values and use them as input for the testscript, thats what i am trying to do, getting the element from json then use it as an input value
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone,
I wanted to make a test case that will read the properties of the user (username, name, password, email ..... ) from the users.json file and fill them in the corresponsive field in the website that I am testing.
cy.get('#IndividualDetailViewModel_EnglishFullName').invoke('val', 'englishName') cy.get('#IndividualDetailViewModel_PhoneNumber').invoke('val', '000000000') cy.get('#IndividualDetailViewModel_IdNumber').invoke('val', '00000000000') cy.get('#IndividualDetailViewModel_UserName').invoke('val', 'XXXXXXXXXX') cy.get('#IndividualDetailViewModel_Email').invoke('val', '[email protected]') cy.get('#IndividualDetailViewModel_Password').invoke('val', 'P@ssw0rd') cy.get('#IndividualDetailViewModel_ConfirmPassword').invoke('val', 'P@ssw0rd')
I have read the documentation already, so if someone can help me with the code directly, thanks in advance.
users.txt
Beta Was this translation helpful? Give feedback.
All reactions