8000 tests/end-to-end-test-for-report-submission-using-playwright-in-ci by wssheldon · Pull Request #2936 · Netflix/dispatch · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

tests/end-to-end-test-for-report-submission-using-playwright-in-ci #2936

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 29 commits into from
Feb 3, 2023

Conversation

wssheldon
Copy link
Contributor
@wssheldon wssheldon commented Feb 2, 2023

Tests work great locally, need to brainstorm how to fully automate authentication in CI, and how to run the development server in CI on GH Actions.

I recreated the bug where the "Load More" button did not appear for the Project select button, introduced here. The test will check for the "Load More" text and fail if it can't be found after selecting the Type button, this failed as expected:

    // check that the 'Load More' selector is available upon opening the Type dropdown
    await expect(
      page.getByText("Load More"),
      "The 'Load More' selector should be visibile."
    ).toBeVisible()
Error: The 'Load More' selector should be visibile.

Call log:
  - expect.toBeVisible with timeout 10000ms
  - waiting for getByText('Load More')
  -   unexpected value "hidden"

  35 |       page.getByText("Load More"),
  36 |       "The 'Load More' selector should be visibile."
> 37 |     ).toBeVisible()
     |       ^
  38 |
  39 |     await page.getByText(type, { exact: true }).click()

    at /Users/wshel/Projects/dispatch/tests/e2e/report-submission.spec.ts:37:7

@wssheldon wssheldon added enhancement New feature or request tests javascript Pull requests that update Javascript code labels Feb 2, 2023
@kevgliss
Copy link
Contributor
kevgliss commented Feb 2, 2023

I think you should be able to run these via a github action:

jobs:
  tests_e2e:
    name: Run end-to-end tests
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
      - name: Install dependencies
        run: npm ci
      - name: Install playwright browsers
        run: npx playwright install --with-deps
      - name: Run tests
        run: npx playwright test

Authentication wise we should be able to leverage basic auth with the default user.

@wssheldon
Copy link
Contributor Author

I think you should be able to run these via a github action:

I think I'll need to use the .devcontainer to be able to run dispatch server develop

)
)
.toBeVisible()
})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to extend this test to validate the submission report card has not regressed in anyway. This pattern will probably come up a lot and it feels very verbose and maybe flakey to do it this way. Maybe a todo could be to investigate using something like this: https://www.thoughtworks.com/en-us/radar/techniques/component-visual-regression-testing

Copy link
Contributor Author
@wssheldon wssheldon Feb 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -7047,8 +7085,7 @@
"version": "18.11.7",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.7.tgz",
"integrity": "sha512-LhFTglglr63mNXUSRYD8A+ZAIu5sFqNJ4Y2fPuY7UlrySJH87rRRlhtVmMHplmfk5WkoJGmDjE9oiTfyX94CpQ==",
"dev": true,
"peer": true
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why that changed


async function login(page: Page): Promise<void> {
let email = (Math.random() + 1).toString(36).substring(7) + "@example.com"
let password = (Math.random() + 1).toString(36).substring(7)

Check failure

Code scanning / CodeQL

Insecure randomness

This uses a cryptographically insecure random number generated at [Math.random()](1) in a security context.
@wssheldon wssheldon changed the title initial work to create a e2e test for report submission on playwright tests/end-to-end-test-for-report-submission-using-playwright-in-ci Feb 3, 2023
@wssheldon wssheldon merged commit 0a81df7 into master Feb 3, 2023
@wssheldon wssheldon deleted the tests/playwright branch February 3, 2023 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request javascript Pull requests that update Javascript code tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0