saleor-dashboard/cypress/e2e/login.js
Karolina Rakoczy 4d1e41517d
In old release versions run small package of most important tests (#2379)
* In old version release run small package of most important tests

* add to releases tests for stocks, warehouses and orders

* Update .github/workflows/tests-nightly.yml

Co-authored-by: Mika <6186720+NyanKiyoshi@users.noreply.github.com>

* remove set-output command

Co-authored-by: Mika <6186720+NyanKiyoshi@users.noreply.github.com>
2022-10-25 19:27:26 +02:00

53 lines
1.4 KiB
JavaScript

/// <reference types="cypress"/>
/// <reference types="../support"/>
import { LOGIN_SELECTORS } from "../elements/account/login-selectors";
import { urlList } from "../fixtures/urlList";
describe("User authorization", () => {
beforeEach(() => {
cy.clearSessionData();
});
it(
"should successfully log in an user",
{ tags: ["@login", "@allEnv", "@stable", "@oldRelease"] },
() => {
cy.visit(urlList.homePage);
cy.loginUser();
cy.get(LOGIN_SELECTORS.welcomePage).should("be.visible");
},
);
it(
"should fail for wrong password",
{ tags: ["@login", "@allEnv", "@stable"] },
() => {
cy.visit(urlList.homePage)
.get(LOGIN_SELECTORS.emailAddressInput)
.type("admin@example.com")
.get(LOGIN_SELECTORS.emailPasswordInput)
.type("wrong-password")
.get(LOGIN_SELECTORS.signInButton)
.click()
.get(LOGIN_SELECTORS.warningCredentialMessage)
.should("be.visible");
},
);
it(
"should successfully log out an user",
{ tags: ["@login", "@allEnv", "@stable"] },
() => {
cy.clearSessionData()
.loginUserViaRequest()
.visit(urlList.homePage)
.get(LOGIN_SELECTORS.userMenu)
.click()
.get(LOGIN_SELECTORS.logOutButton)
.click()
.get(LOGIN_SELECTORS.emailAddressInput)
.should("be.visible");
},
);
});