Closed manuelriveragax closed 2 years ago
Shouldn't the approach to environment variables be in the form process.env.QA_ADMIN_EMAIL
?
Shouldn't the approach to environment variables be in the form
process.env.QA_ADMIN_EMAIL
?
Spec file
import { test, expect } from "@playwright/test";
import { InviteAdminPage } from '@pageObjects/admin';
import { Login } from '@utils/index';
import AdminUser from '@personas/adminUser';
test.describe("Login", () => {
let inviteAdminPage: InviteAdminPage;
let login: Login;
const user = AdminUser.email;
const pw = AdminUser.password;
test.beforeEach(async ({ page, browser, context }, testInfo) => {
inviteAdminPage = new InviteAdminPage(page, browser, context);
login = new Login(page);
await inviteAdminPage.goToHome();
await login.loginFlow(user, pw);
});
test.afterEach(async ({}, testInfo) => {
await inviteAdminPage.page.close();
});
test("Verifies if the admin menus are loading", async ({}) => {
await inviteAdminPage.openInviteAdminMenu();
await expect(inviteAdminPage.emailTextInput).toBeVisible();
await expect(inviteAdminPage.emailTextInput).toHaveValue('');
});
});
AdminUser class
import 'dotenv/config';
class AdminUser {
email: string;
password: string;
constructor(email: string, password: string){
this.email = email;
this.password = password;
}
}
export default new AdminUser(process.env.QA_ADMIN_EMAIL, process.env.QA_ADMIN_PW)
They are being used in the form of process.env.QA_ADMIN_EMAIL
You have a typo in this line:
export default new AdminUser(process.env.QA_ADMIN_EMAIL, process.env.QA_ADMIN_PW)
should be
export default new AdminUser(process.env.QA_ADMIN_EMAIL, process.env.QA_ADMIN_PASSWORD)
to match you yml file.
MY BAD! thanks, love playwright keep up the good work 😄
Context:
Code Snippet
yml file
Error in the GitHub action
Describe the bug
I can see the email value being filled in the trace file, but when it gets to the password input field it crashes. Also tried hard coding the values in the yml file with the same result. It works fine locally using a .env file.