Skip to content

Commit

Permalink
Property Page methods
Browse files Browse the repository at this point in the history
  • Loading branch information
RickiJay-WMDE committed Feb 19, 2024
1 parent 65953eb commit 248beb3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
11 changes: 11 additions & 0 deletions test/helpers/pages/entity/property.page.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
import { Page } from '../page.js';

class PropertyPage extends Page {
public get changeHistoryList(): ChainablePromiseElement {
return $( 'ul.mw-contributions-list' );
}
public get mostRecentChange(): ChainablePromiseElement {
return this.changeHistoryList.$( 'li.before' );
}

public async openHistoryTab(): Promise<void> {
return $( '=View history' ).click();
}

/**
* `/wiki/Property:${propertyId}
*
Expand Down
22 changes: 11 additions & 11 deletions test/specs/repo/property.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe( 'Property', function () {
} );

it( 'Should show changes in "View history" tab', async () => {
await $( '=View history' ).click();
await PropertyPage.openHistoryTab();
await expect( $( '.comment*=Created claim' ) ).toExist();
await expect( $( '.comment*=Changed claim' ) ).toExist();
await expect( $( '.comment*=Created a new Property' ) ).toExist();
Expand All @@ -92,25 +92,25 @@ describe( 'Property', function () {
} );

it( 'Should be able to revert a change', async () => {
await $( '=View history' ).click();
await PropertyPage.openHistoryTab();
await expect(
( await $( 'ul.mw-contributions-list' ).$$( 'li' ) ).length
).toBe( 3 );
await $( 'ul.mw-contributions-list' ).$( 'li.before' ).$( 'a=undo' ).click();
await PropertyPage.changeHistoryList.$$( 'li' )
).toHaveLength( 3 );
await PropertyPage.mostRecentChange.$( 'a=undo' ).click();
await $(
'label=Summary (will be appended to an automatically generated summary):'
).click();
await browser.keys( undoSummaryText.split( '' ) );
await $( 'button=Save page' ).click();

await $( '=View history' ).click();
await PropertyPage.openHistoryTab();
await expect(
( await $( 'ul.mw-contributions-list' ).$$( 'li' ) ).length
).toBe( 4 );
await PropertyPage.changeHistoryList.$$( 'li' )
).toHaveLength( 4 );
await expect( $( 'span.mw-tag-marker-mw-undo' ) ).toExist();
await expect(
$( 'ul.mw-contributions-list' ).$( 'li.before' )
).toHaveTextContaining( undoSummaryText );
await expect( PropertyPage.mostRecentChange ).toHaveTextContaining(
undoSummaryText
);
} );

it( 'Should be able to set label, description, aliases', async () => {
Expand Down

0 comments on commit 248beb3

Please sign in to comment.