From f6998d6feedc52746398246ea8987aaf71b749eb Mon Sep 17 00:00:00 2001 From: Riken Shah Date: Thu, 1 Apr 2021 18:07:19 +0530 Subject: [PATCH] puppeteer_tests: Remove sequential numbers from test files. The only downside of this is that it makes it harder to control the order of these tests; which isn't that important. And the structure of naming each with its test order fundamentally requires renaming files when adding/deleting tests, so if we want to control the default test order, we'd be better off doing that by just hardcoding a list in the test runner code. --- docs/testing/testing-with-puppeteer.md | 2 +- docs/testing/testing.md | 2 +- docs/tutorials/new-feature-tutorial.md | 2 +- frontend_tests/puppeteer_tests/{08-admin.ts => admin.ts} | 0 .../puppeteer_tests/{03-compose.ts => compose.ts} | 0 .../{14-copy-and-paste.ts => copy-and-paste.ts} | 0 .../{10-custom-profile.ts => custom-profile.ts} | 0 .../{13-delete-message.ts => delete-message.ts} | 0 .../puppeteer_tests/{12-drafts.ts => drafts.ts} | 0 frontend_tests/puppeteer_tests/{06-edit.ts => edit.ts} | 0 .../puppeteer_tests/{09-mention.ts => mention.ts} | 0 .../{02-message-basics.ts => message-basics.ts} | 0 .../puppeteer_tests/{07-navigation.ts => navigation.ts} | 0 .../{01-realm-creation.ts => realm-creation.ts} | 0 .../{15-realm-linkifier.ts => realm-linkifier.ts} | 0 .../puppeteer_tests/{16-settings.ts => settings.ts} | 0 frontend_tests/puppeteer_tests/{05-stars.ts => stars.ts} | 0 .../{04-subscriptions.ts => subscriptions.ts} | 0 .../{11-user-deactivation.ts => user-deactivation.ts} | 0 tools/message-screenshot.js | 2 +- tools/test-js-with-puppeteer | 8 ++++---- 21 files changed, 8 insertions(+), 8 deletions(-) rename frontend_tests/puppeteer_tests/{08-admin.ts => admin.ts} (100%) rename frontend_tests/puppeteer_tests/{03-compose.ts => compose.ts} (100%) rename frontend_tests/puppeteer_tests/{14-copy-and-paste.ts => copy-and-paste.ts} (100%) rename frontend_tests/puppeteer_tests/{10-custom-profile.ts => custom-profile.ts} (100%) rename frontend_tests/puppeteer_tests/{13-delete-message.ts => delete-message.ts} (100%) rename frontend_tests/puppeteer_tests/{12-drafts.ts => drafts.ts} (100%) rename frontend_tests/puppeteer_tests/{06-edit.ts => edit.ts} (100%) rename frontend_tests/puppeteer_tests/{09-mention.ts => mention.ts} (100%) rename frontend_tests/puppeteer_tests/{02-message-basics.ts => message-basics.ts} (100%) rename frontend_tests/puppeteer_tests/{07-navigation.ts => navigation.ts} (100%) rename frontend_tests/puppeteer_tests/{01-realm-creation.ts => realm-creation.ts} (100%) rename frontend_tests/puppeteer_tests/{15-realm-linkifier.ts => realm-linkifier.ts} (100%) rename frontend_tests/puppeteer_tests/{16-settings.ts => settings.ts} (100%) rename frontend_tests/puppeteer_tests/{05-stars.ts => stars.ts} (100%) rename frontend_tests/puppeteer_tests/{04-subscriptions.ts => subscriptions.ts} (100%) rename frontend_tests/puppeteer_tests/{11-user-deactivation.ts => user-deactivation.ts} (100%) diff --git a/docs/testing/testing-with-puppeteer.md b/docs/testing/testing-with-puppeteer.md index de58210ad3..8cdaa8d2ab 100644 --- a/docs/testing/testing-with-puppeteer.md +++ b/docs/testing/testing-with-puppeteer.md @@ -73,7 +73,7 @@ integration](../testing/continuous-integration.md): affects any of the selectors used in the tests? If so, the test may just need to be updated for your changes. * Does the test fail deterministically when you run it locally using - E.g. `./tools/test-js-with-puppeteer 03`? If so, you can + E.g. `./tools/test-js-with-puppeteer compose.ts`? If so, you can iteratively debug to see the failure. * Does the test fail nondeterministically? If so, the problem is likely that a `waitForSelector` statement is either missing or not diff --git a/docs/testing/testing.md b/docs/testing/testing.md index 6e61d85ba8..5c1da100f5 100644 --- a/docs/testing/testing.md +++ b/docs/testing/testing.md @@ -35,7 +35,7 @@ typically involve running subsets of the tests with commands like these: ./tools/lint zerver/lib/actions.py # Lint the file you just changed ./tools/test-backend zerver.tests.test_markdown.MarkdownTest.test_inline_youtube ./tools/test-backend MarkdownTest # Run `test-backend --help` for more options -./tools/test-js-with-puppeteer 07-navigation.js +./tools/test-js-with-puppeteer navigation.ts ./tools/test-js-with-node utils.js ``` diff --git a/docs/tutorials/new-feature-tutorial.md b/docs/tutorials/new-feature-tutorial.md index 94ca645890..a8023e0ba1 100644 --- a/docs/tutorials/new-feature-tutorial.md +++ b/docs/tutorials/new-feature-tutorial.md @@ -56,7 +56,7 @@ organization in Zulip). The following files are involved in the process: zerver/lib/events.py implementation. **Frontend testing** -- `frontend_tests/puppeteer_tests/08-admin.js`: end-to-end tests for the organization +- `frontend_tests/puppeteer_tests/admin.ts`: end-to-end tests for the organization admin settings pages. - `frontend_tests/node_tests/dispatch.js` diff --git a/frontend_tests/puppeteer_tests/08-admin.ts b/frontend_tests/puppeteer_tests/admin.ts similarity index 100% rename from frontend_tests/puppeteer_tests/08-admin.ts rename to frontend_tests/puppeteer_tests/admin.ts diff --git a/frontend_tests/puppeteer_tests/03-compose.ts b/frontend_tests/puppeteer_tests/compose.ts similarity index 100% rename from frontend_tests/puppeteer_tests/03-compose.ts rename to frontend_tests/puppeteer_tests/compose.ts diff --git a/frontend_tests/puppeteer_tests/14-copy-and-paste.ts b/frontend_tests/puppeteer_tests/copy-and-paste.ts similarity index 100% rename from frontend_tests/puppeteer_tests/14-copy-and-paste.ts rename to frontend_tests/puppeteer_tests/copy-and-paste.ts diff --git a/frontend_tests/puppeteer_tests/10-custom-profile.ts b/frontend_tests/puppeteer_tests/custom-profile.ts similarity index 100% rename from frontend_tests/puppeteer_tests/10-custom-profile.ts rename to frontend_tests/puppeteer_tests/custom-profile.ts diff --git a/frontend_tests/puppeteer_tests/13-delete-message.ts b/frontend_tests/puppeteer_tests/delete-message.ts similarity index 100% rename from frontend_tests/puppeteer_tests/13-delete-message.ts rename to frontend_tests/puppeteer_tests/delete-message.ts diff --git a/frontend_tests/puppeteer_tests/12-drafts.ts b/frontend_tests/puppeteer_tests/drafts.ts similarity index 100% rename from frontend_tests/puppeteer_tests/12-drafts.ts rename to frontend_tests/puppeteer_tests/drafts.ts diff --git a/frontend_tests/puppeteer_tests/06-edit.ts b/frontend_tests/puppeteer_tests/edit.ts similarity index 100% rename from frontend_tests/puppeteer_tests/06-edit.ts rename to frontend_tests/puppeteer_tests/edit.ts diff --git a/frontend_tests/puppeteer_tests/09-mention.ts b/frontend_tests/puppeteer_tests/mention.ts similarity index 100% rename from frontend_tests/puppeteer_tests/09-mention.ts rename to frontend_tests/puppeteer_tests/mention.ts diff --git a/frontend_tests/puppeteer_tests/02-message-basics.ts b/frontend_tests/puppeteer_tests/message-basics.ts similarity index 100% rename from frontend_tests/puppeteer_tests/02-message-basics.ts rename to frontend_tests/puppeteer_tests/message-basics.ts diff --git a/frontend_tests/puppeteer_tests/07-navigation.ts b/frontend_tests/puppeteer_tests/navigation.ts similarity index 100% rename from frontend_tests/puppeteer_tests/07-navigation.ts rename to frontend_tests/puppeteer_tests/navigation.ts diff --git a/frontend_tests/puppeteer_tests/01-realm-creation.ts b/frontend_tests/puppeteer_tests/realm-creation.ts similarity index 100% rename from frontend_tests/puppeteer_tests/01-realm-creation.ts rename to frontend_tests/puppeteer_tests/realm-creation.ts diff --git a/frontend_tests/puppeteer_tests/15-realm-linkifier.ts b/frontend_tests/puppeteer_tests/realm-linkifier.ts similarity index 100% rename from frontend_tests/puppeteer_tests/15-realm-linkifier.ts rename to frontend_tests/puppeteer_tests/realm-linkifier.ts diff --git a/frontend_tests/puppeteer_tests/16-settings.ts b/frontend_tests/puppeteer_tests/settings.ts similarity index 100% rename from frontend_tests/puppeteer_tests/16-settings.ts rename to frontend_tests/puppeteer_tests/settings.ts diff --git a/frontend_tests/puppeteer_tests/05-stars.ts b/frontend_tests/puppeteer_tests/stars.ts similarity index 100% rename from frontend_tests/puppeteer_tests/05-stars.ts rename to frontend_tests/puppeteer_tests/stars.ts diff --git a/frontend_tests/puppeteer_tests/04-subscriptions.ts b/frontend_tests/puppeteer_tests/subscriptions.ts similarity index 100% rename from frontend_tests/puppeteer_tests/04-subscriptions.ts rename to frontend_tests/puppeteer_tests/subscriptions.ts diff --git a/frontend_tests/puppeteer_tests/11-user-deactivation.ts b/frontend_tests/puppeteer_tests/user-deactivation.ts similarity index 100% rename from frontend_tests/puppeteer_tests/11-user-deactivation.ts rename to frontend_tests/puppeteer_tests/user-deactivation.ts diff --git a/tools/message-screenshot.js b/tools/message-screenshot.js index 020c9ef751..dcd29936cb 100644 --- a/tools/message-screenshot.js +++ b/tools/message-screenshot.js @@ -26,7 +26,7 @@ if (options.messageId === undefined) { process.exit(1); } -// TODO: Refactor to share code with frontend_tests/puppeteer_tests/01-realm-creation.js +// TODO: Refactor to share code with frontend_tests/puppeteer_tests/realm-creation.ts async function run() { const browser = await puppeteer.launch({ args: [ diff --git a/tools/test-js-with-puppeteer b/tools/test-js-with-puppeteer index 26e874855f..eceb3574f9 100755 --- a/tools/test-js-with-puppeteer +++ b/tools/test-js-with-puppeteer @@ -28,10 +28,10 @@ os.environ.pop("https_proxy", "") usage = """test-js-with-puppeteer [options] test-js-with-puppeteer # Run all test files - test-js-with-puppeteer 09-navigation.js # Run a single test file - test-js-with-puppeteer 09 # Run a single test file 09-navigation.js - test-js-with-puppeteer 01-login.js 03-narrow.js # Run a few test files - test-js-with-puppeteer 01 03 # Run a few test files, 01-login.js and 03-narrow.js here""" + test-js-with-puppeteer navigation.ts # Run a single test file + test-js-with-puppeteer navi # Run a single test file navigation.ts + test-js-with-puppeteer login.ts compose.ts # Run a few test files + test-js-with-puppeteer login compose # Run a few test files, login.ts and compose.ts here""" sys.path.insert(0, ZULIP_PATH)