Is it possible to create read-only properties in object literals?
export const Page = {
email: 'input[type=email]',
password: 'input[type=password]',
fillLoginCredentials() {
cy.get(this.email).type('email');
cy.get(this.password).type('password');
}
Just to give you a heads up, this is a page object utilized for cypress testing. Although I know how to make these properties immutable using classes, I prefer the simplicity of object literals with static methods.
In general terms, are there any specific advantages to using classes instead?