Page MenuHomePhabricator

Micro-task: Create a simple test with Microsoft Playwright
Closed, ResolvedPublic

Description

NOTE: Microsoft Playwright is relatively new and therefore is currently lacking documentation. However it appears quite promising from what it promises to give in near future. The aim of this task is to just play around with Microsoft Playwright.

Pick a simple test from mediawiki/core, for example User should be able to create account and implement it using Microsoft Playwright. Feel free to pick any other test, this is just an example.

WebdriverIO implementation:

https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/master/tests/selenium/specs/user.js#21

describe( 'User', function () {
	it( 'should be able to create account', function () {
		// create
		CreateAccountPage.createAccount( username, password );
		// check
		assert.strictEqual( CreateAccountPage.heading.getText(), `Welcome, ${username}!` );
	} );
} );

https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/master/tests/selenium/pageobjects/createaccount.page.js

class CreateAccountPage extends Page {
	get username() { return $( '#wpName2' ); }
	get password() { return $( '#wpPassword2' ); }
	get confirmPassword() { return $( '#wpRetype' ); }
	get create() { return $( '#wpCreateaccount' ); }
	get heading() { return $( '#firstHeading' ); }
	open() {
		super.openTitle( 'Special:CreateAccount' );
	}
	createAccount( username, password ) {
		this.open();
		this.username.setValue( username );
		this.password.setValue( password );
		this.confirmPassword.setValue( password );
		this.create.click();
	}
}

Steps:

  • open Special:CreateAccount page
  • populate required fileds with random strings
  • click Create your account button

Assertions:

check that text Welcome, ${username}! appears on the page
For more information on page object pattern see (draft) page https://www.mediawiki.org/wiki/Selenium/Explanation/Page_object_pattern

Students:

Event Timeline

Change 588667 had a related patch set uploaded (by AlQaholic007; owner: AlQaholic007):
[mediawiki/core@master] GSOC Micro-task: Create a simple test using Microsoft Playwright

https://gerrit.wikimedia.org/r/588667

I'm trying to run tests using playwright here.

All tests pass locally but fails on CI. I think there is something wrong with my configuration but don't seem to know what's wrong

Change 588937 had a related patch set uploaded (by Gbahdeyboh; owner: Gbahdeyboh):
[mediawiki/core@master] Micro Task: Create a simple test using playwright

https://gerrit.wikimedia.org/r/588937

Change 589467 had a related patch set uploaded (by Gbahdeyboh; owner: Gbahdeyboh):
[mediawiki/core@master] Micro Task: Create a simple test using playwright

https://gerrit.wikimedia.org/r/589467

Change 589467 abandoned by Gbahdeyboh:
Micro Task: Create a simple test using playwright

https://gerrit.wikimedia.org/r/589467

Change 588937 abandoned by Gbahdeyboh:
Micro Task: Create a simple test using playwright

Reason:
I'm having issues pushing to this patch, each change I push goes to an entirely new patch rather than a patch set here..

I created a new branch to work with, I am abandoning this patch.

The new patch can be found here https://gerrit.wikimedia.org/r/#/c/mediawiki/core/ /589591/-1..2

https://gerrit.wikimedia.org/r/588937

Change 589737 had a related patch set uploaded (by Gbahdeyboh; owner: Gbahdeyboh):
[mediawiki/core@master] Micro Task: Create a simple test using playwright

https://gerrit.wikimedia.org/r/589737

I'm trying to run tests using playwright here.

All tests pass locally but fails on CI. I think there is something wrong with my configuration but don't seem to know what's wrong

Hey @Gbahdeyboh. It is most likely an issue with missing dependencies. @Jpita has had a discussion stating that if it were dependency issues on the CI, it would require another task. Let us see if it works once the dependencies are in place. If not then I plan to file a ticket on their Github

In T250132#6068009, @AlQaholic007 wrote:

I'm trying to run tests using playwright here.

