Security News
Internet Archive Hacked, 31 Million Record Compromised
The Internet Archive's "Wayback Machine" has been hacked and defaced, with 31 millions records compromised.
@studyportals/bestfit-test
Advanced tools
BestFit-Test is an NPM package that contains end-to-end tests for all the BestFit front-end microservices. For the tests Cypress is used.
A list of the front-end microservices (and any BestFit services for that matter), can be found in the README of BestFit-Shared.
The purpose of the tests included in this repository is to test the front-end microservices. Therefore, this repository stand-alone isn't a good starting point.
Therefore, the first step is to go to the repository of any of the front-end microservices. A list of the front-end microservices (and any BestFit services for that matter), can be found in the README of BestFit-Shared.
You need to make sure that the @studyportals/bestfit-test
package is included in the microservice, alongside any other dependencies.
# Make sure it is installed by running:
npm install
There are two ways of running the tests.
Run the following command in your console:
# Run all tests in the configured folder.
npm run cypress
Run the following command in your console:
# Open the interface.
npx cypress open
This will take a while. A new window will open that will show you an overview of all the tests there are.
[]
Click on the test, and a new window will open that starts to run the tests. Or, instead, you can click on Run all specs
to run all tests that are shown in the window.
In the root of each of the BestFit front-end microservices you can find configuration that is used to determine which tests are run and how, inside the cypress.json
file. The two most important json properties to consider are:
integrationFolder
: The folder location that Cypress looks at to retrieve your set of tests.baseUrl
: The base url that will be used to run the tests.As an example, here is the cypress.json
file of AdmissionChance-Answer at the time of writing this documentation:
{
"fixturesFolder": false,
"integrationFolder": "./node_modules/@studyportals/bestfit-test/Tests/AdmissionChanceAnswer",
"pluginsFile": false,
"screenshotsFolder": false,
"supportFile": false,
"baseUrl": "https://525.mastersportal.fyi/",
"env":{
"username": "ETeOGtt",
"password": "y3J6LW3"
},
"defaultCommandTimeout": 15000
}
As you can see, credentials for a pull request environment can also be included under the username
and password
properties of the env
object.
For each of the BestFit front-end microservices, when a pull request is open, new commits trigger Travis to run the end-to-end tests for the respective repository, once the build
and staging
steps have completed for the pull request environment in AWS.
For a freshly opened pull request, if no manual action is taken, the runs in Travis will break. The manual action(s) that are required, if you want to have your changes automatically tested, are dependant on the microservice:
For questionnaire microservices (AdmissionChance and BestFit-Budget) tests can run stand-alone, without the context of Mastersportal. So, all you need to do is:
baseUrl
in the configuration of the cypress.json
file at the root of the project to the url of the pull request environment, e.g. https://210-ac.prtl.fyi/
and commit this change.For AdmissionChance-Answer tests can only run in the context of Mastersportal. So, a couple more steps are needed:
https://323-aca.prtl.fyi
.// Change this:
return "https://admissionchance-answer.{$env}.prtl.co/";
// To the pull request environment link you copied:
return "https://323-aca.prtl.fyi";
Masters
to initiate a pull request environment to be opened.cypress.json
file at the root of AdmissionChance-Answer, set the baseUrl
, the env.username
and the env.password
to the url and credentials of the pull request environment and commit this change.Now, with every commit, the end-to-end tests should be running on the Mastersportal
pull request environment that you opened, which fetches the AdmissionChance-Answer pull request environment instead of the TST
microservice.
Inside the Tests
repository, you can find the following repositories, which are all related to repositories in GitHub:
The main AdmissionChance-Answer test is, by far, the longest, because the whole flow in all its details is tested. The following list was used to verify that all flow parts are included in the test:
All test code should end up in the Tests/flows
folder, and should be used in any of the other repositories to test a part of the flow. All tests are written in JavaScript and can contain code like:
describe('Standard Visit', function(){
it('Opens BestFit and goes through the Academic questionnaire.', function(){
cy.visit('https://www.mastersportal.com/studies/622/economics-for-development.html');
cy.contains('Check your fit with this programme').click().then(() => {
cy.get('.IntroIncentiveButton:first').click();
});
});
});
It is possible to use selectors to find forms and textboxes. The test can run as quickly as the page renders.
Check the Introduction to Cypress.
FAQs
E2E testing code for the BestFit application
We found that @studyportals/bestfit-test demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 17 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Internet Archive's "Wayback Machine" has been hacked and defaced, with 31 millions records compromised.
Security News
TC39 is meeting in Tokyo this week and they have approved nearly a dozen proposals to advance to the next stages.
Security News
Our threat research team breaks down two malicious npm packages designed to exploit developer trust, steal your data, and destroy data on your machine.