Closed vyshnavi1605 closed 2 years ago
Progress so far
docker-orchestration changes, branch 510-setup-mockserver
:
docker-compose.yml
, currently need to use fba-compose up -d mockServer
to start the mockserver. Possibly need to start up the mockserver when cypress container starts up?backend changes, branch 510-setup-mockserver
mockserver.js file contains the mockserver client code. This file contains the expectations and when a request matches an expectation the code written will be executed.
NOTE: there are 2 mockserver.js files, one in the root of the backend and one in the root of the cypress folder in the frontend. Ideally, when we run the E2E tests we want to run the mockserver.js file contained in the frontend. That is not working at the moment. There are two big if statements
in the file, within the first if statement, when an expectation is matched it passes it on to the api. The second, returns mock responses. The mockserver.js file does not seem to be working when enabling it to return mock responses.
NOTE: The mockserver will only be running locally when running the E2E tests and on GitHub actions. When the mockserver is running locally and on GitHub actions we only want to return the mock responses.
responses: I have the responses for the methods that I think will be called when running the E2E tests in the backend
, in the folder responses/user
. In the mockserver.js
file, when a request comes in, using regex we extract the method name and then return the response for that method. Some methods also require additional parameters, e.g userNumber, this is handled by extracting the user number and the method name and returning the required response.
created a test stfc user authorisation
and dependency variable
, but still not sure if this is needed.
changed StfcUserDataSource.ts
we want to pass in a different wsdl url
based on what if the system is running locally or not. If it is not running locally we want to pass in the dev wsdl url
on line 14.
changed the soap interface, for every method here I have added an end point url which I have manually added. But as this is a file that is generated we will have to make these changes in the user-office-lib
repo. I have made the changes there, but have not manged to test them yet. Branch 510-setup-mockserver
. I added an endpoint and this will be dynamically rendered in the soap interface file.
index.ts
, the mockserver function is called here
Frontend changes, branch 510-setup-mockserver
wrote a shell script to run the mockserver.js file, this script will need to be called in wait-for-frontend.sh
. The script will also need to include checks to see if the mockserver container is running.
added externalTokenLogin method, this allows stfc authentication using a sessionId. user.ts and user.d.ts
In the current login method I added a check which checks if the STFC env variable equals true, if yes, then the externalTokenLogin is called.
filterTests.js
is needed to filter the E2E tests and decide what tests run in which environment. Each E2E spec file will need the environment in which it will run to be specified. This is part of the issue: https://github.com/UserOfficeProject/user-office-project-issue-tracker/issues/511
E2E tests
PASSING TESTS PROPOSALS
calls.ts
tests seem to be passing as well.To run the E2E tests using the mockserver:
The following test suites that we want to run in STFC mode are passing:
In the following test suites these tests are failing:
calls
eventLog
instruments, what tests in this file do we want to run?
peopleTable
Error received from client {"error":"Cannot read properties of undefined (reading 'map')"}
this is happening on prod as well.questions
proposals
templates and settings, still investigating failing tests
A user-officer should not be able go to next step or create call if there is validation error, this is failing due to using esi-template which is behind the feature flag.
I think we could enable the feature flag for the test, which is what Martin was showing us in the last sprint planning, to avoid having separate tests.
If user updates his info, officer should be able to see the event logs for that update
If they're user logs we aren't interested in that since we have user management disabled. We do want proposal logs though but that sounds separate.
instruments, what tests in this file do we want to run?
We had hidden the instruments sections but I think we might need to reenable some of it for the facility work that's being done? I think @mr-field would have a better idea of what's needed here. Some of the technical review tests in there shouldn't be necessary though.
Both Should preserve the selected users after pagination are failing
We might have to hard code in specific emails that we have responses for and pass those emails into the users that are created for the tests. Instead of using faker to generate random emails. It would affect the ESS tests in that they'd be searching for specific emails but I don't think that would be a problem?
Officer can delete question , failing locally on e2e mode too
It sounds like the test is broken, but it's odd that we haven't come across this problem running the tests in GitHub Actions. It may be worth checking on Slack if the ESS are aware of any problems.
Should be able to see proposal allocation time unit on the proposal, do we want this test to run in STFC mode
This part is now hidden so we shouldn't need it.
Both Should preserve the selected users after pagination are failing, I think this is due to the fact that at the beginning of the test it creates 5 or 10 users and then searches them based on emails. However, the way the responses are set is that it searches the file name with the specific email sent in the parameter. As these emails are generated randomly I'm not sure how to handle that part.
This problem doesn't seem to be causing the tests to fail. The problem seems to be that the user creation at the start of the tests are failing. Still looking into the reason for this.
When logged in as a user officer and open the people table, the dialogue opens and shows this at the bottom:
However the rows on that page are not 10 and only 6 users are shown. When changing the rows to 5 only 2 users are shown in the dialogue box. Seems to be happening on dev and prod. Not sure why this is happening, is this a problem?
Set up mockserver - trial out mockserver in a docker container and mockserver client in the frontend cypress folder and handle login
part of: https://github.com/UserOfficeProject/user-office-project-issue-tracker/issues/56