All tests pass locally but fails on CI. I think there is something wrong with my configuration but don't seem to know what's wrong

Hey @Gbahdeyboh. It is most likely an issue with missing dependencies. @Jpita has had a discussion stating that if it were dependency issues on the CI, it would require another task. Let us see if it works once the dependencies are in place. If not then I plan to file a ticket on their Github

Hi @AlQaholic007 , from the errors I got on the CI. It has to do with a dependency fs.promises that isn't fully compatible with node js version 10(Experimental as at that version) and isn't available on any version of node lesser than 10. I'm not sure what node version the CI runs on, @Jpita or @zeljkofilipin should be able to help with that info?

So yeah, you're right about some dependencies being missing. Playwright needs some more configurations to be on docker on the CI to work as expected. All required dependencies can be found here.

I'm assuming the test should run fine on the CI if we have the dependencies stated above in place.

Also, if you try to change your version of node to one lesser than 10, you should get a similar or the same error as the one on the CI in your console.

This link here should be more relevant

https://github.com/microsoft/playwright/issues/1140

Additionally, I dug deeper to find this answer on stack overflow

I dug deeper to find this on stack overflow
@ThomasDondorf just a quick note for others, I resolved this, the problem was I was running playwright in a docker container build from node:Erbium and I did not have all the required dependencies

[Please strip unneeded parts of quotations which are not related to your reply, to keep things readable. Thanks!]

This link here should be more relevant

https://github.com/microsoft/playwright/issues/1140

Additionally, I dug deeper to find this answer on stack overflow

I dug deeper to find this on stack overflow
@ThomasDondorf just a quick note for others, I resolved this, the problem was I was running playwright in a docker container build from node:Erbium and I did not have all the required dependencies

@AlQaholic007 , Can you share a link to the stack overflow issue?

Im sorry I was bouncing around in incognito. I dont remember where I bumped into this or would have specified. However I feel before filling a ticket with Playwright, it would be worthwhile to first try what they have recommended. I dont think its an issue with Node.js version because Erbium release is for Node 12.x. A glance at their Docker repository would reveal so

In T250132#6068328, @AlQaholic007 wrote:

Im sorry I was bouncing around in incognito. I dont remember where I bumped into this or would have specified. However I feel before filling a ticket with Playwright, it would be worthwhile to first try what they have recommended. I dont think its an issue with Node.js version because Erbium release is for Node 12.x. A glance at their Docker repository would reveal so

From the logs I got on the CI here, the tests runs on node version v10.15.2 and npm v6.5.0.

Also, on playwrights docker file requirement, an installation of node 12.x was included.

Im sorry I was bouncing around in incognito. I dont remember where I bumped into this or would have specified

In T250132#6068328, @AlQaholic007 wrote:

Im sorry I was bouncing around in incognito. I dont remember where I bumped into this or would have specified. However I feel before filling a ticket with Playwright, it would be worthwhile to first try what they have recommended. I dont think its an issue with Node.js version because Erbium release is for Node 12.x. A glance at their Docker repository would reveal so

From the logs I got on the CI here, the tests runs on node version v10.15.2 and npm v6.5.0.

Also, on playwrights docker file requirement, an installation of node 12.x was included.

I meant from what Thomas mentioned on the answer above, Erbium is 12.x. A glance at NodeJS official Dockerhub repo should reveal so

Change 589737 abandoned by Zfilipin:
Micro Task: Create a simple test using playwright

Reason:
GSoC application period is finished. Let's continue collaborating on https://gerrit.wikimedia.org/r/c/mediawiki/core/ /588667

https://gerrit.wikimedia.org/r/589737

zeljkofilipin claimed this task.
zeljkofilipin updated the task description. (Show Details)

Change 588667 abandoned by AlQaholic007:
GSOC Micro-task: Create a simple test using Microsoft Playwright

Reason:
GSOC application period is over

https://gerrit.wikimedia.org/r/588667