-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* test(property-list): reproduce new property not shown issue * fix: configure cache and wait for it to timeout * fix: lint * fix: list of properties page test for more than 50 properties
- Loading branch information
1 parent
b2ead8d
commit d85f004
Showing
5 changed files
with
62 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import Page from '../page.js'; | ||
import awaitDisplayed from '../../await-displayed.js'; | ||
|
||
class SpecialListProperties extends Page { | ||
public get content(): ChainablePromiseElement { | ||
return $( '.mw-spcontent' ); | ||
} | ||
public get properties(): ChainablePromiseArray { | ||
return $$( '.mw-spcontent ol li' ); | ||
} | ||
|
||
public async openParams( params: { | ||
dataType?: string; | ||
limit?: number; | ||
offset?: number; | ||
} ): Promise<void> { | ||
const dataType = 'datatype=' + ( params.dataType ?? '' ); | ||
const limit = 'limit=' + ( params.limit ?? 50 ); | ||
const offset = 'offset=' + ( params.offset ?? 0 ); | ||
|
||
await browser.url( | ||
`${process.env.MW_SERVER}/wiki/Special:ListProperties?${dataType}&${limit}&${offset}` | ||
); | ||
|
||
await awaitDisplayed( this.content ); | ||
} | ||
} | ||
|
||
export default new SpecialListProperties(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,39 @@ | ||
import assert from 'assert'; | ||
import SpecialListProperties from '../../helpers/pages/special/list-properties.page.js'; | ||
import SpecialNewProperty from '../../helpers/pages/special/new-property.page.js'; | ||
|
||
describe( 'Special:NewProperty', function () { | ||
it( 'Should be able to create a new property', async () => { | ||
await SpecialNewProperty.open( 'string' ); | ||
|
||
const labelInput = await SpecialNewProperty.labelInput; | ||
await labelInput.setValue( 'Cool label' ); | ||
|
||
const descriptionInput = await SpecialNewProperty.descriptionInput; | ||
await descriptionInput.setValue( 'Cool description' ); | ||
|
||
const aliasesInput = await SpecialNewProperty.aliasesInput; | ||
await aliasesInput.setValue( 'Great job!|Bra Jobbat' ); | ||
|
||
await SpecialNewProperty.labelInput.setValue( 'Cool label' ); | ||
await SpecialNewProperty.descriptionInput.setValue( 'Cool description' ); | ||
await SpecialNewProperty.aliasesInput.setValue( 'Great job!|Bra Jobbat' ); | ||
await SpecialNewProperty.submit(); | ||
|
||
const propertyviewDatatypeValueEl = await $( | ||
'.wikibase-propertyview-datatype-value' | ||
); | ||
const dataTypeText = await propertyviewDatatypeValueEl.getText(); | ||
|
||
assert.strictEqual( dataTypeText, 'String' ); | ||
} ); | ||
|
||
it( 'Should be able to see newly created properties in list of properties special page', async () => { | ||
await SpecialListProperties.openParams( { limit: 1000 } ); | ||
const numberOfPropertiesBefore = await SpecialListProperties.properties.length; | ||
|
||
await SpecialNewProperty.open( 'string' ); | ||
await SpecialNewProperty.labelInput.setValue( 'Property type string' ); | ||
await SpecialNewProperty.descriptionInput.setValue( 'A string property' ); | ||
await SpecialNewProperty.submit(); | ||
|
||
// wait for the $wgWBRepoSettings['sharedCacheDuration'] cache to | ||
// timeout, so the list of properties reflects the change | ||
await browser.pause( 1100 ); | ||
|
||
await SpecialListProperties.openParams( { limit: 1000 } ); | ||
const numberOfPropertiesAfter = await SpecialListProperties.properties.length; | ||
|
||
assert.strictEqual( numberOfPropertiesAfter, numberOfPropertiesBefore + 1 ); | ||
} ); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters