Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement modular import for pages #2

Merged
merged 1 commit into from
Jan 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions cypress/e2e/auth.cy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import AuthPage from '../pages/auth.page'
import ProductsPage from '../pages/products.page'
import {AuthPage, ProductsPage} from '../pages'
import user from '../fixtures/user.json'
import error from '../fixtures/error.json'

Expand Down
3 changes: 1 addition & 2 deletions cypress/e2e/items.cy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import user from '../fixtures/user.json'
import ProductsPage from '../pages/products.page'
import CartPage from '../pages/cart.page'
import {ProductsPage, CartPage} from '../pages'

describe('Items', () => {
beforeEach(() => {
Expand Down
4 changes: 1 addition & 3 deletions cypress/pages/auth.page.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Page from './page'

class AuthPage extends Page {
export const AuthPage = new class extends Page {
get inputUsername() {return cy.get('[data-test="username"]')}
get inputPassword() {return cy.get('[data-test="password"]')}
get buttonLogIn() {return cy.get('[data-test="login-button"]')}
Expand All @@ -16,5 +16,3 @@ class AuthPage extends Page {
this.buttonLogIn.click()
}
}

export default new AuthPage()
4 changes: 1 addition & 3 deletions cypress/pages/cart.page.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import Page from './page'
import Navbar from '../elements/navbar'

class CartPage extends Page {
export const CartPage = new class extends Page {
navbar = Navbar

open() {
return super.open('/cart.html')
}
}

export default new CartPage()
3 changes: 3 additions & 0 deletions cypress/pages/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './auth.page'
export * from './products.page'
export * from './cart.page'
4 changes: 1 addition & 3 deletions cypress/pages/products.page.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import Page from './page'
import Navbar from '../elements/navbar'

class ProductsPage extends Page {
export const ProductsPage = new class extends Page {
navbar = Navbar

open() {
return super.open('/inventory.html')
}
}

export default new ProductsPage()
2 changes: 1 addition & 1 deletion cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import AuthPage from '../pages/auth.page'
import {AuthPage} from '../pages'

Cypress.Commands.add('login', (username, password) => {
AuthPage.open()
Expand Down