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

chore(linting): allow e2ePage variable naming #7236

Merged
merged 1 commit into from
Jun 27, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/calcite-components/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@
"unicorn/prevent-abbreviations": [
"error",
{
"allowList": {
"e2ePage": true
},
"extendDefaultReplacements": false,
"replacements": {
"e": {
Expand Down
18 changes: 9 additions & 9 deletions packages/calcite-components/src/tests/commonTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1219,12 +1219,12 @@ export function floatingUIOwner(

export async function t9n(componentTestSetup: ComponentTestSetup): Promise<void> {
let component: E2EElement;
let E2Epage: E2EPage;
let page: E2EPage;
let getCurrentMessages: () => Promise<MessageBundle>;

beforeEach(async () => {
const { page, tag } = await getTagAndPage(componentTestSetup);
E2Epage = page;
const { page: e2ePage, tag } = await getTagAndPage(componentTestSetup);
page = e2ePage;
component = await page.find(tag);
getCurrentMessages = async (): Promise<MessageBundle> => {
return page.$eval(tag, (component: HTMLElement & { messages: MessageBundle }) => component.messages);
Expand All @@ -1245,7 +1245,7 @@ export async function t9n(componentTestSetup: ComponentTestSetup): Promise<void>
const messageOverride = { [firstMessageProp]: "override test" };

component.setProperty("messageOverrides", messageOverride);
await E2Epage.waitForChanges();
await page.waitForChanges();

expect(await getCurrentMessages()).toEqual({
...messages,
Expand All @@ -1254,13 +1254,13 @@ export async function t9n(componentTestSetup: ComponentTestSetup): Promise<void>

// reset test changes
component.setProperty("messageOverrides", undefined);
await E2Epage.waitForChanges();
await page.waitForChanges();
}

async function assertLangSwitch(): Promise<void> {
const enMessages = await getCurrentMessages();
const fakeBundleIdentifier = "__fake__";
await E2Epage.evaluate(
await page.evaluate(
(enMessages, fakeBundleIdentifier) => {
const orig = window.fetch;
window.fetch = async function (input, init) {
Expand All @@ -1282,14 +1282,14 @@ export async function t9n(componentTestSetup: ComponentTestSetup): Promise<void>
);

component.setAttribute("lang", "es");
await E2Epage.waitForChanges();
await E2Epage.waitForTimeout(3000);
await page.waitForChanges();
await page.waitForTimeout(3000);
const esMessages = await getCurrentMessages();

expect(esMessages).toHaveProperty(fakeBundleIdentifier);

// reset test changes
component.removeAttribute("lang");
await E2Epage.waitForChanges();
await page.waitForChanges();
}
}