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

Adding e2e test coverage #2400

Merged
merged 14 commits into from
May 7, 2022
Merged

Conversation

christian-bromann
Copy link
Contributor

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[ ] Feature
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[x] Other: adding test coverage

What is the current behavior?

Currently this extension has a set of simple unit tests. Unfortunately there is no assurance that the functionality works across operating systems. Also the tests are run within Travis which has been ceased.

What is the new behavior?

This patch adds a simple e2e test to ensure that the server starts and a browser is able to connect and receive files. It also moves the test execution to GitHub Action.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

I am the maintainer of WebdriverIO and recently started building VSCode extensions, e.g. Marquee. I've experienced that there wasn't good tooling for e2e test scenarios that are sometimes needed for complex extensions like yours.

@christian-bromann
Copy link
Contributor Author

I am currently testing the new pipeline in here: https://github.com/christian-bromann/vscode-live-server/actions

@christian-bromann
Copy link
Contributor Author

Tests are passing on Ubuntu, MacOS and Windows. To summarise this patch, it:

  • moves from AppVeyor to GitHub Actions for testing
  • adds an e2e test case that clicks on the "Go Live" link in the status bar and verifies that a browser is able to connect to the opened browser
  • adds a release pipeline (Note: this pipeline requires OPEN_VSX_TOKEN and VSC_MKTP_PAT tokens to be stored as repository secrets)

Happy to clarify certain changes or answer other questions. This is now ready for review.

@christian-bromann
Copy link
Contributor Author

@ritwickdey any comments?

Copy link
Owner

@ritwickdey ritwickdey left a comment

Choose a reason for hiding this comment

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

Thank you so much for the PR ❤️

test/e2e/example.e2e.ts Outdated Show resolved Hide resolved

it('should click on Go Live', async () => {
const workbench = await driver.getWorkbench();
await workbench.elem.$('div[id="ritwickdey.LiveServer"]').click();
Copy link
Owner

Choose a reason for hiding this comment

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

Is the ID defined by vscode?

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 is the extension id: <publisher>.<name>

browser = await remote({
capabilities: { browserName: 'chrome' }
});
const workbench = await driver.getWorkbench();
Copy link
Owner

Choose a reason for hiding this comment

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

(Looks good to me but this comment about the API)

I'm a bit confused here. Does driver.getWorkbench() gives vscode instance variable? driver is from webdriverio package. right?

@christian-bromann
Copy link
Contributor Author

I'm a bit confused here. Does driver.getWorkbench() gives vscode instance variable?

Yes, it is a page object that comes with the wdio-vscode-service plugin to easier navigate through the IDE application. I will make sure to create more documentation around it.

driver is from webdriverio package. right?

Correct.

Just pushed an update and tests passed.

@ritwickdey ritwickdey merged commit 6d2dfe5 into ritwickdey:master May 7, 2022
surya9372

This comment was marked as duplicate.

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