specialwatchlist.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. const assert = require( 'assert' ),
  2. Api = require( 'wdio-mediawiki/Api' ),
  3. WatchlistPage = require( '../pageobjects/watchlist.page' ),
  4. WatchablePage = require( '../pageobjects/watchable.page' ),
  5. LoginPage = require( 'wdio-mediawiki/LoginPage' ),
  6. Util = require( 'wdio-mediawiki/Util' );
  7. describe( 'Special:Watchlist', function () {
  8. let username, password;
  9. before( function () {
  10. username = Util.getTestString( 'user-' );
  11. password = Util.getTestString( 'password-' );
  12. browser.call( function () {
  13. return Api.createAccount( username, password );
  14. } );
  15. } );
  16. beforeEach( function () {
  17. browser.deleteCookie();
  18. LoginPage.login( username, password );
  19. } );
  20. it( 'should show page with new edit', function () {
  21. const title = Util.getTestString( 'Title-' );
  22. browser.call( function () {
  23. return Api.edit( title, Util.getTestString() ); // create
  24. } );
  25. WatchablePage.watch( title );
  26. browser.call( function () {
  27. return Api.edit( title, Util.getTestString() ); // edit
  28. } );
  29. WatchlistPage.open();
  30. assert.strictEqual( WatchlistPage.titles[ 0 ].getText(), title );
  31. } );
  32. } );