Skip to content
This repository has been archived by the owner on Jan 4, 2023. It is now read-only.

docs(contributing): add CONTRIBUTING.md file #1

Merged
merged 6 commits into from
Sep 4, 2019
Merged

Conversation

yannickcr
Copy link
Contributor

@yannickcr yannickcr commented Aug 23, 2019

CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
Copy link

@Haroenv Haroenv left a comment

Choose a reason for hiding this comment

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

apparently I didn't submit my reviews

CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Show resolved Hide resolved
CONTRIBUTING.md Outdated
- Use helper functions when possible, for readability but also for maintainability (if one widget is updated, we only have to updates its helpers without touching the tests). [More about Helpers](#helpers).
- Do not make assertions to know if an action was correctly performed in the browser. If an action fails (trying to click on an non-existing element for example) then WebdriverIO will automatically throw and fail the test, so asserting on it ourselves is redundant.
- Only assert what you want to see on the page after an action (Is this element displayed? Is the result list correct? etc.)
- You may need to add some additional steps compared to the original scenario, to wait for some elements to update for example (this was not done in the example above for simplicity).
Copy link

Choose a reason for hiding this comment

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

maybe add a permalink to somewhere we do this?

CONTRIBUTING.md Show resolved Hide resolved
General guidelines when writing tests:

- Each step should be translated as a `it` function, while this is not mandatory it helps to make the scenario more readable and properly [separate each actions in Sauce Labs reports](https://user-images.githubusercontent.com/13209/62311104-56217d80-b48b-11e9-94dc-3c18b9ddc2af.png).
- All actions on the browser are asynchronous, so be sure to always `await` them. **Never run multiple asynchronous commands in parallel as it can confuse some browsers (Internet Explorer)**.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is using await really necessary in our case? Since we're using the bakedin test runner await is implicit:

https://webdriver.io/docs/setuptypes.html#the-wdio-testrunner

It can still be something we want to enforce anyway

Copy link
Contributor Author

@yannickcr yannickcr Sep 3, 2019

Choose a reason for hiding this comment

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

Yeah, I'm not sure their documentation is correct since all the commands still returns Promises and I had some issues when not using await 😐.

But it will be enforced by the @typescript-eslint/no-floating-promises ESLint rule so we should not have any problem with this.

CONTRIBUTING.md Outdated
- All actions on the browser are asynchronous, so be sure to always `await` them. **Never run multiple asynchronous commands in parallel as it can confuse some browsers (Internet Explorer)**.
- Use helper functions when possible, for readability but also for maintainability (if one widget is updated, we only have to updates its helpers without touching the tests). [More about Helpers](#helpers).
- Do not make assertions to know if an action was correctly performed in the browser. If an action fails (trying to click on an non-existing element for example) then WebdriverIO will automatically throw and fail the test, so asserting on it ourselves is redundant.
- Only assert what you want to see on the page after an action (Is this element displayed? Is the result list correct? etc.)
Copy link
Contributor

@tkrugg tkrugg Aug 30, 2019

Choose a reason for hiding this comment

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

Great advice.
However for the particular case of "is the element displayed?" I think it falls in the category of things wdio automatically waits for and throws if KO:
Another way to say it is:
Instead of expect(browser.$$('div').length).to.be(1) use https://webdriver.io/docs/api/element/waitForDisplayed.html

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it has some build in helpers for this and it will automatically throw, so maybe not a good example since we are in fact in the case described above ("WebdriverIO will automatically throw and fail the test, so asserting on it ourselves is redundant"). I will update this example.

Copy link

@Haroenv Haroenv left a comment

Choose a reason for hiding this comment

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

Lets do it!

@Haroenv Haroenv merged commit e916f7a into master Sep 4, 2019
Haroenv pushed a commit to algolia/instantsearch that referenced this pull request Nov 24, 2022
…2e-tests#1)

* docs(contributing): add CONTRIBUTING.md file

* Apply suggestions from code review

Co-Authored-By: François Chalifour <[email protected]>

* docs(contributing): fix introduction phrasing

* docs(contributing): add links to directories and files

* Update CONTRIBUTING.md

Co-Authored-By: Haroen Viaene <[email protected]>

* Apply feedbacks
Haroenv pushed a commit to algolia/instantsearch that referenced this pull request Nov 24, 2022
…2e-tests#1)

* docs(contributing): add CONTRIBUTING.md file

* Apply suggestions from code review

Co-Authored-By: François Chalifour <[email protected]>

* docs(contributing): fix introduction phrasing

* docs(contributing): add links to directories and files

* Update CONTRIBUTING.md

Co-Authored-By: Haroen Viaene <[email protected]>

* Apply feedbacks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants