straight-rose-89671
12/14/2022, 10:07 AMcrooked-dress-73751
12/14/2022, 10:30 AMgray-kilobyte-89541
12/14/2022, 11:33 AMstraight-rose-89671
12/14/2022, 1:40 PMit('Clicking on a button - Load either page one step or page two', () => {
cy.intercept('/page/*/packages').as('getPage')
cy.intercept('/page/*/package').as('getPageTwo')
cy.getBySel('button-page')
.find('a')
.first()
.click()
cy.waitIfHappens({
alias: '@getPage',
timeout: 300,
yieldResponseBody: true,
}).then((body) => {
if (typeof body !== 'undefined' && body.data) {
cy.wrap(body.data.pagedata)
.its('length')
.should('be.gte', 1)
}
})
cy.waitIfHappens({
alias: '@getPageTwo',
timeout: 300,
yieldResponseBody: true,
}).then((body) => {
if (typeof body !== 'undefined' && body.data) {
cy.wrap(body.data.configurationData)
.its('length')
.should('be.gte', 1)
}
})
})
gray-kilobyte-89541
12/14/2022, 2:00 PMmysterious-psychiatrist-29678
12/14/2022, 2:01 PMstraight-rose-89671
12/14/2022, 2:09 PMthousands-house-85089
12/14/2022, 2:17 PMhelpful-dentist-23568
12/14/2022, 2:25 PMstraight-rose-89671
12/14/2022, 2:27 PMfresh-doctor-14925
12/14/2022, 2:33 PMmagnificent-cat-57082
12/14/2022, 3:37 PMmagnificent-cat-57082
12/14/2022, 3:37 PMclearAllSessionStorage
etc.handsome-army-58690
12/14/2022, 3:45 PMpowerful-king-41699
12/14/2022, 6:24 PMpowerful-king-41699
12/14/2022, 6:25 PMenv.cypressFFBaseUrl=cypressFFBaseUrl.trim()
env.FFHost=FFHost.trim()
bat script: """
setlocal
set ERRORLEVEL=0
set PATH=C:\\Program Files (x86)\\OpenJDK\\jdk-8.0.262.10-hotspot\\bin;$PATH
set CYPRESS_BASE_URL=${cypressFFBaseUrl};
set Host=${FFHost};
set CYPRESS_RUN_BINARY=C:\\Users\\Admin\\AppData\\Local\\Cypress\\Cache\\11.2.0\\Cypress\\Cypress.exe
cd $WORKSPACE/ui/e2e
npm run cy:run-firefox-headed -- --config baseUrl=${cypressFFBaseUrl} --env Host=${FFHost} >> e2e_err.log
"""
powerful-king-41699
12/14/2022, 6:25 PMimport {defineConfig} from "cypress";
export default defineConfig({
video: true,
videoCompression: 20,
viewportWidth: 1680,
viewportHeight: 1050,
MOZ_FORCE_DISABLE_E10S: 1,
numTestsKeptInMemory: 1,
defaultCommandTimeout: 12000,
reporter: "junit",
animationDistanceThreshold: 0,
reporterOptions: {
mochaFile: "results/cypress-report[hash].xml",
toConsole: true,
},
retries: {
runMode: 1,
openMode: 0,
},
env: {
mlHost: "localhost",
FAIL_FAST_STRATEGY: "spec",
},
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require("./cypress/plugins/index.js")(on, config);
},
baseUrl: "http://localhost:8080",
experimentalRunAllSpecs: true,
specPattern: ["cypress/e2e/*/*/*.cy.{js,jsx,ts,tsx}", "cypress/e2e/*/*.cy.{js,jsx,ts,tsx}"],
excludeSpecPattern: [],
},
});
spec:
describe("Add step ", () => {
before(() => {
cy.visit("/");
cy.contains(Application.title);
cy.loginAsDeveloper().withRequest();
LoginPage.postLogin();
//Saving Local Storage to preserve session
cy.saveLocalStorage();
});
it("Navigating to Customer Match tab", () => {
toolbar.getToolbarIcon().should("be.visible").click();
});
});
Have been stuck with this for a long time. Please Help!fresh-doctor-14925
12/15/2022, 9:06 AMnutritious-analyst-96582
12/15/2022, 9:06 AMadorable-stone-42197
12/15/2022, 12:36 PMrough-agent-43374
12/15/2022, 1:18 PMrough-agent-43374
12/15/2022, 1:24 PMthankful-wire-37848
12/15/2022, 1:38 PMexpect($a).to.have.attr('href', '...')
instead? (btw it is a button, not an anchor so better to name the variable "$button" instead)rough-agent-43374
12/15/2022, 1:59 PMthankful-wire-37848
12/15/2022, 2:08 PMcy.get('{the form selector}').should('have.attr', 'action', '{the expected action URL}')
. Same for the target attribute.rough-agent-43374
12/15/2022, 2:27 PMmysterious-psychiatrist-29678
12/15/2022, 4:55 PMCypress.Commands.add('loginOnUI', (username, password, visitingUrl) => {
cy.session([username, password], () => {
cy.visit(visitingUrl)
cy.origin('login.microsoftonline.com', () => {
cy.get("input[type='email']")
.type(Cypress.env('username'))
cy.contains('Next').click();
})
cy.origin('login.live.com', () => {
cy.get("input[type='password']")
.type(Cypress.env('password'))
cy.contains('Sign in').click()
cy.contains('Yes').click()
})
cy.contains('Loading...', {timeout: 40000})
.should('not.be.visible')
})
}
beforeEach(() => {
cy.loginOnUI(Cypress.env('username'), Cypress.env('password'), visitingUrl)
})
happy-megabyte-98400
12/15/2022, 7:28 PMhappy-megabyte-98400
12/15/2022, 7:29 PMthankful-wire-37848
12/15/2022, 7:57 PMcy.visit(...)
. More details here: https://docs.cypress.io/api/commands/session#When-the-page-and-session-data-are-cleared