- Epic it contributes to.
- {T396139}
- Acceptance criteria
[] Determine if Page Object Pattern we use ([[ https://www.mediawiki.org/wiki/Selenium/Explanation/Page_object_pattern | Selenium/Explanation/Page object pattern ]]) is the same as in upstream documentation ([[ https://webdriver.io/docs/pageobjects/ | WebdriverIO Page Object Pattern ]]).
[] If there are significant differences, create one or more tasks to minimize or remove the differences.
[] If there are no significant differences, close this task.
# Context
Since at least 2018 (when this ticket was created) our Page Object Pattern was different that what upstream documentation (WebdriverIO) recommends. The only difference was that upstream was using ECMAScript modules while we were using CommonJS.
`tests/selenium/pageobjects/page.js`
Before:
```lang=js
class Page {
...
}
module.exports = Page;
```
After
```lang=js
export default class Page {
...
}
```
`tests/selenium/pageobjects/userlogin.page.js`
Before:
```lang=js
const Page = require( './page' );
class UserLoginPage extends Page {
...
}
module.exports = new UserLoginPage();
```
After
```lang=js
import Page from './page';
class UserLoginPage extends Page {
...
}
export default new UserLoginPage();
```
`tests/selenium/specs/user.js`
Before:
```lang=js
...
const assert = require( 'assert' ),
CreateAccountPage = require( '../pageobjects/createaccount.page' ),
PreferencesPage = require( '../pageobjects/preferences.page' ),
UserLoginPage = require( '../pageobjects/userlogin.page' );
...
```
After
```lang=js
...
const assert = require( 'assert' );
import CreateAccountPage from '../pageobjects/createaccount.page';
import PreferencesPage from '../pageobjects/preferences.page';
import UserLoginPage from '../pageobjects/userlogin.page';
...
```