From ed40db0a1369e6a7f1d2a4906d5ce944794f6c4b Mon Sep 17 00:00:00 2001 From: Gleb Bahmutov Date: Fri, 24 Nov 2023 09:00:17 -0500 Subject: [PATCH] bonus55 lesson --- cypress/e2e/inventory/sort-names.cy.ts | 24 +++++++++++++++++++ cypress/e2e/inventory/sort-pom.cy.ts | 31 ------------------------ cypress/support/commands.ts | 33 ++++++++++++++++++++++---- cypress/support/index.d.ts | 9 ++++--- 4 files changed, 58 insertions(+), 39 deletions(-) create mode 100644 cypress/e2e/inventory/sort-names.cy.ts delete mode 100644 cypress/e2e/inventory/sort-pom.cy.ts diff --git a/cypress/e2e/inventory/sort-names.cy.ts b/cypress/e2e/inventory/sort-names.cy.ts new file mode 100644 index 0000000..d25575a --- /dev/null +++ b/cypress/e2e/inventory/sort-names.cy.ts @@ -0,0 +1,24 @@ +import { LoginPage } from '@support/pages/login.page' +import { LoginInfo } from '..' + +describe('Products', { viewportHeight: 1600 }, () => { + const user: LoginInfo = Cypress.env('users').standard + beforeEach(() => { + LoginPage.login(user.username, user.password) + + cy.visit('/inventory.html', { failOnStatusCode: false }) + cy.location('pathname').should('equal', '/inventory.html') + }) + + it('retrieves each sort order name', () => { + // fetch the list of options from the sort order SELECT element + cy.getByTest('product_sort_container') + // confirm there are at least a couple + // map each OPTION element to its inner text + // using cypress-map query cy.map + // optional: print the list of names + // + // then select each sort name one by one + // and confirm the sorting name shown on the page matches + }) +}) diff --git a/cypress/e2e/inventory/sort-pom.cy.ts b/cypress/e2e/inventory/sort-pom.cy.ts deleted file mode 100644 index eb9f8be..0000000 --- a/cypress/e2e/inventory/sort-pom.cy.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { LoginPage } from '@support/pages/login.page' -import { LoginInfo } from '..' - -const SortingPOM = { - sortBy(order: 'az' | 'za' | 'lohi' | 'hilo') { - // select the sorting order using the