Item | Link |
---|---|
Getting Help | This nerdlet is owned by the Virtuoso team Slack: #help-virtuoso Page ๐จ: 911 teamstore VIRTUOSO |
This is the Virtuoso package responsible for:
- Playwright E2E testing for Guided installation
- Fork the repo.
- Create a branch request.
- Implement the change.
- Verify your tests and all existing tests pass.
- Open a pull request.
- Bring the pull request to the attention of the @hero in #help-virtuoso
Github Woklfow is configured to trigger the tests on a push/PR to main branch. Workflow will create an Ubuntu GH container, install the dependencies, run all the tests in e2e/tests folder and upload the test results artifact which can be downloaded.
Currently scheduled to run once every 60 minuites. Schedule can be edited in github/workflows/manual.yml file
-
Clone the repo
-
Install the correct Node version:
nvm install
-
Install dependencies:
npm install
-
To test local nerdpack, in playwright.config.js file update the baseURL to
https://dev-one.newrelic.com/?nerdpacks=local
and update the navigation in beforeEach hook from/nr1-core/install-newrelic/installation-plan?e2e-test&
to/nr1-core/install-newrelic/installation-plan?e2e-test&nerdpacks=local&
in the scripts you are testing.For example, if you are testing Go agent installation script make the changes as mentioned above in the beforeEach hook method:
test.beforeEach(async () => { browser = await chromium.launch(); context = await browser.newContext({ storageState: "e2e/sessions/storageState.json", }); page = await context.newPage(); await page.waitForLoadState("networkidle"); await page.goto("/marketplace?e2e-test&"); await page.getByTestId("marketplace.guided-install-tile").click(); });
Tests can be triggered via npm task, this will run all the tests in e2e/tests folder
npx playwright test
Individual test scripts can also be run with the following command
npx playwright test <foldername>/<test-file-name>
[for example the command is written in the following way - npx playwright test tests/docker-infra-guided-installation.spec.js]
Should you want to run traces locally you can force tracing to be on with --trace on.
npx playwright test --trace on
To run E2E tests locally, you will need to define env vars with login credentials.
ENV_SECRET_EMAIL='[email protected]'
ENV_SECRET_PASSWORD='mypassword#123'
Workers are used to run the scripts parallely. The more workers, the more scripts will be able to run parallely so that the testing time can be reduced.
The purpose of Retries is to re-test the scripts if there is any error while running the scripts. For example if you set retries to 2, it tries to execute the test for 2 times if facing an error while running.
The workers and retries can be modified in playwright.config.js
To run a playwright e2e test with headless mode disabled (i.e with a visible browser window) you can set headless option to false when launching the browser.
Here is an example commands
To run playwright e2e test with headless mode disabled
npx playwright test --headed
If you want run a specific test file, you can add path to the file at the end of the command
npx playwright test --headed ./tests/mytest.spec.js
If you wish to notify github workflow actions status, use this command in your slack channel
/github subscribe https://github.com/newrelic/onboarding-e2e-tests workflows:{name:"Guided Installation e2e tests"}