Skip to content
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

Refine prompts and output #71

Merged
merged 5 commits into from
Nov 18, 2022
Merged

Refine prompts and output #71

merged 5 commits into from
Nov 18, 2022

Conversation

beatfactor
Copy link
Member

@beatfactor beatfactor commented Nov 13, 2022

Renamed most of the prompts to match a more active voice and tone in order to simplify the onboarding process overall. This is also according to our own documentation style guide, namely:

  • Use active voice. Think of it as you being the guiding teacher to the user
  • Be in the present
  • Write short sentences that are crisp and concise

Changes reflect a more imperative style:

  • prompts present commands instead of questions which look like things to do rather than decisions to take
  • impersonal approach ("your" / "my" is removed from the text)

New onboarding process:

-  Select language + test runner variant
   - JavaScript / default 
   - TypeScript / default 
   - JavaScript / Mocha 
   - JavaScript / CucumberJS  
- Select target browsers
- Enter source folder where test files are stored (test)
- Enter the base_url of the project (http://localhost)
- Select where to run Nightwatch tests (Use arrow keys)
  -  On localhost 
  - On a remote/cloud service 
  - Both  
- Allow Nightwatch to collect completely anonymous usage metrics? (y/N) 
-  Setup testing on Mobile devices as well? 

Other changes:

  • refactored template tests
  • refactored tests to be compatible with Mocha

The only prompt which I am not very sure of is "Select where to run Nightwatch tests"; to users who aren't familiar with Selenium or cloud testing services this prompt will most likely be confusing. We should probably change it to be similar to the one for mobile testing setup, e.g.:

- Setup Nightwatch to connect to a remote testing service?
   - No, skip for now (default)
   - Yes    

src/constants.ts Outdated Show resolved Hide resolved
src/constants.ts Outdated Show resolved Hide resolved

// Join Discord and GitHub
Logger.info('💬 Join our Discord community to find answers to your issues or queries. Or just join and say hi.');
Logger.info(colors.cyan(' https://discord.gg/SN8Da2X'), '\n');
Copy link
Member

Choose a reason for hiding this comment

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

Skipping GitHub is intentional here? Since the comment above still mentions GitHub.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, displaying the Github link adds no real value to the output.

test/e2e_tests/init.js Outdated Show resolved Hide resolved
test/unit_tests/testIndex.js Outdated Show resolved Hide resolved
"eslint": "^8.17.0",
"chromedriver": "^107.0.3",
"eslint": "^8.27.0",
"mocha": "^10.1.0",
Copy link
Member

Choose a reason for hiding this comment

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

I think chromedriver and mocha are not required in this project as a dependency.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm using mocha to run the tests, in addition to nightwatch.

Copy link
Member Author

Choose a reason for hiding this comment

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

At the moment there is only one test failing if you run it with mocha and I think that having mocha as an option to run the unit tests locally it's useful.

Copy link
Member Author

@beatfactor beatfactor left a comment

Choose a reason for hiding this comment

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

updated browsers prompt.

src/constants.ts Outdated

// BROWSERS
{
type: 'checkbox',
name: 'browsers',
message: 'Which browsers will you be testing on?',
message: 'Select target browsers',
choices: (answers) => {
let browsers = BROWSER_CHOICES;
if (answers.backend === 'local' && process.platform !== 'darwin') {
Copy link
Member Author

Choose a reason for hiding this comment

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

Suggested change
if (answers.backend === 'local' && process.platform !== 'darwin') {
if (process.platform !== 'darwin') {

Copy link
Member

Choose a reason for hiding this comment

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

But this will also remove 'Safari' for users who want to test on Safari browser on remote/cloud service from Windows/Linux machine.

Maybe we can just remove this if block so that 'Safari' appears everytime, or if the user's system is non-mac, we can change the option to something like 'Safari (cloud only)'?

Copy link
Member Author

Choose a reason for hiding this comment

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

Adding Safari (cloud only) will only complicate things further because we have to handle the case where you select Safari and do not select cloud. So I think for now it's ok to just show Safari for Mac because advanced users who want to test on cloud safari can always add the config manually.

Copy link
Member

Choose a reason for hiding this comment

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

The case of selecting Safari and then not selecting cloud is already handled though, in refineAnswers method.
(refineAnswers is written in a way that even if there are discrepancies in the input answers, the output should always be in the right format.)

But I am okay with both approaches.

Copy link
Member Author

Choose a reason for hiding this comment

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

so an error will already be thrown?

Copy link
Member

Choose a reason for hiding this comment

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

No, 'safari' is silently removed from local browsers list if the user is on a non-mac machine.

src/constants.ts Outdated Show resolved Hide resolved
Co-authored-by: Priyansh Garg <39924567+garg3133@users.noreply.github.com>
@beatfactor beatfactor mentioned this pull request Nov 17, 2022
3 tasks
@beatfactor
Copy link
Member Author

@vishalshah133 any thoughts here? this would be needed to be merged as @harshit-bs is already working on adding support for component testing.

Copy link
Member

@garg3133 garg3133 left a comment

Choose a reason for hiding this comment

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

LGTM! Just waiting on @vishalshah133 to review the questions flow once.

@garg3133 garg3133 merged commit 0da9fcb into main Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants