Page MenuHomePhabricator

Micro-task: Create a simple test using Puppeteer
Closed, ResolvedPublic

Description

Pick a simple test from mediawiki/core, for example User should be able to create account and implement it using Puppeteer. 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

@zeljkofilipin @Jpita added you for review. Sorry for the delay, coronavirus lockdown leading to internet issues

Change 584040 had a related patch set uploaded (by Zfilipin; owner: AlQaholic007):
[mediawiki/core@master] added jest tests

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

Change 584039 had a related patch set uploaded (by Zfilipin; owner: AlQaholic007):
[mediawiki/core@master] added jest tests

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

Change 584079 had a related patch set uploaded (by Zfilipin; owner: Gbahdeyboh):
[mediawiki/core@REL1_34] Micro-task: Create a simple test using Puppeteer

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

Change 584079 abandoned by Zfilipin:
Micro-task: Create a simple test using Puppeteer

Reason:
Please clone mediawiki/core from here https://gerrit.wikimedia.org/r/admin/projects/mediawiki/core

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

Change 584039 abandoned by Zfilipin:
added jest tests

Reason:
Please submit as one commit.

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

Change 584040 abandoned by Zfilipin:
added jest tests

Reason:
Please submit as one commit.

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

Change 584039 abandoned by Zfilipin:
added jest tests

Reason:
Please submit as one commit.

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

Change 584040 abandoned by Zfilipin:
added jest tests

Reason:
Please submit as one commit.

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

@AlQaholic007 You've created two commits. Gerrit workflow is different than Github (for better or worse, but it is different). If the first commit doesn't have all the changes, you should amend it, not push another commit. Let me know if you need help with that.

Change 584079 abandoned by Zfilipin:
Micro-task: Create a simple test using Puppeteer

Reason:
Please clone mediawiki/core from here https://gerrit.wikimedia.org/r/admin/projects/mediawiki/core

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

@Gbahdeyboh You've somehow cloned the wrong branch. You should clone master branch. There's more information in T248710#6007287. Let me know if you need help with cloning from or pushing to Gerrit.

Change 584039 abandoned by Zfilipin:
added jest tests

Reason:
Please submit as one commit.

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

Change 584040 abandoned by Zfilipin:
added jest tests

Reason:
Please submit as one commit.

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

@AlQaholic007 You've created two commits. Gerrit workflow is different than Github (for better or worse, but it is different). If the first commit doesn't have all the changes, you should amend it, not push another commit. Let me know if you need help with that.

Opps actually i had forgotten to add untracked files during first commit which is why. Can you help me with this

@zeljkofilipin please check if the tests run via

npx jest --forceExit

I forgot to add that script in package.json

In T248219#6007384, @AlQaholic007 wrote:

Opps actually i had forgotten to add untracked files during first commit which is why. Can you help me with this

See https://www.mediawiki.org/wiki/Gerrit/Tutorial#Amending_a_change_.28your_own_or_someone_else.27s.29

Hey @Aklapper fortunately @zeljkofilipin helped me out through this. I was not aware that gerrit follows a different work flow

Change 584129 had a related patch set uploaded (by Zfilipin; owner: AlQaholic007):
[mediawiki/core@master] added pupputeer tests

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

Change 584646 had a related patch set uploaded (by Zfilipin; owner: Gbahdeyboh):
[mediawiki/core@master] Micro-task: Create a simple test using Puppeteer

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

Change 584908 had a related patch set uploaded (by Zfilipin; owner: AlQaholic007):
[mediawiki/core@master] puppeteer tests

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

Change 584908 had a related patch set uploaded (by AlQaholic007; owner: AlQaholic007):
[mediawiki/core@master] Implemented a simple puppeteer test to check for admin login functionality

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

Change 584129 abandoned by AlQaholic007:
added pupputeer tests

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

I have been able to complete this task here.

Feedbacks are very welcomed! ๐Ÿ™‚

Change 585326 had a related patch set uploaded (by Zfilipin; owner: Hoo man):
[mediawiki/core@master] Micro-task: Create a simple test using Puppeteer(Added chrome and firefox support)

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

Change 585326 abandoned by Gbahdeyboh:
Micro-task: Create a simple test using Puppeteer(Added chrome and firefox support)

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

Change 585326 restored by Gbahdeyboh:
Micro-task: Create a simple test using Puppeteer(Added chrome and firefox support)

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

Change 584646 abandoned by Gbahdeyboh:
Micro-task: Create a simple test using Puppeteer

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

Change 587574 had a related patch set uploaded (by Gbahdeyboh; owner: Gbahdeyboh):
[mediawiki/core@master] Micro-task: Create a simple test using Puppeteer

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

Change 589800 had a related patch set uploaded (by Gbahdeyboh; owner: Gbahdeyboh):
[mediawiki/core@master] Micro-task: Create a simple test using Puppeteer

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

Change 589800 abandoned by Gbahdeyboh:
Micro-task: Create a simple test using Puppeteer

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

Change 589804 had a related patch set uploaded (by Gbahdeyboh; owner: Gbahdeyboh):
[mediawiki/core@master] Micro-task: Create a simple test using Puppeteer

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

Change 587574 abandoned by Gbahdeyboh:
Micro-task: Create a simple test using Puppeteer

Reason:
I'm having the same issues I had with the playwright patch, each push I make goes to a new patch entirely.

I created a new commit here. https://gerrit.wikimedia.org/r/#/c/mediawiki/core/ /589804/

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

Change 589804 abandoned by Zfilipin:
Micro-task: Create a simple test using Puppeteer

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

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

Change 598257 had a related patch set uploaded (by AlQaholic007; owner: AlQaholic007):
[mediawiki/core@master] Puppeteer: Setup puppeteer and configure ESLint for puppeteer

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

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

Change 584908 abandoned by AlQaholic007:
GSOC 2020 Microtask: A simple puppeteer test to check for admin login functionality

Reason:
GSOC application period is over.

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